fix dependencies

Dieser Commit ist enthalten in:
Jesse Boyd 2019-08-26 05:45:03 +01:00
Ursprung ae89c16390
Commit 4e49d16505
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
88 geänderte Dateien mit 1536 neuen und 1545 gelöschten Zeilen

Datei anzeigen

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

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

@ -0,0 +1,29 @@
plugins {
`kotlin-dsl`
kotlin("jvm") version embeddedKotlinVersion
}
repositories {
jcenter()
gradlePluginPortal()
}
configurations.all {
resolutionStrategy {
// Fabric needs this.
force(
"commons-io:commons-io:2.5",
"org.ow2.asm:asm:7.1",
"org.ow2.asm:asm-commons:7.1"
)
}
}
dependencies {
implementation(gradleApi())
implementation("org.ajoberstar.grgit:grgit-gradle:3.1.1")
implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
}

Datei anzeigen

@ -0,0 +1,27 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.repositories
fun Project.applyCommonConfiguration() {
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
mavenLocal()
maven { url = uri("http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/") }
maven { url = uri("https://maven.sk89q.com/repo/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { url = uri("http://empcraft.com/maven2") }
maven { url = uri("https://repo.destroystokyo.com/repository/maven-public") }
maven { url = uri("https://ci.athion.net/job/FAWE-Piston/ws/") }
ivy { url = uri("https://ci.athion.net/job")
patternLayout {
artifact("/[organisation]/[revision]/artifact/[module].[ext]")
}}
}
configurations.all {
resolutionStrategy {
cacheChangingModulesFor(5, "minutes")
}
}
}

Datei anzeigen

@ -0,0 +1,12 @@
import org.gradle.api.Project
import org.gradle.api.plugins.ExtraPropertiesExtension
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.the
val Project.ext: ExtraPropertiesExtension
get() = extensions.getByType()
val Project.sourceSets: SourceSetContainer
get() = the<JavaPluginConvention>().sourceSets

Datei anzeigen

@ -0,0 +1,97 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import org.gradle.api.artifacts.ModuleDependency
import org.gradle.api.internal.HasConvention
import org.gradle.api.plugins.MavenRepositoryHandlerConvention
import org.gradle.api.tasks.Upload
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getPlugin
import org.gradle.kotlin.dsl.invoke
import org.gradle.kotlin.dsl.register
fun Project.applyLibrariesConfiguration() {
applyCommonConfiguration()
apply(plugin = "java-base")
apply(plugin = "maven")
apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.jfrog.artifactory")
configurations {
create("shade")
getByName("archives").extendsFrom(getByName("default"))
}
group = "${rootProject.group}.worldedit-libs"
tasks.register<ShadowJar>("jar") {
configurations = listOf(project.configurations["shade"])
archiveClassifier.set("")
dependencies {
exclude(dependency("com.google.guava:guava"))
exclude(dependency("com.google.code.gson:gson"))
exclude(dependency("org.checkerframework:checker-qual"))
}
relocate("net.kyori.text", "com.sk89q.worldedit.util.formatting.text")
}
val altConfigFiles = { artifactType: String ->
val deps = configurations["shade"].incoming.dependencies
.filterIsInstance<ModuleDependency>()
.map { it.copy() }
.map { dependency ->
dependency.artifact {
name = dependency.name
type = artifactType
extension = "jar"
classifier = artifactType
}
dependency
}
files(configurations.detachedConfiguration(*deps.toTypedArray())
.resolvedConfiguration.lenientConfiguration.artifacts
.filter { it.classifier == artifactType }
.map { zipTree(it.file) })
}
tasks.register<Jar>("sourcesJar") {
from({
altConfigFiles("sources")
})
val filePattern = Regex("(.*)net/kyori/text((?:/|$).*)")
val textPattern = Regex("net\\.kyori\\.text")
eachFile {
filter {
it.replaceFirst(textPattern, "com.sk89q.worldedit.util.formatting.text")
}
path = path.replaceFirst(filePattern, "$1com/sk89q/worldedit/util/formatting/text$2")
}
archiveClassifier.set("sources")
}
tasks.named("assemble").configure {
dependsOn("jar", "sourcesJar")
}
artifacts {
val jar = tasks.named("jar")
add("default", jar) {
builtBy(jar)
}
val sourcesJar = tasks.named("sourcesJar")
add("archives", sourcesJar) {
builtBy(sourcesJar)
}
}
tasks.register<Upload>("install") {
configuration = configurations["archives"]
(repositories as HasConvention).convention.getPlugin<MavenRepositoryHandlerConvention>().mavenInstaller {
pom.version = project.version.toString()
pom.artifactId = project.name
}
}
}

Datei anzeigen

@ -0,0 +1,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()
}
}

Datei anzeigen

@ -0,0 +1,8 @@
object Versions {
const val TEXT = "3.0.1"
const val TEXT_EXTRAS = "3.0.2"
const val PISTON = "0.4.4-SNAPSHOT"
const val AUTO_VALUE = "1.6.5"
const val JUNIT = "5.5.0"
const val MOCKITO = "3.0.0"
}

Datei anzeigen

@ -65,10 +65,6 @@
<property name="format" value="(?!Character)\.to(Lower|Upper)Case\(\)"/> <property name="format" value="(?!Character)\.to(Lower|Upper)Case\(\)"/>
<property name="illegalPattern" value="true"/> <property name="illegalPattern" value="true"/>
</module> </module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="ignored|ignore"/>
</module>
</module> </module>
<!-- Validate that command annotations are formatted correctly --> <!-- Validate that command annotations are formatted correctly -->
<module name="RegexpMultiline"> <module name="RegexpMultiline">

Datei anzeigen

@ -6,10 +6,9 @@ Example usage:
You may or may not install these scripts -- it is optional. If you are, however, 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 place the entire craftscripts/ folder into the respective directory for the platform
that you have installed WorldEdit for that you have installed WorldEdit.
(see http://wiki.sk89q.com/wiki/WorldEdit/Installation).
In order to be able to use CraftScripts, you must install the Rhino JavaScript library. 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 The installation page linked above has information about that. More information
about scripts in general can be found at about scripts in general can be found at
http://wiki.sk89q.com/wiki/WorldEdit/Scripting https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/

Datei anzeigen

@ -1,4 +1,4 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. group=com.sk89q.worldedit
# This is required to provide enough memory for the Minecraft decompilation process. #version=7.1.0-SNAPSHOT
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false org.gradle.jvmargs=-Xmx1G

Datei anzeigen

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

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -3,24 +3,22 @@ package com.boydti.fawe.bukkit;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.IFawe; import com.boydti.fawe.IFawe;
import com.boydti.fawe.beta.implementation.QueueHandler; 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.BrushListener;
import com.boydti.fawe.bukkit.listener.BukkitImageListener; import com.boydti.fawe.bukkit.listener.BukkitImageListener;
import com.boydti.fawe.bukkit.listener.RenderListener; import com.boydti.fawe.bukkit.listener.RenderListener;
import com.boydti.fawe.bukkit.regions.*; 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.BukkitTaskMan;
import com.boydti.fawe.bukkit.util.ItemUtil; import com.boydti.fawe.bukkit.util.ItemUtil;
import com.boydti.fawe.bukkit.util.VaultUtil; import com.boydti.fawe.bukkit.util.VaultUtil;
import com.boydti.fawe.bukkit.util.image.BukkitImageViewer; import com.boydti.fawe.bukkit.util.image.BukkitImageViewer;
import com.boydti.fawe.bukkit.v0.ChunkListener_8; import com.boydti.fawe.bukkit.listener.ChunkListener_8;
import com.boydti.fawe.bukkit.v0.ChunkListener_9; import com.boydti.fawe.bukkit.listener.ChunkListener_9;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweCommand; import com.boydti.fawe.object.FaweCommand;
import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.regions.FaweMaskManager; import com.boydti.fawe.regions.FaweMaskManager;
import com.boydti.fawe.util.Jars; import com.boydti.fawe.util.Jars;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.TaskManager; import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.util.image.ImageViewer; 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.Plugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.function.Consumer;
import java.util.function.Supplier; import java.util.function.Supplier;
public class FaweBukkit implements IFawe, Listener { public class FaweBukkit implements IFawe, Listener {

Datei anzeigen

@ -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.Fawe;
import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.beta.implementation.QueueHandler; 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.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
public class BukkitQueueHandler extends QueueHandler { public class BukkitQueueHandler extends QueueHandler {
@Override
public IQueueExtent create() {
return new BukkitQueue();
}
private volatile boolean timingsEnabled; private volatile boolean timingsEnabled;
private static boolean alertTimingsChange = true; private static boolean alertTimingsChange = true;

Datei anzeigen

@ -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.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.LongAdder;
import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;

Datei anzeigen

@ -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.util.ReflectionUtil;
import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.world.registry.BlockMaterial;

Datei anzeigen

@ -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.Fawe;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.bukkit.adapter.DelegateLock;
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.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.collection.BitArray4096; import com.boydti.fawe.object.collection.BitArray4096;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.TaskManager; 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.BlockID;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes; 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.IBlockData;
import net.minecraft.server.v1_14_R1.PlayerChunk; import net.minecraft.server.v1_14_R1.PlayerChunk;
import net.minecraft.server.v1_14_R1.PlayerChunkMap; 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.CraftChunk;
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
import sun.misc.Unsafe; import sun.misc.Unsafe;
@ -45,17 +35,10 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.function.Supplier; 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); World world = WorldWrapper.unwrap(extent);
if (world == null) throw new IllegalArgumentException("Get must be a world."); if (world == null) throw new IllegalArgumentException("Get must be a world.");
if (world instanceof BukkitWorld) { if (world instanceof BukkitWorld) {
@ -66,13 +49,8 @@ public class BukkitQueue extends SimpleCharQueueExtent {
checkNotNull(this.bukkitWorld); checkNotNull(this.bukkitWorld);
CraftWorld craftWorld = ((CraftWorld) bukkitWorld); CraftWorld craftWorld = ((CraftWorld) bukkitWorld);
this.nmsWorld = craftWorld.getHandle(); this.nmsWorld = craftWorld.getHandle();
super.init(extent, get, set);
}
@Override */
protected synchronized void reset() {
super.reset();
}
/* /*
NMS fields NMS fields
@ -172,10 +150,6 @@ public class BukkitQueue extends SimpleCharQueueExtent {
private static boolean PAPER = true; 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) { public static Chunk ensureLoaded(net.minecraft.server.v1_14_R1.World nmsWorld, int X, int Z) {
Chunk nmsChunk = nmsWorld.getChunkIfLoaded(X, Z); Chunk nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
if (nmsChunk != null) { if (nmsChunk != null) {
@ -251,11 +225,6 @@ public class BukkitQueue extends SimpleCharQueueExtent {
return; return;
} }
@Override
public void sendChunk(final int X, final int Z, final int mask) {
sendChunk(nmsWorld, X, Z, mask);
}
/* /*
NMS conversion NMS conversion
*/ */

Datei anzeigen

@ -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.Fawe;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkSet; import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.implementation.QueueHandler; import com.boydti.fawe.beta.implementation.QueueHandler;
import com.boydti.fawe.beta.implementation.blocks.CharGetBlocks; 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.object.collection.BitArray4096;
import com.boydti.fawe.util.ReflectionUtils; import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
@ -51,14 +51,14 @@ import java.util.UUID;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.Future; import java.util.concurrent.Future;
public class BukkitGetBlocks extends CharGetBlocks { public class BukkitGetBlocks_1_14 extends CharGetBlocks {
public ChunkSection[] sections; public ChunkSection[] sections;
public Chunk nmsChunk; public Chunk nmsChunk;
public CraftWorld world; public CraftWorld world;
public int X, Z; public int X, Z;
private boolean forceLoad; 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.world = (CraftWorld) world;
this.X = X; this.X = X;
this.Z = Z; this.Z = Z;
@ -91,7 +91,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
return load(layer, null); 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) { synchronized (get) {
if (this.nmsChunk != nmsChunk) { if (this.nmsChunk != nmsChunk) {
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) { public <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) {
try { try {
WorldServer nmsWorld = world.getHandle(); WorldServer nmsWorld = world.getHandle();
Chunk nmsChunk = BukkitQueue.ensureLoaded(nmsWorld, X, Z); Chunk nmsChunk = BukkitAdapter_1_14.ensureLoaded(nmsWorld, X, Z);
// Remove existing tiles // Remove existing tiles
@ -157,8 +157,8 @@ public class BukkitGetBlocks extends CharGetBlocks {
ChunkSection newSection; ChunkSection newSection;
ChunkSection existingSection = sections[layer]; ChunkSection existingSection = sections[layer];
if (existingSection == null) { if (existingSection == null) {
newSection = BukkitQueue.newChunkSection(layer, setArr); newSection = BukkitAdapter_1_14.newChunkSection(layer, setArr);
if (BukkitQueue.setSectionAtomic(sections, null, newSection, layer)) { if (BukkitAdapter_1_14.setSectionAtomic(sections, null, newSection, layer)) {
updateGet(this, nmsChunk, sections, newSection, setArr, layer); updateGet(this, nmsChunk, sections, newSection, setArr, layer);
continue; continue;
} else { } 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 (this) {
synchronized (lock) { synchronized (lock) {
lock.untilFree(); lock.untilFree();
@ -194,8 +194,8 @@ public class BukkitGetBlocks extends CharGetBlocks {
getArr[i] = value; getArr[i] = value;
} }
} }
newSection = BukkitQueue.newChunkSection(layer, getArr); newSection = BukkitAdapter_1_14.newChunkSection(layer, getArr);
if (!BukkitQueue.setSectionAtomic(sections, existingSection, newSection, layer)) { if (!BukkitAdapter_1_14.setSectionAtomic(sections, existingSection, newSection, layer)) {
System.out.println("Failed to set chunk section:" + X + "," + Z + " layer: " + layer); System.out.println("Failed to set chunk section:" + X + "," + Z + " layer: " + layer);
continue; continue;
} else { } else {
@ -344,7 +344,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
nmsChunk.mustNotSave = false; nmsChunk.mustNotSave = false;
nmsChunk.markDirty(); nmsChunk.markDirty();
// send to player // send to player
BukkitQueue.sendChunk(nmsWorld, X, Z, finalMask); BukkitAdapter_1_14.sendChunk(nmsWorld, X, Z, finalMask);
if (finalizer != null) finalizer.run(); if (finalizer != null) finalizer.run();
}; };
} }
@ -397,7 +397,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
if (data == null || data == FaweCache.IMP.EMPTY_CHAR_4096) { if (data == null || data == FaweCache.IMP.EMPTY_CHAR_4096) {
data = new char[4096]; data = new char[4096];
} }
DelegateLock lock = BukkitQueue.applyLock(section); DelegateLock lock = BukkitAdapter_1_14.applyLock(section);
synchronized (lock) { synchronized (lock) {
lock.untilFree(); lock.untilFree();
lock.setModified(false); lock.setModified(false);
@ -406,8 +406,8 @@ public class BukkitGetBlocks extends CharGetBlocks {
Spigot_v1_14_R1 adapter = ((Spigot_v1_14_R1) WorldEditPlugin.getInstance().getBukkitImplAdapter()); Spigot_v1_14_R1 adapter = ((Spigot_v1_14_R1) WorldEditPlugin.getInstance().getBukkitImplAdapter());
final DataPaletteBlock<IBlockData> blocks = section.getBlocks(); final DataPaletteBlock<IBlockData> blocks = section.getBlocks();
final DataBits bits = (DataBits) BukkitQueue.fieldBits.get(blocks); final DataBits bits = (DataBits) BukkitAdapter_1_14.fieldBits.get(blocks);
final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitQueue.fieldPalette.get(blocks); final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_14.fieldPalette.get(blocks);
final int bitsPerEntry = bits.c(); final int bitsPerEntry = bits.c();
final long[] blockStates = bits.a(); final long[] blockStates = bits.a();
@ -506,7 +506,7 @@ public class BukkitGetBlocks extends CharGetBlocks {
synchronized (this) { synchronized (this) {
tmp = nmsChunk; tmp = nmsChunk;
if (tmp == null) { if (tmp == null) {
nmsChunk = tmp = BukkitQueue.ensureLoaded(this.world.getHandle(), X, Z); nmsChunk = tmp = BukkitAdapter_1_14.ensureLoaded(this.world.getHandle(), X, Z);
} }
} }
} }

Datei anzeigen

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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.boydti.fawe.Fawe;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;

Datei anzeigen

@ -0,0 +1,4 @@
package com.boydti.fawe.bukkit.listener;
public class ChunkCache {
}

Datei anzeigen

@ -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.Fawe;
import com.boydti.fawe.bukkit.FaweBukkit; import com.boydti.fawe.bukkit.FaweBukkit;

Datei anzeigen

@ -1,4 +1,4 @@
package com.boydti.fawe.bukkit.v0; package com.boydti.fawe.bukkit.listener;
import sun.misc.SharedSecrets; import sun.misc.SharedSecrets;

Datei anzeigen

@ -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.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;

Datei anzeigen

@ -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.Fawe;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;

Datei anzeigen

@ -1,12 +1,9 @@
package com.boydti.fawe.bukkit.util; package com.boydti.fawe.bukkit.util;
import com.boydti.fawe.bukkit.beta.BukkitQueue;
import com.boydti.fawe.util.ReflectionUtils; import com.boydti.fawe.util.ReflectionUtils;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.Tag; 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.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;

Datei anzeigen

@ -57,10 +57,6 @@ public class PermissionsResolverManager implements PermissionsResolver {
"# into WEPIF, paste it into http://yaml-online-parser.appspot.com/\r\n" + "# into WEPIF, paste it into http://yaml-online-parser.appspot.com/\r\n" +
"# and see if it gives \"ERROR:\".\r\n" + "# and see if it gives \"ERROR:\".\r\n" +
"# - Lines starting with # are comments and so they are ignored.\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"; "\r\n";
private static PermissionsResolverManager instance; private static PermissionsResolverManager instance;

Datei anzeigen

@ -28,6 +28,7 @@ import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.entity.BaseEntity; 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.BlockVector3;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.AbstractWorld;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
@ -252,9 +254,6 @@ public class BukkitWorld extends AbstractWorld {
@Override @Override
public boolean clearContainerBlockContents(BlockVector3 pt) { public boolean clearContainerBlockContents(BlockVector3 pt) {
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
if (block == null) {
return false;
}
BlockState state = block.getState(); BlockState state = block.getState();
if (!(state instanceof InventoryHolder)) { if (!(state instanceof InventoryHolder)) {
return false; return false;
@ -321,14 +320,12 @@ public class BukkitWorld extends AbstractWorld {
public void checkLoadedChunk(BlockVector3 pt) { public void checkLoadedChunk(BlockVector3 pt) {
World world = getWorld(); World world = getWorld();
if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) { world.getChunkAt(pt.getBlockX() >> 4, pt.getBlockZ() >> 4);
world.loadChunk(pt.getBlockX() >> 4, pt.getBlockZ() >> 4);
}
} }
@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
World ref = worldRef.get(); final World ref = worldRef.get();
if (ref == null) { if (ref == null) {
return false; return false;
} else if (other == null) { } else if (other == null) {
@ -337,7 +334,7 @@ public class BukkitWorld extends AbstractWorld {
World otherWorld = ((BukkitWorld) other).worldRef.get(); World otherWorld = ((BukkitWorld) other).worldRef.get();
return ref.equals(otherWorld); return ref.equals(otherWorld);
} else if (other instanceof com.sk89q.worldedit.world.World) { } 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 { } else {
return false; return false;
} }

Datei anzeigen

@ -37,16 +37,24 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader;
import com.sk89q.worldedit.event.platform.CommandEvent; import com.sk89q.worldedit.event.platform.CommandEvent;
import com.sk89q.worldedit.event.platform.CommandSuggestionEvent; import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
import com.sk89q.worldedit.event.platform.PlatformReadyEvent; 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.Actor;
import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.extension.platform.Platform; import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.internal.command.CommandUtil; 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.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockCategory; 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.entity.EntityType;
import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldedit.world.item.ItemCategory; import com.sk89q.worldedit.world.item.ItemCategory;
import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.weather.WeatherTypes;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
@ -214,7 +222,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
PaperLib.suggestPaper(this); PaperLib.suggestPaper(this);
} }
public void setupRegistries() { private void setupRegistries() {
// Biome // Biome
for (Biome biome : Biome.values()) { for (Biome biome : Biome.values()) {
String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT); 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)); EntityType.REGISTRY.register("minecraft:" + lowerCaseMcId, new EntityType("minecraft:" + lowerCaseMcId));
} }
} }
// ... :|
GameModes.get("");
WeatherTypes.get("");
} }
private void setupTags() { private void setupTags() {
@ -428,7 +439,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
// code of WorldEdit expects it // code of WorldEdit expects it
String[] split = new String[args.length + 1]; String[] split = new String[args.length + 1];
System.arraycopy(args, 0, split, 1, args.length); 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)); CommandEvent event = new CommandEvent(wrapCommandSender(sender), Joiner.on(" ").join(split));
getWorldEdit().getEventBus().post(event); getWorldEdit().getEventBus().post(event);
@ -443,7 +454,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
// code of WorldEdit expects it // code of WorldEdit expects it
String[] split = new String[args.length + 1]; String[] split = new String[args.length + 1];
System.arraycopy(args, 0, split, 1, args.length); System.arraycopy(args, 0, split, 1, args.length);
split[0] = "/" + cmd.getName(); split[0] = "/" + commandLabel;
String arguments = Joiner.on(" ").join(split); String arguments = Joiner.on(" ").join(split);
CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), arguments); CommandSuggestionEvent event = new CommandSuggestionEvent(wrapCommandSender(sender), arguments);
@ -577,9 +588,9 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter
if (!event.isCommand()) return; if (!event.isCommand()) return;
String buffer = event.getBuffer(); String buffer = event.getBuffer();
final String[] parts = buffer.split(" "); int firstSpace = buffer.indexOf(' ');
if (parts.length < 1) return; if (firstSpace < 0) return;
final String label = parts[0]; final String label = buffer.substring(0, firstSpace);
final Optional<org.enginehub.piston.Command> command final Optional<org.enginehub.piston.Command> command
= WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label); = WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand(label);
if (!command.isPresent()) return; if (!command.isPresent()) return;

Datei anzeigen

@ -54,7 +54,7 @@ public class BukkitImplLoader {
"** will be blank, and so on. There will be no support for entity\n" + "** will be blank, and so on. There will be no support for entity\n" +
"** and block property-related functions.\n" + "** and block property-related functions.\n" +
"**\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"; "**********************************************\n";
/** /**

Datei anzeigen

@ -1,10 +1,10 @@
name: WorldEdit name: WorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin main: com.sk89q.worldedit.bukkit.WorldEditPlugin
version: ${version} version: "${internalVersion}"
load: STARTUP
api-version: 1.13 api-version: 1.13
description: Fast Async WorldEdit plugin description: Fast Async WorldEdit plugin
authors: [Empire92] authors: [Empire92, MattBDev]
load: STARTUP
loadbefore: [BannerBoard, WorldGuard, PlotSquared, AsyncWorldEdit, AsyncWorldEditInjector] loadbefore: [BannerBoard, WorldGuard, PlotSquared, AsyncWorldEdit, AsyncWorldEditInjector]
database: false database: false
permissions: permissions:

Datei anzeigen

@ -19,20 +19,20 @@
package com.sk89q.wepif; 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.Server;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; 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 { public class DinnerPermsResolverTest {
private DinnerPermsResolver resolver; private DinnerPermsResolver resolver;
@Before @BeforeEach
public void setUp() { public void setUp() {
Server server = mock(Server.class); Server server = mock(Server.class);
when(server.getPluginManager()).thenReturn(mock(PluginManager.class)); when(server.getPluginManager()).thenReturn(mock(PluginManager.class));

Datei anzeigen

@ -30,6 +30,7 @@ import org.bukkit.plugin.Plugin;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -52,7 +53,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
@Override @Override
public boolean isPermissionSet(String s) { public boolean isPermissionSet(String s) {
return assignedPermissions.containsKey(s.toLowerCase()); return assignedPermissions.containsKey(s.toLowerCase(Locale.ROOT));
} }
@Override @Override
@ -63,7 +64,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
@Override @Override
public boolean hasPermission(String s) { public boolean hasPermission(String s) {
if (isPermissionSet(s)) { if (isPermissionSet(s)) {
return assignedPermissions.get(s.toLowerCase()); return assignedPermissions.get(s.toLowerCase(Locale.ROOT));
} }
return false; return false;
} }
@ -113,11 +114,11 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
} }
public void setPermission(String permission, boolean value) { public void setPermission(String permission, boolean value) {
assignedPermissions.put(permission.toLowerCase(), value); assignedPermissions.put(permission.toLowerCase(Locale.ROOT), value);
} }
public void unsetPermission(String permission) { public void unsetPermission(String permission) {
assignedPermissions.remove(permission.toLowerCase()); assignedPermissions.remove(permission.toLowerCase(Locale.ROOT));
} }
public void clearPermissions() { public void clearPermissions() {

Datei anzeigen

@ -20,15 +20,16 @@
package com.sk89q.worldedit.bukkit; package com.sk89q.worldedit.bukkit;
import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator;
import org.junit.Assert; import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public class BukkitWorldTest { public class BukkitWorldTest {
@Test @Test
public void testTreeTypeMapping() { public void testTreeTypeMapping() {
for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) {
Assert.assertNotNull("No mapping for: " + type, BukkitWorld.toBukkitTreeType(type)); assertNotNull(BukkitWorld.toBukkitTreeType(type), "No mapping for: " + type);
} }
} }

Datei anzeigen

@ -1,129 +0,0 @@
plugins {
id("java-library")
id("eclipse")
id("idea")
id("net.ltgt.apt") version "0.21" apply false
id "net.ltgt.apt-eclipse" version "0.21"
id "net.ltgt.apt-idea" version "0.21"
}
repositories {
maven {url "http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/"}
}
configurations.all { Configuration it ->
it.resolutionStrategy { ResolutionStrategy rs ->
rs.force("com.google.guava:guava:21.0")
}
it.resolutionStrategy { ResolutionStrategy rs ->
rs.force("it.unimi.dsi:fastutil:8.2.1")
}
}
dependencies {
compile project(':worldedit-libs:core')
compile 'de.schlichtherle:truezip:6.8.3'
compile 'rhino:js:1.7R2'
compile 'org.yaml:snakeyaml:1.23'
compile 'com.google.guava:guava:21.0'
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile 'com.thoughtworks.paranamer:paranamer:2.6'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'org.slf4j:slf4j-api:1.7.26'
compile "it.unimi.dsi:fastutil:8.2.1"
compileOnly project(':worldedit-libs:core:ap')
annotationProcessor project(':worldedit-libs:core:ap')
annotationProcessor "com.google.guava:guava:21.0"
def avVersion = "1.6.5"
compileOnly "com.google.auto.value:auto-value-annotations:$avVersion"
annotationProcessor "com.google.auto.value:auto-value:$avVersion"
//compile 'net.sf.trove4j:trove4j:3.0.3'
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
// Fawe depends
compileOnly 'net.fabiozumbi12:redprotect:1.9.6'
compileOnly ("com.github.intellectualsites.plotsquared:PlotSquared-API:latest") {
transitive = false
}
compile 'com.mojang:datafixerupper:1.0.20'
compile 'com.github.luben:zstd-jni:1.1.1'
compile 'co.aikar:fastutil-lite:1.0'
testImplementation ("org.junit.jupiter:junit-jupiter-api:5.5.0")
testImplementation ("org.junit.jupiter:junit-jupiter-params:5.5.0")
testImplementation ("org.mockito:mockito-core:3.0.0")
testImplementation ("org.mockito:mockito-junit-jupiter:3.0.0")
testRuntime ("org.junit.jupiter:junit-jupiter-engine:5.5.0")
}
tasks.withType(JavaCompile).configureEach {
dependsOn(":worldedit-libs:build")
it.options.compilerArgs << "-Xmaxerrs" << "10000"
it.options.compilerArgs.add("-Aarg.name.key.prefix=")
}
sourceSets {
main {
java {
srcDir 'src/main/java'
srcDir 'src/legacy/java'
}
resources {
srcDir 'src/main/resources'
}
}
}
processResources {
from('src/main/resources') {
include 'fawe.properties'
expand(
version: "${project.parent.version}",
name: project.parent.name,
commit: "${git.head().abbreviatedId}",
date: "${git.head().getDate().format("yy.MM.dd")}"
)
}
}
jar.archiveName="fawe-api-${project.parent.version}.jar"
jar.destinationDir = file '../mvn/com/boydti/fawe-api/' + project.parent.version
task createPom {
doLast {
pom {
project {
groupId 'com.boydti'
artifactId 'fawe-api'
version project.parent.version
}
}
.getEffectivePom()
.setDependencies(new ArrayList<>())
.writeTo("../mvn/com/boydti/fawe-api/${project.parent.version}/fawe-api-${project.parent.version}.pom")
pom {
project {
groupId 'com.boydti'
artifactId 'fawe-api'
version 'latest'
}
}
.getEffectivePom()
.setDependencies(new ArrayList<>())
.writeTo("../mvn/com/boydti/fawe-api/latest/fawe-api-latest.pom")
}
}
task copyFiles {
doLast {
copy {
from "../mvn/com/boydti/fawe-api/${project.parent.version}/"
into '../mvn/com/boydti/fawe-api/latest/'
include('*.jar')
rename ("fawe-api-${project.parent.version}.jar", 'fawe-api-latest.jar')
}
}
}
build.dependsOn(shadowJar)
build.finalizedBy(copyFiles)
copyFiles.dependsOn(createPom)

Datei anzeigen

@ -0,0 +1,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"))
}
}

Datei anzeigen

@ -159,11 +159,6 @@ public interface IDelegateQueueExtent extends IQueueExtent {
return getParent().isEmpty(); return getParent().isEmpty();
} }
@Override
default void sendChunk(int chunkX, int chunkZ, int bitMask) {
getParent().sendChunk(chunkX, chunkZ, bitMask);
}
@Override @Override
default boolean trim(boolean aggressive) { default boolean trim(boolean aggressive) {
return getParent().trim(aggressive); return getParent().trim(aggressive);

Datei anzeigen

@ -182,14 +182,4 @@ public interface IQueueExtent extends Flushable, Trimable, Extent {
* @return If queue is empty * @return If queue is empty
*/ */
boolean isEmpty(); 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);
} }

Datei anzeigen

@ -2,6 +2,7 @@ package com.boydti.fawe.beta.implementation;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.ChunkFilterBlock;
import com.boydti.fawe.beta.IChunk; import com.boydti.fawe.beta.IChunk;
import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet; 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); public abstract void startSet(boolean parallel);

Datei anzeigen

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

Datei anzeigen

@ -1,6 +1,8 @@
package com.boydti.fawe.beta.implementation; package com.boydti.fawe.beta.implementation;
import com.boydti.fawe.Fawe; 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.IChunk;
import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet; import com.boydti.fawe.beta.IChunkSet;
@ -25,7 +27,7 @@ import java.util.concurrent.Future;
* <p> * <p>
* This queue is reusable {@link #init(IChunkCache)} * 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) // // Pool discarded chunks for reuse (can safely be cleared by another thread)
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>(); // private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
@ -299,4 +301,9 @@ public abstract class SingleThreadQueueExtent implements IQueueExtent {
pollSubmissions(0, true); pollSubmissions(0, true);
reset(); reset();
} }
@Override
public ChunkFilterBlock initFilterBlock() {
return new CharFilterBlock(this);
}
} }

Datei anzeigen

@ -42,7 +42,7 @@ public class CFICommand extends CommandProcessor<Object, Object> {
} }
@Override @Override
public Object process(InjectedValueAccess context, List<String> args, Object result) { public int process(InjectedValueAccess context, List<String> args, int result) {
return result; return result;
} }

Datei anzeigen

@ -67,13 +67,13 @@ public abstract class CommandProcessor<I, O> implements CommandManager {
} }
@Override @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); args = preprocess(context, args);
if (args != null) { 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) return process(context, args, result); // TODO NOT IMPLEMENTED (recompile piston)
} else { } 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 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);
} }

Datei anzeigen

@ -2,9 +2,7 @@ package com.boydti.fawe.object.brush.visualization.cfi;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IBlocks;
import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.IQueueExtent; import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.beta.implementation.FallbackChunkGet; import com.boydti.fawe.beta.implementation.FallbackChunkGet;
import com.boydti.fawe.object.FaweInputStream; 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.changeset.CFIChangeSet;
import com.boydti.fawe.object.collection.DifferentialArray; import com.boydti.fawe.object.collection.DifferentialArray;
import com.boydti.fawe.object.collection.DifferentialBlockBuffer; 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.LocalBlockVector2DSet;
import com.boydti.fawe.object.collection.SummedAreaTable; import com.boydti.fawe.object.collection.SummedAreaTable;
import com.boydti.fawe.object.exception.FaweException; 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.registry.state.PropertyKey;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.Location; 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.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes; 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.BlockID;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import javax.annotation.Nullable;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -64,9 +63,7 @@ import java.nio.file.Path;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import javax.annotation.Nullable;
// TODO FIXME // TODO FIXME
public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Drawable, VirtualWorld { 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() { public TextureUtil getRawTextureUtil() {
if (textureUtil == null) { if (textureUtil == null) {
textureUtil = Fawe.get().getTextureUtil(); textureUtil = Fawe.get().getTextureUtil();
@ -849,7 +851,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
@Override @Override
public void close(boolean update) { public void close(boolean update) {
if (chunkOffset != null && player != null && 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 lenCX = (getWidth() + 15) >> 4;
int lenCZ = (getLength() + 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 cz = scz; cz <= ecz; cz++) {
for (int cx = scx; cx <= ecx; cx++) { for (int cx = scx; cx <= ecx; cx++) {
packetQueue.sendChunk(cx + OX, cz + OZ, 0); world.sendChunk(cx + OX, cz + OZ, 0);
} }
} }
} }

Datei anzeigen

@ -121,7 +121,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
@Override @Override
public void refreshChunk(int x, int z) { public void refreshChunk(int x, int z) {
IMP.sendChunk(x, z, 0); world.sendChunk(x, z, 0);
} }
@Override @Override

Datei anzeigen

@ -59,9 +59,9 @@ public class PlotSetBiome extends Command {
Collection<BiomeType> knownBiomes = BiomeTypes.values(); Collection<BiomeType> knownBiomes = BiomeTypes.values();
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry); final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
if (biome == null) { 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); 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; return;
} }
confirm.run(this, new Runnable() { confirm.run(this, new Runnable() {

Datei anzeigen

@ -34,9 +34,9 @@ import com.sk89q.worldedit.command.ChunkCommands;
import com.sk89q.worldedit.command.ClipboardCommands; import com.sk89q.worldedit.command.ClipboardCommands;
import com.sk89q.worldedit.command.GenerationCommands; import com.sk89q.worldedit.command.GenerationCommands;
import com.sk89q.worldedit.command.HistoryCommands; import com.sk89q.worldedit.command.HistoryCommands;
import com.sk89q.worldedit.command.MaskCommands; //import com.sk89q.worldedit.command.MaskCommands;
import com.sk89q.worldedit.command.NavigationCommands; import com.sk89q.worldedit.command.NavigationCommands;
import com.sk89q.worldedit.command.PatternCommands; //import com.sk89q.worldedit.command.PatternCommands;
import com.sk89q.worldedit.command.RegionCommands; import com.sk89q.worldedit.command.RegionCommands;
import com.sk89q.worldedit.command.SchematicCommands; import com.sk89q.worldedit.command.SchematicCommands;
import com.sk89q.worldedit.command.ScriptingCommands; import com.sk89q.worldedit.command.ScriptingCommands;
@ -45,7 +45,7 @@ import com.sk89q.worldedit.command.SnapshotCommands;
import com.sk89q.worldedit.command.SnapshotUtilCommands; import com.sk89q.worldedit.command.SnapshotUtilCommands;
import com.sk89q.worldedit.command.SuperPickaxeCommands; import com.sk89q.worldedit.command.SuperPickaxeCommands;
import com.sk89q.worldedit.command.ToolCommands; import com.sk89q.worldedit.command.ToolCommands;
import com.sk89q.worldedit.command.TransformCommands; //import com.sk89q.worldedit.command.TransformCommands;
import com.sk89q.worldedit.command.UtilityCommands; import com.sk89q.worldedit.command.UtilityCommands;
import com.sk89q.worldedit.command.WorldEditCommands; import com.sk89q.worldedit.command.WorldEditCommands;
import org.enginehub.piston.annotation.param.Arg; import org.enginehub.piston.annotation.param.Arg;
@ -127,9 +127,9 @@ public final class DocumentationPrinter {
writePermissionsWikiTable(stream, builder, "/", BrushOptionsCommands.class); writePermissionsWikiTable(stream, builder, "/", BrushOptionsCommands.class);
writePermissionsWikiTable(stream, builder, "/tool ", ToolCommands.class); writePermissionsWikiTable(stream, builder, "/tool ", ToolCommands.class);
writePermissionsWikiTable(stream, builder, "/brush ", BrushCommands.class); writePermissionsWikiTable(stream, builder, "/brush ", BrushCommands.class);
writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks"); //writePermissionsWikiTable(stream, builder, "", MaskCommands.class, "/Masks");
writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns"); //writePermissionsWikiTable(stream, builder, "", PatternCommands.class, "/Patterns");
writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms"); //writePermissionsWikiTable(stream, builder, "", TransformCommands.class, "/Transforms");
writePermissionsWikiTable(stream, builder, "/cfi ", CFICommands.class, "Create From Image"); writePermissionsWikiTable(stream, builder, "/cfi ", CFICommands.class, "Create From Image");
stream.println(); stream.println();
stream.print("#### Uncategorized\n"); stream.print("#### Uncategorized\n");

Datei anzeigen

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

Datei anzeigen

@ -228,6 +228,11 @@ public class WorldWrapper extends AbstractWorld {
return parent.hashCode(); return parent.hashCode();
} }
@Override
public void sendChunk(int X, int Z, int mask) {
parent.sendChunk(X, Z, mask);
}
@Override @Override
public List<? extends Entity> getEntities(final Region region) { public List<? extends Entity> getEntities(final Region region) {
return TaskManager.IMP.sync(new RunnableVal<List<? extends Entity>>() { return TaskManager.IMP.sync(new RunnableVal<List<? extends Entity>>() {

Datei anzeigen

@ -26,8 +26,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class CommandContext { public class CommandContext {
@ -256,8 +254,11 @@ public class CommandContext {
} }
public String getString(int start, int end) { public String getString(int start, int end) {
return IntStream.range(start + 1, end + 1).mapToObj(i -> " " + parsedArgs.get(i)) StringBuilder buffer = new StringBuilder(parsedArgs.get(start));
.collect(Collectors.joining("", 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 { public int getInteger(int index) throws NumberFormatException {

Datei anzeigen

@ -72,6 +72,7 @@ import com.sk89q.worldedit.regions.selector.RegionSelectorType;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Identifiable;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
@ -395,7 +396,7 @@ public class LocalSession implements TextureHolder {
return null; 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) { if (Settings.IMP.HISTORY.USE_DISK) {
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE; 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) { if (Settings.IMP.HISTORY.USE_DISK) {
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE; LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
} }

Datei anzeigen

@ -81,7 +81,6 @@ import java.util.Map;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.script.ScriptException; import javax.script.ScriptException;
import org.mozilla.javascript.NativeJavaObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -109,7 +108,8 @@ public final class WorldEdit {
private final PlatformManager platformManager = new PlatformManager(this); private final PlatformManager platformManager = new PlatformManager(this);
private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus); private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus);
private final SessionManager sessions = new SessionManager(this); 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 Supervisor supervisor = new SimpleSupervisor();
private final BlockFactory blockFactory = new BlockFactory(this); private final BlockFactory blockFactory = new BlockFactory(this);
@ -635,14 +635,14 @@ public final class WorldEdit {
* @param args arguments for the script * @param args arguments for the script
* @throws WorldEditException * @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(); String filename = f.getPath();
int index = filename.lastIndexOf('.'); int index = filename.lastIndexOf('.');
String ext = filename.substring(index + 1); String ext = filename.substring(index + 1);
if (!ext.equalsIgnoreCase("js")) { if (!ext.equalsIgnoreCase("js")) {
player.printError("Only .js scripts are currently supported"); player.printError("Only .js scripts are currently supported");
return null; return;
} }
String script; String script;
@ -655,7 +655,7 @@ public final class WorldEdit {
if (file == null) { if (file == null) {
player.printError("Script does not exist: " + filename); player.printError("Script does not exist: " + filename);
return null; return;
} }
} else { } else {
file = new FileInputStream(f); file = new FileInputStream(f);
@ -668,7 +668,7 @@ public final class WorldEdit {
script = new String(data, 0, data.length, StandardCharsets.UTF_8); script = new String(data, 0, data.length, StandardCharsets.UTF_8);
} catch (IOException e) { } catch (IOException e) {
player.printError("Script read error: " + e.getMessage()); player.printError("Script read error: " + e.getMessage());
return null; return;
} }
LocalSession session = getSessionManager().get(player); LocalSession session = getSessionManager().get(player);
@ -681,8 +681,8 @@ public final class WorldEdit {
engine = new RhinoCraftScriptEngine(); engine = new RhinoCraftScriptEngine();
} catch (NoClassDefFoundError ignored) { } catch (NoClassDefFoundError ignored) {
player.printError("Failed to find an installed script engine."); player.printError("Failed to find an installed script engine.");
player.printError("Please see https://worldedit.readthedocs.io/en/latest/usage/other/craftscripts/"); player.printError("Please see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/");
return null; return;
} }
engine.setTimeLimit(getConfiguration().scriptTimeout); engine.setTimeLimit(getConfiguration().scriptTimeout);
@ -693,11 +693,7 @@ public final class WorldEdit {
vars.put("player", player); vars.put("player", player);
try { try {
Object result = engine.evaluate(script, filename, vars); engine.evaluate(script, filename, vars);
if (result instanceof NativeJavaObject) {
result = ((NativeJavaObject) result).unwrap();
}
return result;
} catch (ScriptException e) { } catch (ScriptException e) {
player.printError("Failed to execute:"); player.printError("Failed to execute:");
player.printRaw(e.getMessage()); player.printRaw(e.getMessage());
@ -714,7 +710,6 @@ public final class WorldEdit {
session.remember(editSession); session.remember(editSession);
} }
} }
return null;
} }
/** /**

Datei anzeigen

@ -53,6 +53,7 @@ import com.boydti.fawe.object.brush.StencilBrush;
import com.boydti.fawe.object.brush.SurfaceSphereBrush; import com.boydti.fawe.object.brush.SurfaceSphereBrush;
import com.boydti.fawe.object.brush.SurfaceSpline; import com.boydti.fawe.object.brush.SurfaceSpline;
import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap; 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.brush.sweep.SweepBrush;
import com.boydti.fawe.object.clipboard.MultiClipboardHolder; import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
import com.boydti.fawe.object.mask.IdMask; 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" "Pic: https://i.imgur.com/cNUQUkj.png -> https://i.imgur.com/hFOFsNf.png"
) )
@CommandPermissions("worldedit.brush.blendball") @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") @Arg(desc = "The radius to sample for blending", def = "5")
Expression radius, InjectedValueAccess context) throws WorldEditException { Expression radius, InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, new BlendBall()).setSize(radius); set(session, context, new BlendBall()).setSize(radius);
} }
@Command( @Command(
@ -164,11 +165,11 @@ public class BrushCommands {
desc = "Erodes terrain" desc = "Erodes terrain"
) )
@CommandPermissions("worldedit.brush.erode") @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") @Arg(desc = "The radius for eroding", def = "5")
Expression radius, InjectedValueAccess context) throws WorldEditException { Expression radius, InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, new ErodeBrush()).setSize(radius); set(session, context, new ErodeBrush()).setSize(radius);
} }
@Command( @Command(
@ -176,11 +177,11 @@ public class BrushCommands {
desc = "Pull terrain towards you" desc = "Pull terrain towards you"
) )
@CommandPermissions("worldedit.brush.pull") @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") @Arg(desc = "The radius to sample for blending", def = "5")
Expression radius, InjectedValueAccess context) throws WorldEditException { Expression radius, InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, new RaiseBrush()).setSize(radius); set(session, context, new RaiseBrush()).setSize(radius);
} }
@Command( @Command(
@ -188,11 +189,11 @@ public class BrushCommands {
desc = "Creates a circle which revolves around your facing direction" desc = "Creates a circle which revolves around your facing direction"
) )
@CommandPermissions("worldedit.brush.sphere") @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") @Arg(desc = "The radius to sample for blending", def = "5")
Expression radius, InjectedValueAccess context) throws WorldEditException { Expression radius, InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); 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( @Command(
@ -203,18 +204,15 @@ public class BrushCommands {
"Note: Set a mask to recurse along specific blocks" "Note: Set a mask to recurse along specific blocks"
) )
@CommandPermissions("worldedit.brush.recursive") @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") @Arg(desc = "The radius to sample for blending", def = "5")
Expression radius, Expression radius,
@Switch(name = 'd', desc = "Apply in depth first order") @Switch(name = 'd', desc = "Apply in depth first order")
boolean depthFirst, boolean depthFirst,
InjectedValueAccess context) throws WorldEditException { InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, set(session, context, new RecurseBrush(depthFirst))
new RecurseBrush(depthFirst)) .setSize(radius).setFill(fill).setMask(new IdMask(editSession));
.setSize(radius)
.setFill(fill)
.setMask(new IdMask(editSession));
} }
@Command( @Command(
@ -223,7 +221,7 @@ public class BrushCommands {
desc = "Create lines" desc = "Create lines"
) )
@CommandPermissions("worldedit.brush.line") @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") @Arg(desc = "The radius to sample for blending", def = "0")
Expression radius, Expression radius,
@Switch(name = 'h', desc = "Create only a shell") @Switch(name = 'h', desc = "Create only a shell")
@ -233,10 +231,7 @@ public class BrushCommands {
@Switch(name = 'f', desc = "Create a flat line") @Switch(name = 'f', desc = "Create a flat line")
boolean flat, InjectedValueAccess context) throws WorldEditException { boolean flat, InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, set(session, context, new LineBrush(shell, select, flat)).setSize(radius).setFill(fill);
new LineBrush(shell, select, flat))
.setSize(radius)
.setFill(fill);
} }
@Command( @Command(
@ -250,12 +245,12 @@ public class BrushCommands {
"Tutorial: https://www.planetminecraft.com/blog/fawe-tutorial/" "Tutorial: https://www.planetminecraft.com/blog/fawe-tutorial/"
) )
@CommandPermissions("worldedit.brush.spline") @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") @Arg(desc = "The radius to sample for blending", def = "25")
Expression radius, InjectedValueAccess context) throws WorldEditException { Expression radius, InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
player.print(BBC.BRUSH_SPLINE.format(radius)); player.print(BBC.BRUSH_SPLINE.format(radius));
return set(session, context, set(session, context,
new SplineBrush(player, session)) new SplineBrush(player, session))
.setSize(radius) .setSize(radius)
.setFill(fill); .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" "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") @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()); player.print(BBC.BRUSH_SPLINE.s());
return set(session, context, new SweepBrush(copies)); set(session, context, new SweepBrush(copies));
} }
@Command( @Command(
@ -281,7 +276,7 @@ public class BrushCommands {
desc = "Create a hanging line between two points" desc = "Create a hanging line between two points"
) )
@CommandPermissions("worldedit.brush.spline") @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") @Arg(desc = "The radius to sample for blending", def = "0")
Expression radius, Expression radius,
@Switch(name = 'h', desc = "Create only a shell") @Switch(name = 'h', desc = "Create only a shell")
@ -293,7 +288,7 @@ public class BrushCommands {
InjectedValueAccess context) throws WorldEditException { InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
Brush brush = new CatenaryBrush(shell, select, facingDirection, lengthFactor); Brush brush = new CatenaryBrush(shell, select, facingDirection, lengthFactor);
return set(session, context, set(session, context,
new CatenaryBrush(shell, select, facingDirection, lengthFactor)) new CatenaryBrush(shell, select, facingDirection, lengthFactor))
.setSize(radius) .setSize(radius)
.setFill(fill); .setFill(fill);
@ -307,12 +302,12 @@ public class BrushCommands {
"Video: https://www.youtube.com/watch?v=zSN-2jJxXlM" "Video: https://www.youtube.com/watch?v=zSN-2jJxXlM"
) )
@CommandPermissions("worldedit.brush.surfacespline") // 0, 0, 0, 10, 0, @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") @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 { 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)); player.print(BBC.BRUSH_SPLINE.format(radius));
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, set(session, context,
new SurfaceSpline(tension, bias, continuity, quality)) new SurfaceSpline(tension, bias, continuity, quality))
.setSize(radius) .setSize(radius)
.setFill(fill); .setFill(fill);
@ -324,14 +319,11 @@ public class BrushCommands {
desc = "Creates a distorted sphere" desc = "Creates a distorted sphere"
) )
@CommandPermissions("worldedit.brush.rock") @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()); double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ());
worldEdit.checkMaxBrushRadius(max); worldEdit.checkMaxBrushRadius(max);
Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100); Brush brush = new BlobBrush(radius.divide(max), frequency / 100, amplitude / 100, sphericity / 100);
return set(session, context, set(session, context, brush).setSize(max).setFill(fill);
brush)
.setSize(max)
.setFill(fill);
} }
@Command( @Command(
@ -340,7 +332,7 @@ public class BrushCommands {
desc = "Choose the sphere brush" desc = "Choose the sphere brush"
) )
@CommandPermissions("worldedit.brush.sphere") @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") @Arg(desc = "The pattern of blocks to set")
Pattern pattern, Pattern pattern,
@Arg(desc = "The radius of the sphere", def = "2") @Arg(desc = "The radius of the sphere", def = "2")
@ -370,7 +362,7 @@ public class BrushCommands {
} }
} }
return set(session, context, set(session, context,
brush) brush)
.setSize(radius) .setSize(radius)
.setFill(pattern); .setFill(pattern);
@ -384,12 +376,12 @@ public class BrushCommands {
"Pic: https://i.imgur.com/2xKsZf2.png" "Pic: https://i.imgur.com/2xKsZf2.png"
) )
@CommandPermissions("worldedit.brush.shatter") @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") @Arg(desc = "The radius to sample for blending", def = "10")
Expression radius, Expression radius,
@Arg(desc = "Lines", def = "10") int count, InjectedValueAccess context) throws WorldEditException { @Arg(desc = "Lines", def = "10") int count, InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, set(session, context,
new ShatterBrush(count)) new ShatterBrush(count))
.setSize(radius) .setSize(radius)
.setFill(fill) .setFill(fill)
@ -402,7 +394,7 @@ public class BrushCommands {
descFooter = "Use a height map to paint any surface.\n" descFooter = "Use a height map to paint any surface.\n"
) )
@CommandPermissions("worldedit.brush.stencil") @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 = "radius", desc = "Expression", def = "5") Expression radius,
@Arg(name = "image", desc = "String", def = "") String image, @Arg(name = "image", desc = "String", def = "") String image,
@Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation, @Arg(def = "0", desc = "rotation") @Range(min = 0, max = 360) int rotation,
@ -421,7 +413,7 @@ public class BrushCommands {
if (randomRotate) { if (randomRotate) {
brush.setRandomRotate(true); brush.setRandomRotate(true);
} }
return set(session, context, set(session, context,
brush) brush)
.setSize(radius) .setSize(radius)
.setFill(fill); .setFill(fill);
@ -433,7 +425,7 @@ public class BrushCommands {
desc = "Use a height map to paint a surface", desc = "Use a height map to paint a surface",
descFooter = "Use a height map to paint any surface.\n") descFooter = "Use a height map to paint any surface.\n")
@CommandPermissions("worldedit.brush.stencil") @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, ProvideBindings.ImageUri imageUri,
@Arg(def = "1", desc = "scale height") @Range(min = Double.MIN_NORMAL) double yscale, @Arg(def = "1", desc = "scale height") @Range(min = Double.MIN_NORMAL) double yscale,
@Switch(name = 'a', desc = "Use image Alpha") boolean alpha, @Switch(name = 'a', desc = "Use image Alpha") boolean alpha,
@ -450,7 +442,7 @@ public class BrushCommands {
alpha = true; alpha = true;
} }
ImageBrush brush = new ImageBrush(image, session, alpha); ImageBrush brush = new ImageBrush(image, session, alpha);
return set(session, context, set(session, context,
brush) brush)
.setSize(radius); .setSize(radius);
} }
@ -464,12 +456,12 @@ public class BrushCommands {
"The -r flag will apply random rotation" "The -r flag will apply random rotation"
) )
@CommandPermissions("worldedit.brush.surface") @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") @Arg(name = "radius", desc = "Expression", def = "5")
Expression radius, Expression radius,
InjectedValueAccess context) throws WorldEditException { InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius); set(session, context, new SurfaceSphereBrush()).setFill(fill).setSize(radius);
} }
@Command( @Command(
@ -479,7 +471,7 @@ public class BrushCommands {
"Video: https://youtu.be/RPZIaTbqoZw?t=34s" "Video: https://youtu.be/RPZIaTbqoZw?t=34s"
) )
@CommandPermissions("worldedit.brush.scatter") @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); worldEdit.checkMaxBrushRadius(radius);
Brush brush; Brush brush;
if (overlay) { if (overlay) {
@ -487,7 +479,7 @@ public class BrushCommands {
} else { } else {
brush = new ScatterBrush((int) pointsOpt, (int) distanceOpt); brush = new ScatterBrush((int) pointsOpt, (int) distanceOpt);
} }
return set(session, context, set(session, context,
brush) brush)
.setSize(radius) .setSize(radius)
.setFill(fill); .setFill(fill);
@ -499,21 +491,21 @@ public class BrushCommands {
desc = "Scatter a schematic on a surface" desc = "Scatter a schematic on a surface"
) )
@CommandPermissions("worldedit.brush.populateschematic") @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); worldEdit.checkMaxBrushRadius(radius);
try { try {
MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true); MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true);
if (clipboards == null) { if (clipboards == null) {
BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr); BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr);
return null; return;
} }
List<ClipboardHolder> holders = clipboards.getHolders(); List<ClipboardHolder> holders = clipboards.getHolders();
if (holders == null) { if (holders == null) {
BBC.SCHEMATIC_NOT_FOUND.send(player, clipboardStr); 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); new PopulateSchem(mask, holders, (int) density, rotate)).setSize(radius);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
@ -528,9 +520,9 @@ public class BrushCommands {
"Pic: https://i.imgur.com/XV0vYoX.png" "Pic: https://i.imgur.com/XV0vYoX.png"
) )
@CommandPermissions("worldedit.brush.layer") @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); 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( @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." "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") @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); 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( @Command(
@ -558,9 +550,9 @@ public class BrushCommands {
" - Placeholders: {x}, {y}, {z}, {world}, {size}" " - Placeholders: {x}, {y}, {z}, {world}, {size}"
) )
@CommandPermissions("worldedit.brush.scattercommand") @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); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, set(session, context,
new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " "))) new ScatterCommand((int) points, (int) distance, StringMan.join(commandStr, " ")))
.setSize(radius); .setSize(radius);
} }
@ -571,7 +563,7 @@ public class BrushCommands {
desc = "Choose the cylinder brush" desc = "Choose the cylinder brush"
) )
@CommandPermissions("worldedit.brush.cylinder") @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") @Arg(desc = "The pattern of blocks to set")
Pattern pattern, Pattern pattern,
@Arg(desc = "The radius of the cylinder", def = "2") @Arg(desc = "The radius of the cylinder", def = "2")
@ -592,7 +584,6 @@ public class BrushCommands {
} }
settings.setSize(radius) settings.setSize(radius)
.setFill(pattern); .setFill(pattern);
return settings;
} }
@Command( @Command(
@ -605,7 +596,7 @@ public class BrushCommands {
) )
@Deprecated @Deprecated
@CommandPermissions("worldedit.brush.clipboard") @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") @Switch(name = 'a', desc = "Don't paste air from the clipboard")
boolean ignoreAir, boolean ignoreAir,
@Switch(name = 'o', desc = "Paste starting at the target location, instead of centering on it") @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.getBlockY() / 2D - 1);
worldEdit.checkMaxBrushRadius(size.getBlockZ() / 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( @Command(
@ -638,7 +629,7 @@ public class BrushCommands {
descFooter = "Example: '/brush smooth 2 4 grass_block,dirt,stone'" descFooter = "Example: '/brush smooth 2 4 grass_block,dirt,stone'"
) )
@CommandPermissions("worldedit.brush.smooth") @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") @Arg(desc = "The radius to sample for softening", def = "2")
Expression radius, Expression radius,
@Arg(desc = "The number of iterations to perform", def = "4") @Arg(desc = "The number of iterations to perform", def = "4")
@ -651,7 +642,7 @@ public class BrushCommands {
FaweLimit limit = Settings.IMP.getLimit(fp); FaweLimit limit = Settings.IMP.getLimit(fp);
iterations = Math.min(limit.MAX_ITERATIONS, iterations); iterations = Math.min(limit.MAX_ITERATIONS, iterations);
return set(session, context, set(session, context,
new SmoothBrush(iterations, maskOpt)) new SmoothBrush(iterations, maskOpt))
.setSize(radius); .setSize(radius);
} }
@ -662,14 +653,14 @@ public class BrushCommands {
desc = "Shortcut fire extinguisher brush" desc = "Shortcut fire extinguisher brush"
) )
@CommandPermissions("worldedit.brush.ex") @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") @Arg(desc = "The radius to extinguish", def = "5")
Expression radius, Expression radius,
InjectedValueAccess context) throws WorldEditException { InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
Pattern fill = BlockTypes.AIR.getDefaultState(); Pattern fill = BlockTypes.AIR.getDefaultState();
return set(session, context, set(session, context,
new SphereBrush()) new SphereBrush())
.setSize(radius) .setSize(radius)
.setFill(fill) .setFill(fill)
@ -682,7 +673,7 @@ public class BrushCommands {
desc = "Gravity brush, simulates the effect of gravity" desc = "Gravity brush, simulates the effect of gravity"
) )
@CommandPermissions("worldedit.brush.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") @Arg(desc = "The radius to apply gravity in", def = "5")
Expression radius, Expression radius,
@Switch(name = 'h', desc = "Affect blocks starting at max Y, rather than the target location Y + 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 { InjectedValueAccess context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(radius);
return set(session, context, set(session, context,
new GravityBrush(fromMaxY)) new GravityBrush(fromMaxY))
.setSize(radius); .setSize(radius);
} }
@ -707,8 +698,8 @@ public class BrushCommands {
"Snow Pic: https://i.imgur.com/Hrzn0I4.png" "Snow Pic: https://i.imgur.com/Hrzn0I4.png"
) )
@CommandPermissions("worldedit.brush.height") @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 { 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 {
return terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context); terrainBrush(player, session, radius, image, rotation, yscale, false, randomRotate, layers, !dontSmooth, ScalableHeightMap.Shape.CONE, context);
} }
@Command( @Command(
@ -718,7 +709,7 @@ public class BrushCommands {
descFooter = "This brush flattens terrain and creates cliffs." descFooter = "This brush flattens terrain and creates cliffs."
) )
@CommandPermissions("worldedit.brush.height") @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") @Arg(name = "radius", desc = "Expression", def = "5")
Expression radius, Expression radius,
@Arg(name = "image", desc = "String", def = "") @Arg(name = "image", desc = "String", def = "")
@ -733,7 +724,7 @@ public class BrushCommands {
boolean layers, boolean layers,
@Switch(name = 's', desc = "Disables smoothing") @Switch(name = 's', desc = "Disables smoothing")
boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException { 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( @Command(
@ -742,17 +733,17 @@ public class BrushCommands {
desc = "This brush raises or lowers land towards the clicked point" desc = "This brush raises or lowers land towards the clicked point"
) )
@CommandPermissions("worldedit.brush.height") @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") @Switch(name = 'r', desc = "Enables random off-axis rotation")
boolean randomRotate, boolean randomRotate,
@Switch(name = 'l', desc = "Will work on snow layers") @Switch(name = 'l', desc = "Will work on snow layers")
boolean layers, boolean layers,
@Switch(name = 's', desc = "Disables smoothing") @Switch(name = 's', desc = "Disables smoothing")
boolean dontSmooth, InjectedValueAccess context) throws WorldEditException, FileNotFoundException { 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); worldEdit.checkMaxBrushRadius(radius);
InputStream stream = getHeightmapStream(image); InputStream stream = getHeightmapStream(image);
HeightBrush brush; HeightBrush brush;
@ -772,7 +763,7 @@ public class BrushCommands {
if (randomRotate) { if (randomRotate) {
brush.setRandomRotate(true); brush.setRandomRotate(true);
} }
return set(session, context, set(session, context,
brush) brush)
.setSize(radius); .setSize(radius);
} }
@ -789,7 +780,7 @@ public class BrushCommands {
@Command( @Command(
name = "copypaste", name = "copypaste",
aliases = {"copy", "paste", "cp", "copypasta"}, aliases = {"cp", "copypasta"},
desc = "Copy Paste brush", desc = "Copy Paste brush",
descFooter = "Left click the base of an object to copy.\n" + descFooter = "Left click the base of an object to copy.\n" +
"Right click to paste\n" + "Right click to paste\n" +
@ -797,11 +788,11 @@ public class BrushCommands {
"Video: https://www.youtube.com/watch?v=RPZIaTbqoZw" "Video: https://www.youtube.com/watch?v=RPZIaTbqoZw"
) )
@CommandPermissions("worldedit.brush.copy") @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); worldEdit.checkMaxBrushRadius(radius);
player.print(BBC.BRUSH_COPY.format(radius)); player.print(BBC.BRUSH_COPY.format(radius));
return set(session, context, set(session, context,
new CopyPastaBrush(player, session, randomRotate, autoRotate)) new CopyPastaBrush(player, session, randomRotate, autoRotate))
.setSize(radius); .setSize(radius);
} }
@ -815,10 +806,10 @@ public class BrushCommands {
" - Placeholders: {x}, {y}, {z}, {world}, {size}" " - Placeholders: {x}, {y}, {z}, {world}, {size}"
) )
@CommandPermissions("worldedit.brush.command") @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); worldEdit.checkMaxBrushRadius(radius);
String cmd = StringMan.join(input, " "); String cmd = StringMan.join(input, " ");
return set(session, context, set(session, context,
new CommandBrush(cmd)) new CommandBrush(cmd))
.setSize(radius); .setSize(radius);
} }
@ -829,7 +820,7 @@ public class BrushCommands {
desc = "Butcher brush, kills mobs within a radius" desc = "Butcher brush, kills mobs within a radius"
) )
@CommandPermissions("worldedit.brush.butcher") @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") @Arg(desc = "Radius to kill mobs in", def = "5")
Expression radius, Expression radius,
@Switch(name = 'p', desc = "Also kill pets") @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.TAGGED , killWithName, "worldedit.butcher.tagged");
flags.or(CreatureButcher.Flags.ARMOR_STAND , killArmorStands, "worldedit.butcher.armorstands"); flags.or(CreatureButcher.Flags.ARMOR_STAND , killArmorStands, "worldedit.butcher.armorstands");
return set(session, context, set(session, context, new ButcherBrush(flags)).setSize(radius);
new ButcherBrush(flags))
.setSize(radius);
} }
public BrushSettings process(CommandLocals locals, BrushSettings settings) throws WorldEditException { public BrushSettings process(CommandLocals locals, BrushSettings settings) throws WorldEditException {

Datei anzeigen

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

Datei anzeigen

@ -21,6 +21,7 @@ package com.sk89q.worldedit.command.argument;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.command.util.SuggestionHelper; import com.sk89q.worldedit.command.util.SuggestionHelper;
import com.sk89q.worldedit.registry.IRegistry;
import com.sk89q.worldedit.registry.Keyed; import com.sk89q.worldedit.registry.Keyed;
import com.sk89q.worldedit.registry.Registry; import com.sk89q.worldedit.registry.Registry;
import com.sk89q.worldedit.util.formatting.text.Component; 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.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.entity.EntityType;
import com.sk89q.worldedit.world.fluid.FluidCategory; import com.sk89q.worldedit.world.fluid.FluidCategory;
import com.sk89q.worldedit.world.fluid.FluidType; import com.sk89q.worldedit.world.fluid.FluidType;
@ -52,7 +54,7 @@ public final class RegistryConverter<V extends Keyed> implements ArgumentConvert
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void register(CommandManager commandManager) { public static void register(CommandManager commandManager) {
ImmutableList.of( ImmutableList.of(
BlockType.class, BlockTypes.class,
BlockCategory.class, BlockCategory.class,
ItemType.class, ItemType.class,
ItemCategory.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) { private static <V extends Keyed> RegistryConverter<V> from(Class<Keyed> registryType) {
try { try {
Field registryField = registryType.getDeclaredField("REGISTRY"); 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); return new RegistryConverter<>(registry);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
throw new IllegalArgumentException("Not a registry-backed type: " + registryType.getName()); 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 final TextComponent choices;
private RegistryConverter(Registry<V> registry) { private RegistryConverter(IRegistry<V> registry) {
this.registry = registry; this.registry = registry;
this.choices = TextComponent.of("any " + registry.getName()); this.choices = TextComponent.of("any " + registry.getName());
} }

Datei anzeigen

@ -61,7 +61,7 @@ public class DelegateCommandManager implements CommandManager {
} }
@Override @Override
public Object execute(InjectedValueAccess context, List<String> args) { public int execute(InjectedValueAccess context, List<String> args) {
return parent.execute(context, args); return parent.execute(context, args);
} }

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.util; package com.sk89q.worldedit.command.util;
import com.sk89q.worldedit.registry.IRegistry;
import com.sk89q.worldedit.registry.Keyed; import com.sk89q.worldedit.registry.Keyed;
import com.sk89q.worldedit.registry.NamespacedRegistry; import com.sk89q.worldedit.registry.NamespacedRegistry;
import com.sk89q.worldedit.registry.Registry; import com.sk89q.worldedit.registry.Registry;
@ -138,7 +139,7 @@ public final class SuggestionHelper {
return Stream.empty(); 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) { if (registry instanceof NamespacedRegistry) {
return getNamespacedRegistrySuggestions(((NamespacedRegistry<?>) registry), input); return getNamespacedRegistrySuggestions(((NamespacedRegistry<?>) registry), input);
} }

Datei anzeigen

@ -10,7 +10,7 @@ import com.boydti.fawe.util.StringMan;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.minecraft.util.commands.CommandLocals;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.TransformCommands; //import com.sk89q.worldedit.command.TransformCommands;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.NoMatchException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;

Datei anzeigen

@ -28,7 +28,7 @@ import com.google.common.collect.Iterables;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandLocals; import com.sk89q.minecraft.util.commands.CommandLocals;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.command.PatternCommands; //import com.sk89q.worldedit.command.PatternCommands;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.NoMatchException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;

Datei anzeigen

@ -88,6 +88,7 @@ import com.sk89q.worldedit.command.ToolUtilCommands;
import com.sk89q.worldedit.command.ToolUtilCommandsRegistration; import com.sk89q.worldedit.command.ToolUtilCommandsRegistration;
import com.sk89q.worldedit.command.TransformCommands; import com.sk89q.worldedit.command.TransformCommands;
import com.sk89q.worldedit.command.TransformCommandsRegistration; import com.sk89q.worldedit.command.TransformCommandsRegistration;
import com.sk89q.worldedit.command.TransformCommandsRegistration;
import com.sk89q.worldedit.command.UtilityCommands; import com.sk89q.worldedit.command.UtilityCommands;
import com.sk89q.worldedit.command.UtilityCommandsRegistration; import com.sk89q.worldedit.command.UtilityCommandsRegistration;
import com.sk89q.worldedit.command.WorldEditCommands; import com.sk89q.worldedit.command.WorldEditCommands;

Datei anzeigen

@ -72,7 +72,9 @@ public class PlatformManager {
private static final Logger logger = LoggerFactory.getLogger(PlatformManager.class); private static final Logger logger = LoggerFactory.getLogger(PlatformManager.class);
private final WorldEdit worldEdit; private final WorldEdit worldEdit;
private final PlatformCommandManager platformCommandManager;
private PlatformCommandManager platformCommandManager;
private final List<Platform> platforms = new ArrayList<>(); private final List<Platform> platforms = new ArrayList<>();
private final Map<Capability, Platform> preferences = new EnumMap<>(Capability.class); private final Map<Capability, Platform> preferences = new EnumMap<>(Capability.class);
private @Nullable String firstSeenVersion; private @Nullable String firstSeenVersion;
@ -87,7 +89,6 @@ public class PlatformManager {
public PlatformManager(WorldEdit worldEdit) { public PlatformManager(WorldEdit worldEdit) {
checkNotNull(worldEdit); checkNotNull(worldEdit);
this.worldEdit = worldEdit; this.worldEdit = worldEdit;
this.platformCommandManager = new PlatformCommandManager(worldEdit, this);
// Register this instance for events // Register this instance for events
worldEdit.getEventBus().register(this); worldEdit.getEventBus().register(this);
@ -117,6 +118,10 @@ public class PlatformManager {
} else { } else {
firstSeenVersion = platform.getVersion(); firstSeenVersion = platform.getVersion();
} }
if (this.platformCommandManager == null) {
this.platformCommandManager = new PlatformCommandManager(worldEdit, this);
}
} }
/** /**

Datei anzeigen

@ -19,14 +19,12 @@
package com.sk89q.worldedit.internal.command; 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.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.sk89q.worldedit.extension.platform.PlatformCommandManager; import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
import com.sk89q.worldedit.internal.util.Substring; import com.sk89q.worldedit.internal.util.Substring;
import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TextComponent;
import static java.util.stream.Collectors.toList;
import org.enginehub.piston.Command; import org.enginehub.piston.Command;
import org.enginehub.piston.exception.CommandException; import org.enginehub.piston.exception.CommandException;
import org.enginehub.piston.inject.InjectedValueAccess; import org.enginehub.piston.inject.InjectedValueAccess;
@ -40,6 +38,9 @@ import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkState;
import static java.util.stream.Collectors.toList;
public class CommandUtil { public class CommandUtil {
public static Map<String, Command> getSubCommands(Command currentCommand) { 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}. * Fix {@code suggestions} to replace the last space-separated word in {@code arguments}.
*/ */
public static List<String> fixSuggestions(String arguments, List<Substring> suggestions) { 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() 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) .filter(Optional::isPresent)
.map(Optional::get) .map(Optional::get)
.collect(toList()); .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 * Given the last word of a command, mutate the suggestion to replace the last word, if
* possible. * possible.
*/ */
private static Optional<String> suggestLast(Substring last, Substring suggestion) { 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. // this suggestion is for the next argument.
if (last.getSubstring().isEmpty()) { if (last.getSubstring().isEmpty()) {
return Optional.of(suggestion.getSubstring()); return Optional.of(suggestion.getSubstring());

Datei anzeigen

@ -32,6 +32,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; 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.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
@ -114,11 +115,12 @@ public class ServerCUIHandler {
} }
// Borrowed this math from FAWE // Borrowed this math from FAWE
double rotX = player.getLocation().getYaw(); final Location location = player.getLocation();
double rotY = player.getLocation().getPitch(); double rotX = location.getYaw();
double rotY = location.getPitch();
double xz = Math.cos(Math.toRadians(rotY)); double xz = Math.cos(Math.toRadians(rotY));
int x = (int) (player.getLocation().getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12); int x = (int) (location.getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12);
int z = (int) (player.getLocation().getZ() - (xz * Math.cos(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)); int y = Math.max(0, Math.min(Math.min(255, posY + 32), posY + 3));
Map<String, Tag> structureTag = new HashMap<>(); Map<String, Tag> structureTag = new HashMap<>();

Datei anzeigen

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

Datei anzeigen

@ -19,30 +19,39 @@
package com.sk89q.worldedit.registry; package com.sk89q.worldedit.registry;
import com.google.common.collect.Maps;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
public class Registry<V extends Keyed> implements Iterable<V> { public class Registry<V extends Keyed> implements IRegistry<V> {
private final Map<String, V> map = new HashMap<>(); private final Map<String, V> map;
private final String name; private final String name;
public Registry(final String name) { public Registry(String name, Map<String, V> map) {
this.name = name; this.name = name;
this.map = map;
}
public Registry(final String name) {
this(name, Maps.newHashMap());
} }
public String getName() { public String getName() {
return name; return name;
} }
public Map<String, V> getMap() {
return map;
}
@Nullable @Nullable
public V get(final String key) { public V get(final String key) {
checkState(key.equals(key.toLowerCase(Locale.ROOT)), "key must be lowercase"); 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()); return Collections.unmodifiableCollection(this.map.values());
} }
@Override
public Iterator<V> iterator() {
return this.map.values().iterator();
}
} }

Datei anzeigen

@ -71,7 +71,7 @@ public class SessionManager {
private static final Logger log = LoggerFactory.getLogger(SessionManager.class); private static final Logger log = LoggerFactory.getLogger(SessionManager.class);
private static boolean warnedInvalidTool; 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 WorldEdit worldEdit;
private final Map<UUID, SessionHolder> sessions = new HashMap<>(); private final Map<UUID, SessionHolder> sessions = new HashMap<>();
private SessionStore store = new VoidStore(); private SessionStore store = new VoidStore();

Datei anzeigen

@ -19,8 +19,10 @@
package com.sk89q.worldedit.util.concurrency; 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.ExecutorService;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -43,11 +45,29 @@ public final class EvenMoreExecutors {
* @return the newly created thread pool * @return the newly created thread pool
*/ */
public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize) { 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( ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
minThreads, maxThreads, minThreads, maxThreads,
60L, TimeUnit.SECONDS, 60L, TimeUnit.SECONDS,
new ArrayBlockingQueue<>(queueSize)); new LinkedBlockingDeque<>(queueSize));
threadPoolExecutor.allowCoreThreadTimeOut(true); threadPoolExecutor.allowCoreThreadTimeOut(true);
if (threadFormat != null) {
threadPoolExecutor.setThreadFactory(new ThreadFactoryBuilder().setNameFormat(threadFormat).build());
}
return threadPoolExecutor; return threadPoolExecutor;
} }

Datei anzeigen

@ -19,8 +19,9 @@
package com.sk89q.worldedit.util.paste; 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 com.sk89q.worldedit.util.net.HttpRequest;
import org.json.simple.JSONValue;
import java.io.IOException; import java.io.IOException;
import java.net.URL; 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 Pattern URL_PATTERN = Pattern.compile("https?://.+$");
private static final Gson GSON = new Gson();
@Override @Override
public Callable<URL> paste(String content) { public Callable<URL> paste(String content) {
return new PasteTask(content); return new PasteTask(content);
@ -59,10 +62,10 @@ public class EngineHubPaste implements Paster {
.returnContent() .returnContent()
.asString("UTF-8").trim(); .asString("UTF-8").trim();
Object object = JSONValue.parse(result); Map<Object, Object> object = GSON.fromJson(result, new TypeToken<Map<Object, Object>>() {
if (object instanceof Map) { }.getType());
@SuppressWarnings("unchecked") if (object != null) {
String urlString = String.valueOf(((Map<Object, Object>) object).get("url")); String urlString = String.valueOf(object.get("url"));
Matcher m = URL_PATTERN.matcher(urlString); Matcher m = URL_PATTERN.matcher(urlString);
if (m.matches()) { if (m.matches()) {

Datei anzeigen

@ -134,6 +134,11 @@ public class NullWorld extends AbstractWorld {
return BlockVector3.ZERO; return BlockVector3.ZERO;
} }
@Override
public void sendChunk(int X, int Z, int mask) {
}
@Override @Override
public IChunkGet get(int x, int z) { public IChunkGet get(int x, int z) {
return NullChunkGet.INSTANCE; return NullChunkGet.INSTANCE;

Datei anzeigen

@ -72,7 +72,6 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
* *
* @return the maximum Y * @return the maximum Y
*/ */
@Override
int getMaxY(); int getMaxY();
/** /**

Datei anzeigen

@ -29,6 +29,7 @@ import com.sk89q.worldedit.function.mask.SingleBlockTypeMask;
import com.sk89q.worldedit.function.pattern.FawePattern; import com.sk89q.worldedit.function.pattern.FawePattern;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.registry.Keyed; 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.AbstractProperty;
import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.registry.state.PropertyKey; 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.item.ItemTypes;
import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.registry.LegacyMapper;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -45,6 +47,9 @@ import java.util.stream.IntStream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class BlockType implements FawePattern, Keyed { public class BlockType implements FawePattern, Keyed {
public static final NamespacedRegistry<BlockType> REGISTRY = new NamespacedRegistry<>("block type");
private final String id; private final String id;
private final BlockTypes.Settings settings; private final BlockTypes.Settings settings;

Datei anzeigen

@ -26,11 +26,17 @@ import com.boydti.fawe.util.StringMan;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.platform.Capability; 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.AbstractProperty;
import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.registry.state.PropertyKey; import com.sk89q.worldedit.registry.state.PropertyKey;
import com.sk89q.worldedit.world.registry.BlockMaterial; 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.LegacyMapper;
import com.sk89q.worldedit.world.registry.Registries;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -871,18 +877,22 @@ public final class BlockTypes {
public static final int BIT_OFFSET; // Used internally public static final int BIT_OFFSET; // Used internally
protected static final int BIT_MASK; // 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 BlockType[] values;
public static final BlockState[] states; public static final BlockState[] states;
private static final Set<String> $NAMESPACES = new LinkedHashSet<String>(); private static final Set<String> $NAMESPACES = new LinkedHashSet<>();
static { static {
try { try {
ArrayList<BlockState> stateList = new ArrayList<>(); 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)); 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(); int size = blockMap.size();
@ -928,7 +938,7 @@ public final class BlockTypes {
// Add to $Registry // Add to $Registry
for (BlockType type : values) { 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()]); states = stateList.toArray(new BlockState[stateList.size()]);
@ -954,15 +964,13 @@ public final class BlockTypes {
try { try {
Field field = BlockTypes.class.getDeclaredField(enumName); Field field = BlockTypes.class.getDeclaredField(enumName);
ReflectionUtils.setFailsafeFieldValue(field, null, existing); ReflectionUtils.setFailsafeFieldValue(field, null, existing);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace(); e.printStackTrace();
} }
// register states // register states
if (typeName.startsWith("minecraft:")) $REGISTRY.put(typeName.substring(10), existing); if (typeName.startsWith("minecraft:")) BlockType.REGISTRY.register(typeName.substring(10), existing);
$REGISTRY.put(typeName, existing); BlockType.REGISTRY.register(typeName, existing);
String nameSpace = typeName.substring(0, typeName.indexOf(':')); String nameSpace = typeName.substring(0, typeName.indexOf(':'));
$NAMESPACES.add(nameSpace); $NAMESPACES.add(nameSpace);
return existing; return existing;
@ -980,7 +988,7 @@ public final class BlockTypes {
String input = inputLower; String input = inputLower;
if (!input.split("\\[", 2)[0].contains(":")) input = "minecraft:" + input; 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; if (result != null) return result;
try { try {
@ -1002,11 +1010,11 @@ public final class BlockTypes {
} }
public static @Nullable BlockType get(final String id) { 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) { public static @Nullable BlockType get(final CharSequence id) {
return $REGISTRY.get(id); return BlockType.REGISTRY.getMap().get(id);
} }
@Deprecated @Deprecated

Datei anzeigen

@ -22,6 +22,8 @@ package com.sk89q.worldedit.world.registry;
import com.google.common.io.Resources; import com.google.common.io.Resources;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonPrimitive;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.extension.platform.Capability;
@ -76,6 +78,15 @@ public final class BundledBlockData {
private void loadFromResource() throws IOException { private void loadFromResource() throws IOException {
GsonBuilder gsonBuilder = new GsonBuilder(); GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter()); 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(); Gson gson = gsonBuilder.create();
URL url = null; URL url = null;
final int dataVersion = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataVersion(); final int dataVersion = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataVersion();

Datei anzeigen

@ -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 * @param newestFirst true to get the newest first
* @return a list of snapshots * @return a list of snapshots
*/ */
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName) public List<Snapshot> getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException {
throws MissingWorldException {
FilenameFilter filter = (dir, name) -> { FilenameFilter filter = (dir, name) -> {
File f = new File(dir, name); File f = new File(dir, name);
return isValidSnapshot(f); return isValidSnapshot(f);
@ -116,8 +116,7 @@ public class SnapshotRepository {
* @return a snapshot or null * @return a snapshot or null
*/ */
@Nullable @Nullable
public Snapshot getSnapshotAfter(ZonedDateTime date, String world) public Snapshot getSnapshotAfter(ZonedDateTime date, String world) throws MissingWorldException {
throws MissingWorldException {
List<Snapshot> snapshots = getSnapshots(true, world); List<Snapshot> snapshots = getSnapshots(true, world);
Snapshot last = null; Snapshot last = null;
@ -139,8 +138,7 @@ public class SnapshotRepository {
* @return a snapshot or null * @return a snapshot or null
*/ */
@Nullable @Nullable
public Snapshot getSnapshotBefore(ZonedDateTime date, String world) public Snapshot getSnapshotBefore(ZonedDateTime date, String world) throws MissingWorldException {
throws MissingWorldException {
List<Snapshot> snapshots = getSnapshots(false, world); List<Snapshot> snapshots = getSnapshots(false, world);
Snapshot last = null; Snapshot last = null;
@ -206,8 +204,7 @@ public class SnapshotRepository {
* @return whether it is a valid snapshot * @return whether it is a valid snapshot
*/ */
protected boolean isValidSnapshot(File file) { protected boolean isValidSnapshot(File file) {
if (!file.getName() if (!file.getName().matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
return false; return false;
} }

Datei anzeigen

@ -283,7 +283,7 @@
"hardness": 2.0, "hardness": 2.0,
"resistance": 3.0, "resistance": 3.0,
"ticksRandomly": false, "ticksRandomly": false,
"fullCube": true, "fullCube": false,
"slipperiness": 0.6, "slipperiness": 0.6,
"liquid": false, "liquid": false,
"solid": true, "solid": true,
@ -758,7 +758,7 @@
"hardness": 3.0, "hardness": 3.0,
"resistance": 3.0, "resistance": 3.0,
"ticksRandomly": false, "ticksRandomly": false,
"fullCube": true, "fullCube": false,
"slipperiness": 0.6, "slipperiness": 0.6,
"liquid": false, "liquid": false,
"solid": true, "solid": true,
@ -771,7 +771,7 @@
"unpushable": false, "unpushable": false,
"mapColor": "#000000", "mapColor": "#000000",
"isTranslucent": false, "isTranslucent": false,
"hasContainer": false "hasContainer": true
} }
}, },
{ {
@ -1133,7 +1133,7 @@
"hardness": 2.0, "hardness": 2.0,
"resistance": 3.0, "resistance": 3.0,
"ticksRandomly": false, "ticksRandomly": false,
"fullCube": true, "fullCube": false,
"slipperiness": 0.6, "slipperiness": 0.6,
"liquid": false, "liquid": false,
"solid": true, "solid": true,
@ -1246,7 +1246,7 @@
"unpushable": false, "unpushable": false,
"mapColor": "#8f7748", "mapColor": "#8f7748",
"isTranslucent": false, "isTranslucent": false,
"hasContainer": false "hasContainer": true
} }
}, },
{ {
@ -1383,7 +1383,7 @@
"hardness": 2.0, "hardness": 2.0,
"resistance": 2.0, "resistance": 2.0,
"ticksRandomly": false, "ticksRandomly": false,
"fullCube": true, "fullCube": false,
"slipperiness": 0.6, "slipperiness": 0.6,
"liquid": false, "liquid": false,
"solid": true, "solid": true,
@ -1391,10 +1391,10 @@
"burnable": false, "burnable": false,
"opaque": true, "opaque": true,
"replacedDuringPlacement": false, "replacedDuringPlacement": false,
"toolRequired": false, "toolRequired": true,
"fragileWhenPushed": false, "fragileWhenPushed": false,
"unpushable": false, "unpushable": false,
"mapColor": "#7f3fb2", "mapColor": "#707070",
"isTranslucent": true, "isTranslucent": true,
"hasContainer": true "hasContainer": true
} }
@ -1408,7 +1408,7 @@
"hardness": 0.3, "hardness": 0.3,
"resistance": 0.3, "resistance": 0.3,
"ticksRandomly": false, "ticksRandomly": false,
"fullCube": true, "fullCube": false,
"slipperiness": 0.6, "slipperiness": 0.6,
"liquid": false, "liquid": false,
"solid": true, "solid": true,

Datei anzeigen

@ -316,16 +316,11 @@
"47:0": "minecraft:bookshelf", "47:0": "minecraft:bookshelf",
"48:0": "minecraft:mossy_cobblestone", "48:0": "minecraft:mossy_cobblestone",
"49:0": "minecraft:obsidian", "49:0": "minecraft:obsidian",
"50:0": "minecraft:torch",
"50:1": "minecraft:wall_torch[facing=east]", "50:1": "minecraft:wall_torch[facing=east]",
"50:2": "minecraft:wall_torch[facing=west]", "50:2": "minecraft:wall_torch[facing=west]",
"50:3": "minecraft:wall_torch[facing=south]", "50:3": "minecraft:wall_torch[facing=south]",
"50:4": "minecraft:wall_torch[facing=north]", "50:4": "minecraft:wall_torch[facing=north]",
"50:9": "minecraft:wall_torch[facing=east]", "50:5": "minecraft:torch",
"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",
"51:0": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=0]", "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: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]", "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:5": "minecraft:oak_stairs[half=top,shape=outer_right,facing=west]",
"53:6": "minecraft:oak_stairs[half=top,shape=outer_right,facing=south]", "53:6": "minecraft:oak_stairs[half=top,shape=outer_right,facing=south]",
"53:7": "minecraft:oak_stairs[half=top,shape=outer_right,facing=north]", "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:2": "minecraft:chest[facing=north,type=single]",
"54:3": "minecraft:chest[facing=south,type=single]", "54:3": "minecraft:chest[facing=south,type=single]",
"54:4": "minecraft:chest[facing=west,type=single]", "54:4": "minecraft:chest[facing=west,type=single]",
"54:5": "minecraft:chest[facing=east,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: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: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]", "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:5": "minecraft:farmland[moisture=5]",
"60:6": "minecraft:farmland[moisture=6]", "60:6": "minecraft:farmland[moisture=6]",
"60:7": "minecraft:farmland[moisture=7]", "60:7": "minecraft:farmland[moisture=7]",
"61:0": "minecraft:furnace",
"61:2": "minecraft:furnace[facing=north,lit=false]", "61:2": "minecraft:furnace[facing=north,lit=false]",
"61:3": "minecraft:furnace[facing=south,lit=false]", "61:3": "minecraft:furnace[facing=south,lit=false]",
"61:4": "minecraft:furnace[facing=west,lit=false]", "61:4": "minecraft:furnace[facing=west,lit=false]",
"61:5": "minecraft:furnace[facing=east,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:2": "minecraft:furnace[facing=north,lit=true]",
"62:3": "minecraft:furnace[facing=south,lit=true]", "62:3": "minecraft:furnace[facing=south,lit=true]",
"62:4": "minecraft:furnace[facing=west,lit=true]", "62:4": "minecraft:furnace[facing=west,lit=true]",
"62:5": "minecraft:furnace[facing=east,lit=true]", "62:5": "minecraft:furnace[facing=east,lit=true]",
"62:10": "minecraft:furnace[facing=north,lit=true]", "63:0": "minecraft:sign[rotation=0]",
"62:11": "minecraft:furnace[facing=south,lit=true]", "63:1": "minecraft:sign[rotation=1]",
"62:12": "minecraft:furnace[facing=west,lit=true]", "63:2": "minecraft:sign[rotation=2]",
"62:13": "minecraft:furnace[facing=east,lit=true]", "63:3": "minecraft:sign[rotation=3]",
"63:0": "minecraft:oak_sign[rotation=0]", "63:4": "minecraft:sign[rotation=4]",
"63:1": "minecraft:oak_sign[rotation=1]", "63:5": "minecraft:sign[rotation=5]",
"63:2": "minecraft:oak_sign[rotation=2]", "63:6": "minecraft:sign[rotation=6]",
"63:3": "minecraft:oak_sign[rotation=3]", "63:7": "minecraft:sign[rotation=7]",
"63:4": "minecraft:oak_sign[rotation=4]", "63:8": "minecraft:sign[rotation=8]",
"63:5": "minecraft:oak_sign[rotation=5]", "63:9": "minecraft:sign[rotation=9]",
"63:6": "minecraft:oak_sign[rotation=6]", "63:10": "minecraft:sign[rotation=10]",
"63:7": "minecraft:oak_sign[rotation=7]", "63:11": "minecraft:sign[rotation=11]",
"63:8": "minecraft:oak_sign[rotation=8]", "63:12": "minecraft:sign[rotation=12]",
"63:9": "minecraft:oak_sign[rotation=9]", "63:13": "minecraft:sign[rotation=13]",
"63:10": "minecraft:oak_sign[rotation=10]", "63:14": "minecraft:sign[rotation=14]",
"63:11": "minecraft:oak_sign[rotation=11]", "63:15": "minecraft:sign[rotation=15]",
"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]",
"64:0": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=east,open=false]", "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: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]", "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: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: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]", "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:2": "minecraft:ladder[facing=north]",
"65:3": "minecraft:ladder[facing=south]", "65:3": "minecraft:ladder[facing=south]",
"65:4": "minecraft:ladder[facing=west]", "65:4": "minecraft:ladder[facing=west]",
"65:5": "minecraft:ladder[facing=east]", "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:0": "minecraft:rail[shape=north_south]",
"66:1": "minecraft:rail[shape=east_west]", "66:1": "minecraft:rail[shape=east_west]",
"66:2": "minecraft:rail[shape=ascending_east]", "66:2": "minecraft:rail[shape=ascending_east]",
@ -468,15 +443,10 @@
"67:5": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=west]", "67:5": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=west]",
"67:6": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=south]", "67:6": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=south]",
"67:7": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=north]", "67:7": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=north]",
"68:0": "minecraft:oak_wall_sign", "68:2": "minecraft:wall_sign[facing=north]",
"68:2": "minecraft:oak_wall_sign[facing=north]", "68:3": "minecraft:wall_sign[facing=south]",
"68:3": "minecraft:oak_wall_sign[facing=south]", "68:4": "minecraft:wall_sign[facing=west]",
"68:4": "minecraft:oak_wall_sign[facing=west]", "68:5": "minecraft:wall_sign[facing=east]",
"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]",
"69:0": "minecraft:lever[powered=false,facing=north,face=ceiling]", "69:0": "minecraft:lever[powered=false,facing=north,face=ceiling]",
"69:1": "minecraft:lever[powered=false,facing=east,face=wall]", "69:1": "minecraft:lever[powered=false,facing=east,face=wall]",
"69:2": "minecraft:lever[powered=false,facing=west,face=wall]", "69:2": "minecraft:lever[powered=false,facing=west,face=wall]",
@ -511,28 +481,16 @@
"72:1": "minecraft:oak_pressure_plate[powered=true]", "72:1": "minecraft:oak_pressure_plate[powered=true]",
"73:0": "minecraft:redstone_ore[lit=false]", "73:0": "minecraft:redstone_ore[lit=false]",
"74:0": "minecraft:redstone_ore[lit=true]", "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:1": "minecraft:redstone_wall_torch[facing=east,lit=false]",
"75:2": "minecraft:redstone_wall_torch[facing=west,lit=false]", "75:2": "minecraft:redstone_wall_torch[facing=west,lit=false]",
"75:3": "minecraft:redstone_wall_torch[facing=south,lit=false]", "75:3": "minecraft:redstone_wall_torch[facing=south,lit=false]",
"75:4": "minecraft:redstone_wall_torch[facing=north,lit=false]", "75:4": "minecraft:redstone_wall_torch[facing=north,lit=false]",
"75:5": "minecraft:redstone_torch[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:1": "minecraft:redstone_wall_torch[facing=east,lit=true]",
"76:2": "minecraft:redstone_wall_torch[facing=west,lit=true]", "76:2": "minecraft:redstone_wall_torch[facing=west,lit=true]",
"76:3": "minecraft:redstone_wall_torch[facing=south,lit=true]", "76:3": "minecraft:redstone_wall_torch[facing=south,lit=true]",
"76:4": "minecraft:redstone_wall_torch[facing=north,lit=true]", "76:4": "minecraft:redstone_wall_torch[facing=north,lit=true]",
"76:5": "minecraft:redstone_wall_torch[lit=true]", "76:5": "minecraft:redstone_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]",
"77:0": "minecraft:stone_button[powered=false,facing=east,face=ceiling]", "77:0": "minecraft:stone_button[powered=false,facing=east,face=ceiling]",
"77:1": "minecraft:stone_button[powered=false,facing=east,face=wall]", "77:1": "minecraft:stone_button[powered=false,facing=east,face=wall]",
"77:2": "minecraft:stone_button[powered=false,facing=west,face=wall]", "77:2": "minecraft:stone_button[powered=false,facing=west,face=wall]",
@ -598,15 +556,8 @@
"87:0": "minecraft:netherrack", "87:0": "minecraft:netherrack",
"88:0": "minecraft:soul_sand", "88:0": "minecraft:soul_sand",
"89:0": "minecraft:glowstone", "89:0": "minecraft:glowstone",
"90:0": "minecraft:nether_portal",
"90:1": "minecraft:nether_portal[axis=x]", "90:1": "minecraft:nether_portal[axis=x]",
"90:2": "minecraft:nether_portal[axis=z]", "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:0": "minecraft:jack_o_lantern[facing=south]",
"91:1": "minecraft:jack_o_lantern[facing=west]", "91:1": "minecraft:jack_o_lantern[facing=west]",
"91:2": "minecraft:jack_o_lantern[facing=north]", "91:2": "minecraft:jack_o_lantern[facing=north]",
@ -866,15 +817,10 @@
"128:6": "minecraft:sandstone_stairs[half=top,shape=straight,facing=south]", "128:6": "minecraft:sandstone_stairs[half=top,shape=straight,facing=south]",
"128:7": "minecraft:sandstone_stairs[half=top,shape=straight,facing=north]", "128:7": "minecraft:sandstone_stairs[half=top,shape=straight,facing=north]",
"129:0": "minecraft:emerald_ore", "129:0": "minecraft:emerald_ore",
"130:0": "minecraft:ender_chest",
"130:2": "minecraft:ender_chest[facing=north]", "130:2": "minecraft:ender_chest[facing=north]",
"130:3": "minecraft:ender_chest[facing=south]", "130:3": "minecraft:ender_chest[facing=south]",
"130:4": "minecraft:ender_chest[facing=west]", "130:4": "minecraft:ender_chest[facing=west]",
"130:5": "minecraft:ender_chest[facing=east]", "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:0": "minecraft:tripwire_hook[powered=false,attached=false,facing=south]",
"131:1": "minecraft:tripwire_hook[powered=false,attached=false,facing=west]", "131:1": "minecraft:tripwire_hook[powered=false,attached=false,facing=west]",
"131:2": "minecraft:tripwire_hook[powered=false,attached=false,facing=north]", "131:2": "minecraft:tripwire_hook[powered=false,attached=false,facing=north]",
@ -1007,15 +953,10 @@
"145:9": "minecraft:damaged_anvil[facing=west]", "145:9": "minecraft:damaged_anvil[facing=west]",
"145:10": "minecraft:damaged_anvil[facing=north]", "145:10": "minecraft:damaged_anvil[facing=north]",
"145:11": "minecraft:damaged_anvil[facing=east]", "145:11": "minecraft:damaged_anvil[facing=east]",
"146:0": "minecraft:trapped_chest",
"146:2": "minecraft:trapped_chest[facing=north,type=single]", "146:2": "minecraft:trapped_chest[facing=north,type=single]",
"146:3": "minecraft:trapped_chest[facing=south,type=single]", "146:3": "minecraft:trapped_chest[facing=south,type=single]",
"146:4": "minecraft:trapped_chest[facing=west,type=single]", "146:4": "minecraft:trapped_chest[facing=west,type=single]",
"146:5": "minecraft:trapped_chest[facing=east,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:0": "minecraft:light_weighted_pressure_plate[power=0]",
"147:1": "minecraft:light_weighted_pressure_plate[power=1]", "147:1": "minecraft:light_weighted_pressure_plate[power=1]",
"147:2": "minecraft:light_weighted_pressure_plate[power=2]", "147:2": "minecraft:light_weighted_pressure_plate[power=2]",
@ -1283,15 +1224,10 @@
"176:13": "minecraft:white_banner[rotation=13]", "176:13": "minecraft:white_banner[rotation=13]",
"176:14": "minecraft:white_banner[rotation=14]", "176:14": "minecraft:white_banner[rotation=14]",
"176:15": "minecraft:white_banner[rotation=15]", "176:15": "minecraft:white_banner[rotation=15]",
"177:0": "minecraft:white_wall_banner",
"177:2": "minecraft:white_wall_banner[facing=north]", "177:2": "minecraft:white_wall_banner[facing=north]",
"177:3": "minecraft:white_wall_banner[facing=south]", "177:3": "minecraft:white_wall_banner[facing=south]",
"177:4": "minecraft:white_wall_banner[facing=west]", "177:4": "minecraft:white_wall_banner[facing=west]",
"177:5": "minecraft:white_wall_banner[facing=east]", "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:0": "minecraft:daylight_detector[inverted=true,power=0]",
"178:1": "minecraft:daylight_detector[inverted=true,power=1]", "178:1": "minecraft:daylight_detector[inverted=true,power=1]",
"178:2": "minecraft:daylight_detector[inverted=true,power=2]", "178:2": "minecraft:daylight_detector[inverted=true,power=2]",
@ -2196,7 +2132,7 @@
"321:0": "minecraft:painting", "321:0": "minecraft:painting",
"322:0": "minecraft:golden_apple", "322:0": "minecraft:golden_apple",
"322:1": "minecraft:enchanted_golden_apple", "322:1": "minecraft:enchanted_golden_apple",
"323:0": "minecraft:oak_sign", "323:0": "minecraft:sign",
"324:0": "minecraft:oak_door", "324:0": "minecraft:oak_door",
"325:0": "minecraft:bucket", "325:0": "minecraft:bucket",
"326:0": "minecraft:water_bucket", "326:0": "minecraft:water_bucket",

Datei anzeigen

@ -19,19 +19,20 @@
package com.sk89q.minecraft.util.commands; package com.sk89q.minecraft.util.commands;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.Assert.fail; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class CommandContextTest { public class CommandContextTest {
@ -39,7 +40,7 @@ public class CommandContextTest {
private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something"; private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something";
CommandContext firstCommand; CommandContext firstCommand;
@Before @BeforeEach
public void setUpTest() { public void setUpTest() {
try { try {
firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w'))); firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w')));
@ -49,10 +50,12 @@ public class CommandContextTest {
} }
} }
@Test(expected = CommandException.class) @Test
public void testInvalidFlags() throws CommandException { public void testInvalidFlags() {
final String failingCommand = "herpderp -opw testers"; final String failingCommand = "herpderp -opw testers";
assertThrows(CommandException.class, () -> {
new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w'))); new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w')));
});
} }
@Test @Test

Datei anzeigen

@ -19,34 +19,29 @@
package com.sk89q.worldedit.extent.transform; 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.AffineTransform;
import com.sk89q.worldedit.math.transform.Transform; 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.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.HashSet;
import java.util.Set; 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 { public class BlockTransformExtentTest {
private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90); private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90);
private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90); private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90);
private final Set<BlockType> ignored = new HashSet<>(); private final Set<BlockType> ignored = new HashSet<>();
@Before @BeforeEach
public void setUp() throws Exception { public void setUp() {
// BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test")); // BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test"));
} }
@Test @Test
public void testTransform() throws Exception { public void testTransform() {
// for (BlockType type : BlockType.REGISTRY.values()) { // for (BlockType type : BlockType.REGISTRY.values()) {
// if (ignored.contains(type)) { // if (ignored.contains(type)) {
// continue; // continue;

Datei anzeigen

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

Datei anzeigen

@ -5,7 +5,7 @@ loaderVersion="[24,)"
# A URL to refer people to when problems occur with this mod # A URL to refer people to when problems occur with this mod
issueTrackerURL="https://discord.gg/enginehub" issueTrackerURL="https://discord.gg/enginehub"
# A URL for the "homepage" for this mod, displayed in the mod UI # 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 # A file name (in the root of the mod JAR) containing a logo for display
logoFile="worldedit-icon.png" logoFile="worldedit-icon.png"
# A text field displayed in the mod UI # A text field displayed in the mod UI

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -0,0 +1,11 @@
applyLibrariesConfiguration()
repositories {
maven {
name = "SpigotMC"
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
}
dependencies {
"shade"("net.kyori:text-adapter-bukkit:${Versions.TEXT_EXTRAS}")
}

Datei anzeigen

@ -0,0 +1,9 @@
applyLibrariesConfiguration()
dependencies {
"shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar")
"shade"("FAWE-Piston:core-ap/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")
}

Datei anzeigen

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