Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-19 17:30:08 +01:00
Merge branch 'main' into feat/feature-placement
Dieser Commit ist enthalten in:
Commit
0957d55c6a
36
.github/renovate.json
vendored
36
.github/renovate.json
vendored
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema" : "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema" : "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends" : [
|
"extends" : [
|
||||||
"config:base",
|
"config:recommended",
|
||||||
":semanticCommitsDisabled"
|
":semanticCommitsDisabled"
|
||||||
],
|
],
|
||||||
"automerge" : true,
|
"automerge" : true,
|
||||||
@ -29,7 +29,37 @@
|
|||||||
"org.spongepowered:spongeapi",
|
"org.spongepowered:spongeapi",
|
||||||
"org.yaml:snakeyaml"
|
"org.yaml:snakeyaml"
|
||||||
],
|
],
|
||||||
"labels": ["Renovate"],
|
"labels" : [
|
||||||
|
"Renovate"
|
||||||
|
],
|
||||||
"rebaseWhen" : "conflicted",
|
"rebaseWhen" : "conflicted",
|
||||||
"schedule": ["on the first day of the month"]
|
"schedule" : [
|
||||||
|
"on the first day of the month"
|
||||||
|
],
|
||||||
|
"customManagers" : [
|
||||||
|
{
|
||||||
|
"customType" : "regex",
|
||||||
|
"datasourceTemplate" : "custom.paperweight-userdev",
|
||||||
|
"fileMatch" : "^worldedit-bukkit\\/adapters\\/adapter-\\d+_\\d+(_\\d+)?\\/build\\.gradle\\.kts$",
|
||||||
|
"matchStrings" : [
|
||||||
|
"url=(?<registryUrl>.*)\\s",
|
||||||
|
"paperDevBundle\\(\"(?<currentValue>.*?)\"\\)\\s"
|
||||||
|
],
|
||||||
|
"matchStringsStrategy": "combination",
|
||||||
|
"depNameTemplate" : "paperweight-userdev",
|
||||||
|
"extractVersionTemplate" : "(?<version>\\d+\\.\\d+\\.?\\d*-R0\\.1-\\d+\\.\\d+-\\d+)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"customDatasources" : {
|
||||||
|
"paperweight-userdev": {
|
||||||
|
"defaultRegistryUrlTemplate": "",
|
||||||
|
"format": "html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"packageRules" : [
|
||||||
|
{
|
||||||
|
"matchDatasources" : ["custom.paperweight-userdev"],
|
||||||
|
"versioning": "regex:^(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)?-R0\\.1-\\d+\\d+\\.\\d+-(?<build>\\d+)$"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
6
.github/workflows/codeql.yml
vendored
6
.github/workflows/codeql.yml
vendored
@ -27,10 +27,10 @@ jobs:
|
|||||||
cache: gradle
|
cache: gradle
|
||||||
java-version: 17
|
java-version: 17
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v3
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
|
@ -34,7 +34,7 @@ logger.lifecycle("""
|
|||||||
*******************************************
|
*******************************************
|
||||||
""")
|
""")
|
||||||
|
|
||||||
var rootVersion by extra("2.8.4")
|
var rootVersion by extra("2.8.5")
|
||||||
var snapshot by extra("SNAPSHOT")
|
var snapshot by extra("SNAPSHOT")
|
||||||
var revision: String by extra("")
|
var revision: String by extra("")
|
||||||
var buildNumber by extra("")
|
var buildNumber by extra("")
|
||||||
|
@ -24,7 +24,7 @@ dependencies {
|
|||||||
implementation(gradleApi())
|
implementation(gradleApi())
|
||||||
implementation("org.ajoberstar.grgit:grgit-gradle:5.2.1")
|
implementation("org.ajoberstar.grgit:grgit-gradle:5.2.1")
|
||||||
implementation("com.github.johnrengelman:shadow:8.1.1")
|
implementation("com.github.johnrengelman:shadow:8.1.1")
|
||||||
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.10")
|
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.11")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[versions]
|
[versions]
|
||||||
# Minecraft expectations
|
# Minecraft expectations
|
||||||
paper = "1.20.2-R0.1-SNAPSHOT"
|
paper = "1.20.4-R0.1-SNAPSHOT"
|
||||||
fastutil = "8.5.9"
|
fastutil = "8.5.9"
|
||||||
guava = "31.1-jre"
|
guava = "31.1-jre"
|
||||||
log4j = "2.19.0"
|
log4j = "2.19.0"
|
||||||
@ -11,19 +11,19 @@ snakeyaml = "2.0"
|
|||||||
dummypermscompat = "1.10"
|
dummypermscompat = "1.10"
|
||||||
worldguard-bukkit = "7.0.9"
|
worldguard-bukkit = "7.0.9"
|
||||||
mapmanager = "1.8.0-SNAPSHOT"
|
mapmanager = "1.8.0-SNAPSHOT"
|
||||||
griefprevention = "16.18.1"
|
griefprevention = "17.0.0"
|
||||||
griefdefender = "2.1.0-SNAPSHOT"
|
griefdefender = "2.1.0-SNAPSHOT"
|
||||||
residence = "4.5._13.1"
|
residence = "4.5._13.1"
|
||||||
towny = "0.100.0.8"
|
towny = "0.100.1.5"
|
||||||
plotsquared = "7.2.0"
|
plotsquared = "7.3.1"
|
||||||
|
|
||||||
# Third party
|
# Third party
|
||||||
bstats = "3.0.2"
|
bstats = "3.0.2"
|
||||||
sparsebitset = "1.3"
|
sparsebitset = "1.3"
|
||||||
parallelgzip = "1.0.5"
|
parallelgzip = "1.0.5"
|
||||||
adventure = "4.14.0"
|
adventure = "4.15.0"
|
||||||
adventure-bukkit = "4.3.1"
|
adventure-bukkit = "4.3.2"
|
||||||
checkerqual = "3.41.0"
|
checkerqual = "3.42.0"
|
||||||
truezip = "6.8.4"
|
truezip = "6.8.4"
|
||||||
auto-value = "1.10.4"
|
auto-value = "1.10.4"
|
||||||
findbugs = "3.0.2"
|
findbugs = "3.0.2"
|
||||||
@ -46,7 +46,7 @@ text = "3.0.4"
|
|||||||
piston = "0.5.7"
|
piston = "0.5.7"
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
mockito = "5.8.0"
|
mockito = "5.9.0"
|
||||||
|
|
||||||
# Gradle plugins
|
# Gradle plugins
|
||||||
pluginyml = "0.6.0"
|
pluginyml = "0.6.0"
|
||||||
|
@ -21,6 +21,7 @@ configurations.all {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.17.1-R0.1-SNAPSHOT
|
||||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.17.1-R0.1-20220414.034903-210")
|
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.17.1-R0.1-20220414.034903-210")
|
||||||
compileOnly(libs.paperlib)
|
compileOnly(libs.paperlib)
|
||||||
}
|
}
|
||||||
|
@ -148,6 +148,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
||||||
}
|
}
|
||||||
this.createCopy = createCopy;
|
this.createCopy = createCopy;
|
||||||
|
// Increment regardless of whether copy will be created or not to return null from getCopy()
|
||||||
return ++this.copyKey;
|
return ++this.copyKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// https://papermc.io/repo/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/
|
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.18.2-R0.1-SNAPSHOT
|
||||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.18.2-R0.1-20220920.010157-167")
|
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.18.2-R0.1-20220920.010157-167")
|
||||||
compileOnly(libs.paperlib)
|
compileOnly(libs.paperlib)
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
||||||
}
|
}
|
||||||
this.createCopy = createCopy;
|
this.createCopy = createCopy;
|
||||||
|
// Increment regardless of whether copy will be created or not to return null from getCopy()
|
||||||
return ++this.copyKey;
|
return ++this.copyKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.19.4-R0.1-SNAPSHOT
|
||||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.19.4-R0.1-20230608.201059-104")
|
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.19.4-R0.1-20230608.201059-104")
|
||||||
compileOnly(libs.paperlib)
|
compileOnly(libs.paperlib)
|
||||||
}
|
}
|
||||||
|
@ -156,6 +156,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
||||||
}
|
}
|
||||||
this.createCopy = createCopy;
|
this.createCopy = createCopy;
|
||||||
|
// Increment regardless of whether copy will be created or not to return null from getCopy()
|
||||||
return ++this.copyKey;
|
return ++this.copyKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/
|
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.20.1-R0.1-SNAPSHOT
|
||||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.1-R0.1-20230921.165944-178")
|
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.1-R0.1-20230921.165944-178")
|
||||||
compileOnly(libs.paperlib)
|
compileOnly(libs.paperlib)
|
||||||
}
|
}
|
||||||
|
@ -156,6 +156,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
||||||
}
|
}
|
||||||
this.createCopy = createCopy;
|
this.createCopy = createCopy;
|
||||||
|
// Increment regardless of whether copy will be created or not to return null from getCopy()
|
||||||
return ++this.copyKey;
|
return ++this.copyKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/
|
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.20.2-R0.1-SNAPSHOT
|
||||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.2-R0.1-20231203.034718-121")
|
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.2-R0.1-20231203.034718-121")
|
||||||
compileOnly(libs.paperlib)
|
compileOnly(libs.paperlib)
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
||||||
}
|
}
|
||||||
this.createCopy = createCopy;
|
this.createCopy = createCopy;
|
||||||
|
// Increment regardless of whether copy will be created or not to return null from getCopy()
|
||||||
return ++this.copyKey;
|
return ++this.copyKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/
|
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.20.4-R0.1-SNAPSHOT
|
||||||
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.4-R0.1-20231207.202833-1")
|
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.20.4-R0.1-20240106.182028-62")
|
||||||
compileOnly(libs.paperlib)
|
compileOnly(libs.paperlib)
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
|
||||||
}
|
}
|
||||||
this.createCopy = createCopy;
|
this.createCopy = createCopy;
|
||||||
|
// Increment regardless of whether copy will be created or not to return null from getCopy()
|
||||||
return ++this.copyKey;
|
return ++this.copyKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,20 +141,15 @@ tasks.named<Jar>("jar") {
|
|||||||
addJarManifest(WorldEditKind.Plugin, includeClasspath = true)
|
addJarManifest(WorldEditKind.Plugin, includeClasspath = true)
|
||||||
|
|
||||||
tasks.named<ShadowJar>("shadowJar") {
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
dependsOn(project.project(":worldedit-bukkit:adapters").subprojects.map { it.tasks.named("assemble") })
|
configurations.add(adapters)
|
||||||
from(Callable {
|
|
||||||
adapters.resolve()
|
|
||||||
.map { f ->
|
|
||||||
zipTree(f).matching {
|
|
||||||
exclude("META-INF/")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
archiveFileName.set("${rootProject.name}-Bukkit-${project.version}.${archiveExtension.getOrElse("jar")}")
|
archiveFileName.set("${rootProject.name}-Bukkit-${project.version}.${archiveExtension.getOrElse("jar")}")
|
||||||
dependencies {
|
dependencies {
|
||||||
// In tandem with not bundling log4j, we shouldn't relocate base package here.
|
// In tandem with not bundling log4j, we shouldn't relocate base package here.
|
||||||
// relocate("org.apache.logging", "com.sk89q.worldedit.log4j")
|
// relocate("org.apache.logging", "com.sk89q.worldedit.log4j")
|
||||||
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
|
relocate("org.antlr.v4", "com.sk89q.worldedit.antlr4")
|
||||||
|
|
||||||
|
exclude(dependency("$group:$name"))
|
||||||
|
|
||||||
include(dependency(":worldedit-core"))
|
include(dependency(":worldedit-core"))
|
||||||
include(dependency(":worldedit-libs:bukkit"))
|
include(dependency(":worldedit-libs:bukkit"))
|
||||||
// Purposefully not included, we assume (even though no API exposes it) that Log4J will be present at runtime
|
// Purposefully not included, we assume (even though no API exposes it) that Log4J will be present at runtime
|
||||||
@ -183,7 +178,7 @@ tasks.named<ShadowJar>("shadowJar") {
|
|||||||
include(dependency("org.lz4:lz4-java:1.8.0"))
|
include(dependency("org.lz4:lz4-java:1.8.0"))
|
||||||
}
|
}
|
||||||
relocate("net.kyori", "com.fastasyncworldedit.core.adventure") {
|
relocate("net.kyori", "com.fastasyncworldedit.core.adventure") {
|
||||||
include(dependency("net.kyori:adventure-nbt:4.14.0"))
|
include(dependency("net.kyori:adventure-nbt:4.15.0"))
|
||||||
}
|
}
|
||||||
relocate("com.zaxxer", "com.fastasyncworldedit.core.math") {
|
relocate("com.zaxxer", "com.fastasyncworldedit.core.math") {
|
||||||
include(dependency("com.zaxxer:SparseBitSet:1.3"))
|
include(dependency("com.zaxxer:SparseBitSet:1.3"))
|
||||||
@ -192,6 +187,15 @@ tasks.named<ShadowJar>("shadowJar") {
|
|||||||
include(dependency("org.anarres:parallelgzip:1.0.5"))
|
include(dependency("org.anarres:parallelgzip:1.0.5"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project.project(":worldedit-bukkit:adapters").subprojects.forEach {
|
||||||
|
dependencies {
|
||||||
|
include(dependency("${it.group}:${it.name}"))
|
||||||
|
}
|
||||||
|
minimize {
|
||||||
|
exclude(dependency("${it.group}:${it.name}"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("assemble").configure {
|
tasks.named("assemble").configure {
|
||||||
|
@ -16,6 +16,7 @@ import com.sk89q.worldedit.EditSession;
|
|||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||||
import com.sk89q.worldedit.function.FlatRegionFunction;
|
import com.sk89q.worldedit.function.FlatRegionFunction;
|
||||||
@ -217,7 +218,6 @@ public class FaweDelegateRegionManager {
|
|||||||
) {
|
) {
|
||||||
TaskManager.taskManager().async(() -> {
|
TaskManager.taskManager().async(() -> {
|
||||||
synchronized (FaweDelegateRegionManager.class) {
|
synchronized (FaweDelegateRegionManager.class) {
|
||||||
//todo because of the following code this should probably be in the Bukkit module
|
|
||||||
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
|
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName()));
|
||||||
World pos3World = BukkitAdapter.adapt(getWorld(swapPos.getWorldName()));
|
World pos3World = BukkitAdapter.adapt(getWorld(swapPos.getWorldName()));
|
||||||
EditSession sessionA = WorldEdit.getInstance().newEditSessionBuilder().world(pos1World)
|
EditSession sessionA = WorldEdit.getInstance().newEditSessionBuilder().world(pos1World)
|
||||||
@ -236,14 +236,16 @@ public class FaweDelegateRegionManager {
|
|||||||
CuboidRegion regionB = new CuboidRegion(
|
CuboidRegion regionB = new CuboidRegion(
|
||||||
pos3World,
|
pos3World,
|
||||||
swapPos.getBlockVector3(),
|
swapPos.getBlockVector3(),
|
||||||
swapPos.getBlockVector3().add(pos2.getBlockVector3()).subtract(pos1.getBlockVector3())
|
swapPos.getBlockVector3().add(pos2.getBlockVector3().subtract(pos1.getBlockVector3())).withY(pos2.getY())
|
||||||
);
|
);
|
||||||
Clipboard clipA = Clipboard.create(regionA, UUID.randomUUID());
|
Clipboard clipA = new BlockArrayClipboard(regionA, UUID.randomUUID());
|
||||||
Clipboard clipB = Clipboard.create(regionB, UUID.randomUUID());
|
Clipboard clipB = new BlockArrayClipboard(regionB, UUID.randomUUID());
|
||||||
ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, clipA, clipA.getMinimumPoint());
|
ForwardExtentCopy copyA = new ForwardExtentCopy(sessionA, regionA, clipA, clipA.getMinimumPoint());
|
||||||
ForwardExtentCopy copyB = new ForwardExtentCopy(sessionB, regionB, clipB, clipB.getMinimumPoint());
|
ForwardExtentCopy copyB = new ForwardExtentCopy(sessionB, regionB, clipB, clipB.getMinimumPoint());
|
||||||
copyA.setCopyingBiomes(true);
|
copyA.setCopyingBiomes(true);
|
||||||
copyB.setCopyingBiomes(true);
|
copyB.setCopyingBiomes(true);
|
||||||
|
copyA.setCopyingEntities(true);
|
||||||
|
copyB.setCopyingEntities(true);
|
||||||
try {
|
try {
|
||||||
Operations.completeLegacy(copyA);
|
Operations.completeLegacy(copyA);
|
||||||
Operations.completeLegacy(copyB);
|
Operations.completeLegacy(copyB);
|
||||||
@ -257,17 +259,16 @@ public class FaweDelegateRegionManager {
|
|||||||
sessionA.close();
|
sessionA.close();
|
||||||
sessionB.close();
|
sessionB.close();
|
||||||
}
|
}
|
||||||
FaweAPI.fixLighting(pos1World, new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3()), null,
|
FaweAPI.fixLighting(
|
||||||
|
pos1World,
|
||||||
|
regionA,
|
||||||
|
null,
|
||||||
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE)
|
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE)
|
||||||
);
|
);
|
||||||
FaweAPI.fixLighting(pos1World, new CuboidRegion(
|
FaweAPI.fixLighting(
|
||||||
swapPos.getBlockVector3(),
|
pos1World,
|
||||||
BlockVector3.at(
|
regionB,
|
||||||
swapPos.getX() + pos2.getX() - pos1.getX(),
|
null,
|
||||||
0,
|
|
||||||
swapPos.getZ() + pos2.getZ() - pos1.getZ()
|
|
||||||
)
|
|
||||||
), null,
|
|
||||||
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE)
|
RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE)
|
||||||
);
|
);
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
|
@ -245,6 +245,11 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
|||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable Location getRespawnLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(@Nonnull Statistic statistic) throws IllegalArgumentException {
|
public void incrementStatistic(@Nonnull Statistic statistic) throws IllegalArgumentException {
|
||||||
|
|
||||||
@ -365,4 +370,9 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable Location getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -612,12 +612,38 @@ public enum FaweCache implements Trimable {
|
|||||||
/*
|
/*
|
||||||
Thread stuff
|
Thread stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new blocking executor with default name and FaweCache logger
|
||||||
|
*
|
||||||
|
* @return new blocking executor
|
||||||
|
*/
|
||||||
public ThreadPoolExecutor newBlockingExecutor() {
|
public ThreadPoolExecutor newBlockingExecutor() {
|
||||||
|
return newBlockingExecutor("FAWE Blocking Executor - %d");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new blocking executor with specified name and FaweCache logger
|
||||||
|
*
|
||||||
|
* @return new blocking executor
|
||||||
|
* @since TODO
|
||||||
|
*/
|
||||||
|
public ThreadPoolExecutor newBlockingExecutor(String name) {
|
||||||
|
return newBlockingExecutor(name, LOGGER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new blocking executor with specified name and logger
|
||||||
|
*
|
||||||
|
* @return new blocking executor
|
||||||
|
* @since TODO
|
||||||
|
*/
|
||||||
|
public ThreadPoolExecutor newBlockingExecutor(String name, Logger logger) {
|
||||||
int nThreads = Settings.settings().QUEUE.PARALLEL_THREADS;
|
int nThreads = Settings.settings().QUEUE.PARALLEL_THREADS;
|
||||||
ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(nThreads, true);
|
ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(nThreads, true);
|
||||||
return new ThreadPoolExecutor(nThreads, nThreads,
|
return new ThreadPoolExecutor(nThreads, nThreads,
|
||||||
0L, TimeUnit.MILLISECONDS, queue,
|
0L, TimeUnit.MILLISECONDS, queue,
|
||||||
new ThreadFactoryBuilder().setNameFormat("FAWE Blocking Executor - %d").build(),
|
new ThreadFactoryBuilder().setNameFormat(name).build(),
|
||||||
new ThreadPoolExecutor.CallerRunsPolicy()
|
new ThreadPoolExecutor.CallerRunsPolicy()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@ -652,10 +678,10 @@ public enum FaweCache implements Trimable {
|
|||||||
int hash = throwable.getMessage() != null ? throwable.getMessage().hashCode() : 0;
|
int hash = throwable.getMessage() != null ? throwable.getMessage().hashCode() : 0;
|
||||||
if (hash != lastException) {
|
if (hash != lastException) {
|
||||||
lastException = hash;
|
lastException = hash;
|
||||||
LOGGER.catching(throwable);
|
logger.catching(throwable);
|
||||||
count = 0;
|
count = 0;
|
||||||
} else if (count < Settings.settings().QUEUE.PARALLEL_THREADS) {
|
} else if (count < Settings.settings().QUEUE.PARALLEL_THREADS) {
|
||||||
LOGGER.warn(throwable.getMessage());
|
logger.warn(throwable.getMessage());
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -665,10 +691,10 @@ public enum FaweCache implements Trimable {
|
|||||||
private void handleFaweException(FaweException e) {
|
private void handleFaweException(FaweException e) {
|
||||||
FaweException.Type type = e.getType();
|
FaweException.Type type = e.getType();
|
||||||
if (e.getType() == FaweException.Type.OTHER) {
|
if (e.getType() == FaweException.Type.OTHER) {
|
||||||
LOGGER.catching(e);
|
logger.catching(e);
|
||||||
} else if (!faweExceptionReasonsUsed[type.ordinal()]) {
|
} else if (!faweExceptionReasonsUsed[type.ordinal()]) {
|
||||||
faweExceptionReasonsUsed[type.ordinal()] = true;
|
faweExceptionReasonsUsed[type.ordinal()] = true;
|
||||||
LOGGER.warn("FaweException: " + e.getMessage());
|
logger.warn("FaweException: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -67,11 +67,11 @@ public class ErodeBrush implements Brush {
|
|||||||
final int by = target.getBlockY();
|
final int by = target.getBlockY();
|
||||||
final int bz = target.getBlockZ();
|
final int bz = target.getBlockZ();
|
||||||
|
|
||||||
for (int x = -brushSize, relx = 0; x <= brushSize; x++, relx++) {
|
for (int x = -brushSize, relx = 0; x <= brushSize && relx < buffer1.getWidth(); x++, relx++) {
|
||||||
int x0 = x + bx;
|
int x0 = x + bx;
|
||||||
for (int y = -brushSize, rely = 0; y <= brushSize; y++, rely++) {
|
for (int y = -brushSize, rely = 0; y <= brushSize && rely < buffer1.getHeight(); y++, rely++) {
|
||||||
int y0 = y + by;
|
int y0 = y + by;
|
||||||
for (int z = -brushSize, relz = 0; z <= brushSize; z++, relz++) {
|
for (int z = -brushSize, relz = 0; z <= brushSize && relz < buffer1.getLength(); z++, relz++) {
|
||||||
int z0 = z + bz;
|
int z0 = z + bz;
|
||||||
BlockState state = es.getBlock(x0, y0, z0);
|
BlockState state = es.getBlock(x0, y0, z0);
|
||||||
buffer1.setBlock(relx, rely, relz, state);
|
buffer1.setBlock(relx, rely, relz, state);
|
||||||
@ -115,11 +115,11 @@ public class ErodeBrush implements Brush {
|
|||||||
Clipboard current, Clipboard target
|
Clipboard current, Clipboard target
|
||||||
) {
|
) {
|
||||||
int[] frequency = null;
|
int[] frequency = null;
|
||||||
for (int x = -brushSize, relx = 0; x <= brushSize; x++, relx++) {
|
for (int x = -brushSize, relx = 0; x <= brushSize && relx < target.getWidth(); x++, relx++) {
|
||||||
int x2 = x * x;
|
int x2 = x * x;
|
||||||
for (int z = -brushSize, relz = 0; z <= brushSize; z++, relz++) {
|
for (int z = -brushSize, relz = 0; z <= brushSize && relz < target.getLength(); z++, relz++) {
|
||||||
int x2y2 = x2 + z * z;
|
int x2y2 = x2 + z * z;
|
||||||
for (int y = -brushSize, rely = 0; y <= brushSize; y++, rely++) {
|
for (int y = -brushSize, rely = 0; y <= brushSize && rely < target.getHeight(); y++, rely++) {
|
||||||
int cube = x2y2 + y * y;
|
int cube = x2y2 + y * y;
|
||||||
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
|
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
|
||||||
if (cube >= brushSizeSquared) {
|
if (cube >= brushSizeSquared) {
|
||||||
@ -166,11 +166,11 @@ public class ErodeBrush implements Brush {
|
|||||||
Clipboard current, Clipboard target
|
Clipboard current, Clipboard target
|
||||||
) {
|
) {
|
||||||
int[] frequency = null;
|
int[] frequency = null;
|
||||||
for (int x = -brushSize, relx = 0; x <= brushSize; x++, relx++) {
|
for (int x = -brushSize, relx = 0; x <= brushSize && relx < target.getWidth(); x++, relx++) {
|
||||||
int x2 = x * x;
|
int x2 = x * x;
|
||||||
for (int z = -brushSize, relz = 0; z <= brushSize; z++, relz++) {
|
for (int z = -brushSize, relz = 0; z <= brushSize && relz < target.getLength(); z++, relz++) {
|
||||||
int x2y2 = x2 + z * z;
|
int x2y2 = x2 + z * z;
|
||||||
for (int y = -brushSize, rely = 0; y <= brushSize; y++, rely++) {
|
for (int y = -brushSize, rely = 0; y <= brushSize && rely < target.getHeight(); y++, rely++) {
|
||||||
int cube = x2y2 + y * y;
|
int cube = x2y2 + y * y;
|
||||||
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
|
target.setBlock(relx, rely, relz, current.getBlock(relx, rely, relz));
|
||||||
if (cube >= brushSizeSquared) {
|
if (cube >= brushSizeSquared) {
|
||||||
|
@ -721,6 +721,13 @@ public class Settings extends Config {
|
|||||||
" - Requires clipboard.use-disk to be enabled"
|
" - Requires clipboard.use-disk to be enabled"
|
||||||
})
|
})
|
||||||
public boolean SAVE_CLIPBOARD_NBT_TO_DISK = true;
|
public boolean SAVE_CLIPBOARD_NBT_TO_DISK = true;
|
||||||
|
@Comment({
|
||||||
|
"Apply a file lock on the clipboard file (only relevant if clipboad.on-disk is enabled)",
|
||||||
|
" - Prevents other processes using the file whilst in use by FAWE",
|
||||||
|
" - This extends to other servers, useful if you have multiple servers using a unified clipboard folder",
|
||||||
|
" - May run into issues where a file lock is not correctly lifted"
|
||||||
|
})
|
||||||
|
public boolean LOCK_CLIPBOARD_FILE = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,6 +305,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
|||||||
private void init() throws IOException {
|
private void init() throws IOException {
|
||||||
if (this.fileChannel == null) {
|
if (this.fileChannel == null) {
|
||||||
this.fileChannel = braf.getChannel();
|
this.fileChannel = braf.getChannel();
|
||||||
|
if (Settings.settings().CLIPBOARD.LOCK_CLIPBOARD_FILE) {
|
||||||
try {
|
try {
|
||||||
FileLock lock = this.fileChannel.lock();
|
FileLock lock = this.fileChannel.lock();
|
||||||
LOCK_HOLDER_CACHE.put(file.getName(), new LockHolder(lock));
|
LOCK_HOLDER_CACHE.put(file.getName(), new LockHolder(lock));
|
||||||
@ -322,6 +323,7 @@ public class DiskOptimizedClipboard extends LinearClipboard {
|
|||||||
// Rethrow to prevent clipboard access
|
// Rethrow to prevent clipboard access
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.byteBuffer = fileChannel.map(FileChannel.MapMode.READ_WRITE, 0, braf.length());
|
this.byteBuffer = fileChannel.map(FileChannel.MapMode.READ_WRITE, 0, braf.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ public interface IBatchProcessor {
|
|||||||
* @return false if chunk is empty of NBT
|
* @return false if chunk is empty of NBT
|
||||||
* @deprecated tiles are stored in chunk-normalised coordinate space and thus cannot use the same function as entities
|
* @deprecated tiles are stored in chunk-normalised coordinate space and thus cannot use the same function as entities
|
||||||
*/
|
*/
|
||||||
@Deprecated(forRemoval = true, since = "TODO")
|
@Deprecated(forRemoval = true, since = "2.8.4")
|
||||||
default boolean trimNBT(IChunkSet set, Function<BlockVector3, Boolean> contains) {
|
default boolean trimNBT(IChunkSet set, Function<BlockVector3, Boolean> contains) {
|
||||||
Set<CompoundTag> ents = set.getEntities();
|
Set<CompoundTag> ents = set.getEntities();
|
||||||
if (!ents.isEmpty()) {
|
if (!ents.isEmpty()) {
|
||||||
@ -175,7 +175,7 @@ public interface IBatchProcessor {
|
|||||||
* Utility method to trim entity and blocks with a provided contains function.
|
* Utility method to trim entity and blocks with a provided contains function.
|
||||||
*
|
*
|
||||||
* @return false if chunk is empty of NBT
|
* @return false if chunk is empty of NBT
|
||||||
* @since TODO
|
* @since 2.8.4
|
||||||
*/
|
*/
|
||||||
default boolean trimNBT(
|
default boolean trimNBT(
|
||||||
IChunkSet set, Function<BlockVector3, Boolean> containsEntity, Function<BlockVector3, Boolean> containsTile
|
IChunkSet set, Function<BlockVector3, Boolean> containsEntity, Function<BlockVector3, Boolean> containsTile
|
||||||
|
@ -38,7 +38,7 @@ public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
|||||||
* Return the minimum block coordinate of the chunk
|
* Return the minimum block coordinate of the chunk
|
||||||
*
|
*
|
||||||
* @return BlockVector3 of minimum block coordinate
|
* @return BlockVector3 of minimum block coordinate
|
||||||
* @since TODO
|
* @since 2.8.4
|
||||||
*/
|
*/
|
||||||
default BlockVector3 getChunkBlockCoord() {
|
default BlockVector3 getChunkBlockCoord() {
|
||||||
return BlockVector3.at(getX() << 4, getMinY(), getZ() << 4);
|
return BlockVector3.at(getX() << 4, getMinY(), getZ() << 4);
|
||||||
|
@ -68,7 +68,8 @@ public abstract class QueueHandler implements Trimable, Runnable {
|
|||||||
* Main "work-horse" queue for FAWE. Handles chunk submission (and chunk submission alone). Blocking in order to forcibly
|
* Main "work-horse" queue for FAWE. Handles chunk submission (and chunk submission alone). Blocking in order to forcibly
|
||||||
* prevent overworking/over-submission of chunk process tasks.
|
* prevent overworking/over-submission of chunk process tasks.
|
||||||
*/
|
*/
|
||||||
private final ThreadPoolExecutor blockingExecutor = FaweCache.INSTANCE.newBlockingExecutor();
|
private final ThreadPoolExecutor blockingExecutor = FaweCache.INSTANCE.newBlockingExecutor(
|
||||||
|
"FAWE QueueHandler Blocking Executor - %d");
|
||||||
/**
|
/**
|
||||||
* Queue for tasks to be completed on the main thread. These take priority of tasks submitted to syncWhenFree queue
|
* Queue for tasks to be completed on the main thread. These take priority of tasks submitted to syncWhenFree queue
|
||||||
*/
|
*/
|
||||||
|
@ -158,6 +158,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
|||||||
this.setProcessor(EmptyBatchProcessor.getInstance());
|
this.setProcessor(EmptyBatchProcessor.getInstance());
|
||||||
this.setPostProcessor(EmptyBatchProcessor.getInstance());
|
this.setPostProcessor(EmptyBatchProcessor.getInstance());
|
||||||
this.world = null;
|
this.world = null;
|
||||||
|
this.faweExceptionReasonsUsed = new boolean[FaweException.Type.values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,6 +12,7 @@ import com.fastasyncworldedit.core.queue.IChunkSet;
|
|||||||
import com.fastasyncworldedit.core.queue.IQueueChunk;
|
import com.fastasyncworldedit.core.queue.IQueueChunk;
|
||||||
import com.fastasyncworldedit.core.queue.IQueueExtent;
|
import com.fastasyncworldedit.core.queue.IQueueExtent;
|
||||||
import com.fastasyncworldedit.core.queue.Pool;
|
import com.fastasyncworldedit.core.queue.Pool;
|
||||||
|
import com.fastasyncworldedit.core.util.MemUtil;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
@ -959,7 +960,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
public final IChunkGet getOrCreateGet() {
|
public final IChunkGet getOrCreateGet() {
|
||||||
if (chunkExisting == null) {
|
if (chunkExisting == null) {
|
||||||
chunkExisting = newWrappedGet();
|
chunkExisting = newWrappedGet();
|
||||||
chunkExisting.trim(false);
|
chunkExisting.trim(MemUtil.isMemoryLimited());
|
||||||
}
|
}
|
||||||
return chunkExisting;
|
return chunkExisting;
|
||||||
}
|
}
|
||||||
@ -1031,10 +1032,10 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
try {
|
try {
|
||||||
get.lockCall();
|
get.lockCall();
|
||||||
boolean postProcess = !(getExtent().getPostProcessor() instanceof EmptyBatchProcessor);
|
boolean postProcess = !(getExtent().getPostProcessor() instanceof EmptyBatchProcessor);
|
||||||
|
final int copyKey = get.setCreateCopy(postProcess);
|
||||||
final IChunkSet iChunkSet = getExtent().processSet(this, get, set);
|
final IChunkSet iChunkSet = getExtent().processSet(this, get, set);
|
||||||
Runnable finalizer;
|
Runnable finalizer;
|
||||||
if (postProcess) {
|
if (postProcess) {
|
||||||
int copyKey = get.setCreateCopy(true);
|
|
||||||
finalizer = () -> {
|
finalizer = () -> {
|
||||||
getExtent().postProcess(this, get.getCopy(copyKey), iChunkSet);
|
getExtent().postProcess(this, get.getCopy(copyKey), iChunkSet);
|
||||||
finalize.run();
|
finalize.run();
|
||||||
|
@ -47,6 +47,7 @@ import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
|||||||
import com.sk89q.worldedit.command.util.Logging;
|
import com.sk89q.worldedit.command.util.Logging;
|
||||||
import com.sk89q.worldedit.command.util.annotation.Confirm;
|
import com.sk89q.worldedit.command.util.annotation.Confirm;
|
||||||
import com.sk89q.worldedit.command.util.annotation.Preload;
|
import com.sk89q.worldedit.command.util.annotation.Preload;
|
||||||
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
@ -70,6 +71,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
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.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.NullRegion;
|
import com.sk89q.worldedit.regions.NullRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionIntersection;
|
import com.sk89q.worldedit.regions.RegionIntersection;
|
||||||
@ -453,7 +455,9 @@ public class ClipboardCommands {
|
|||||||
@Switch(name = 'e', desc = "Paste entities if available")
|
@Switch(name = 'e', desc = "Paste entities if available")
|
||||||
boolean pasteEntities,
|
boolean pasteEntities,
|
||||||
@Switch(name = 'b', desc = "Paste biomes if available")
|
@Switch(name = 'b', desc = "Paste biomes if available")
|
||||||
boolean pasteBiomes
|
boolean pasteBiomes,
|
||||||
|
@Switch(name = 'x', desc = "Remove existing entities in the affected region")
|
||||||
|
boolean removeEntities
|
||||||
) throws WorldEditException {
|
) throws WorldEditException {
|
||||||
ClipboardHolder holder = session.getClipboard();
|
ClipboardHolder holder = session.getClipboard();
|
||||||
final Clipboard clipboard = holder.getClipboard();
|
final Clipboard clipboard = holder.getClipboard();
|
||||||
@ -466,18 +470,23 @@ public class ClipboardCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Region region = clipboard.getRegion().clone();
|
Region region = clipboard.getRegion().clone();
|
||||||
if (selectPasted || onlySelect) {
|
if (selectPasted || onlySelect || removeEntities) {
|
||||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
BlockVector3 realTo = to.add(holder.getTransform().apply(clipboardOffset.toVector3()).toBlockPoint());
|
BlockVector3 realTo = to.add(holder.getTransform().apply(clipboardOffset.toVector3()).toBlockPoint());
|
||||||
BlockVector3 max = realTo.add(holder
|
BlockVector3 max = realTo.add(holder
|
||||||
.getTransform()
|
.getTransform()
|
||||||
.apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3())
|
.apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3())
|
||||||
.toBlockPoint());
|
.toBlockPoint());
|
||||||
|
if (removeEntities) {
|
||||||
|
editSession.getEntities(new CuboidRegion(realTo, max)).forEach(Entity::remove);
|
||||||
|
}
|
||||||
|
if (selectPasted || onlySelect) {
|
||||||
RegionSelector selector = new CuboidRegionSelector(world, realTo, max);
|
RegionSelector selector = new CuboidRegionSelector(world, realTo, max);
|
||||||
session.setRegionSelector(world, selector);
|
session.setRegionSelector(world, selector);
|
||||||
selector.learnChanges();
|
selector.learnChanges();
|
||||||
selector.explainRegionAdjust(actor, session);
|
selector.explainRegionAdjust(actor, session);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (onlySelect) {
|
if (onlySelect) {
|
||||||
actor.print(Caption.of("worldedit.paste.selected"));
|
actor.print(Caption.of("worldedit.paste.selected"));
|
||||||
} else {
|
} else {
|
||||||
@ -513,14 +522,19 @@ public class ClipboardCommands {
|
|||||||
boolean pasteBiomes,
|
boolean pasteBiomes,
|
||||||
@ArgFlag(name = 'm', desc = "Only paste blocks matching this mask")
|
@ArgFlag(name = 'm', desc = "Only paste blocks matching this mask")
|
||||||
@ClipboardMask
|
@ClipboardMask
|
||||||
Mask sourceMask
|
Mask sourceMask,
|
||||||
|
//FAWE start - entity removal
|
||||||
|
@Switch(name = 'x', desc = "Remove existing entities in the affected region")
|
||||||
|
boolean removeEntities
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
) throws WorldEditException {
|
) throws WorldEditException {
|
||||||
|
|
||||||
ClipboardHolder holder = session.getClipboard();
|
ClipboardHolder holder = session.getClipboard();
|
||||||
//FAWE start - use place
|
//FAWE start - use place
|
||||||
if (holder.getTransform().isIdentity() && sourceMask == null) {
|
if (holder.getTransform().isIdentity() && sourceMask == null) {
|
||||||
place(actor, world, session, editSession, ignoreAirBlocks, atOrigin, selectPasted, onlySelect,
|
place(actor, world, session, editSession, ignoreAirBlocks, atOrigin, selectPasted, onlySelect,
|
||||||
pasteEntities, pasteBiomes
|
pasteEntities, pasteBiomes, removeEntities
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -547,12 +561,19 @@ public class ClipboardCommands {
|
|||||||
messages.addAll(Lists.newArrayList(operation.getStatusMessages()));
|
messages.addAll(Lists.newArrayList(operation.getStatusMessages()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectPasted || onlySelect) {
|
if (selectPasted || onlySelect || removeEntities) {
|
||||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
||||||
Vector3 max = realTo.add(holder
|
Vector3 max = realTo.add(holder
|
||||||
.getTransform()
|
.getTransform()
|
||||||
.apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
.apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
||||||
|
|
||||||
|
// FAWE start - entity remova;l
|
||||||
|
if (removeEntities) {
|
||||||
|
editSession.getEntities(new CuboidRegion(realTo.toBlockPoint(), max.toBlockPoint())).forEach(Entity::remove);
|
||||||
|
}
|
||||||
|
if (selectPasted || onlySelect) {
|
||||||
|
//FAWE end
|
||||||
final CuboidRegionSelector selector;
|
final CuboidRegionSelector selector;
|
||||||
if (session.getRegionSelector(world) instanceof ExtendingCuboidRegionSelector) {
|
if (session.getRegionSelector(world) instanceof ExtendingCuboidRegionSelector) {
|
||||||
selector = new ExtendingCuboidRegionSelector(world, realTo.toBlockPoint(), max.toBlockPoint());
|
selector = new ExtendingCuboidRegionSelector(world, realTo.toBlockPoint(), max.toBlockPoint());
|
||||||
@ -563,6 +584,7 @@ public class ClipboardCommands {
|
|||||||
selector.learnChanges();
|
selector.learnChanges();
|
||||||
selector.explainRegionAdjust(actor, session);
|
selector.explainRegionAdjust(actor, session);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (onlySelect) {
|
if (onlySelect) {
|
||||||
actor.print(Caption.of("worldedit.paste.selected"));
|
actor.print(Caption.of("worldedit.paste.selected"));
|
||||||
|
@ -25,27 +25,34 @@ import com.fastasyncworldedit.core.extent.HistoryExtent;
|
|||||||
import com.fastasyncworldedit.core.extent.NullExtent;
|
import com.fastasyncworldedit.core.extent.NullExtent;
|
||||||
import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet;
|
import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet;
|
||||||
import com.fastasyncworldedit.core.internal.exception.FaweException;
|
import com.fastasyncworldedit.core.internal.exception.FaweException;
|
||||||
|
import com.fastasyncworldedit.core.queue.Filter;
|
||||||
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||||
import com.fastasyncworldedit.core.util.ExtentTraverser;
|
import com.fastasyncworldedit.core.util.ExtentTraverser;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer;
|
import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer;
|
||||||
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
import com.sk89q.worldedit.function.operation.Operation;
|
import com.sk89q.worldedit.function.operation.Operation;
|
||||||
import com.sk89q.worldedit.function.operation.OperationQueue;
|
import com.sk89q.worldedit.function.operation.OperationQueue;
|
||||||
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import com.sk89q.worldedit.util.Countable;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
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;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
@ -168,6 +175,7 @@ public class AbstractDelegateExtent implements Extent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FAWE start
|
||||||
@Override
|
@Override
|
||||||
public boolean cancel() {
|
public boolean cancel() {
|
||||||
ExtentTraverser<Extent> traverser = new ExtentTraverser<>(this);
|
ExtentTraverser<Extent> traverser = new ExtentTraverser<>(this);
|
||||||
@ -188,7 +196,6 @@ public class AbstractDelegateExtent implements Extent {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//FAWE start
|
|
||||||
@Override
|
@Override
|
||||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
extent.removeEntity(x, y, z, uuid);
|
extent.removeEntity(x, y, z, uuid);
|
||||||
@ -225,11 +232,72 @@ public class AbstractDelegateExtent implements Extent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWorld() {
|
||||||
|
return extent.isWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Countable<BlockType>> getBlockDistribution(final Region region) {
|
||||||
|
return extent.getBlockDistribution(region);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Countable<BlockState>> getBlockDistributionWithData(final Region region) {
|
||||||
|
return extent.getBlockDistributionWithData(region);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxY() {
|
public int getMaxY() {
|
||||||
return extent.getMaxY();
|
return extent.getMaxY();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countBlocks(final Region region, final Set<BaseBlock> searchBlocks) {
|
||||||
|
return extent.countBlocks(region, searchBlocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countBlocks(final Region region, final Mask searchMask) {
|
||||||
|
return extent.countBlocks(region, searchMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <B extends BlockStateHolder<B>> int setBlocks(final Region region, final B block) throws MaxChangedBlocksException {
|
||||||
|
return extent.setBlocks(region, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int setBlocks(final Region region, final Pattern pattern) throws MaxChangedBlocksException {
|
||||||
|
return extent.setBlocks(region, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <B extends BlockStateHolder<B>> int replaceBlocks(
|
||||||
|
final Region region,
|
||||||
|
final Set<BaseBlock> filter,
|
||||||
|
final B replacement
|
||||||
|
)
|
||||||
|
throws MaxChangedBlocksException {
|
||||||
|
return extent.replaceBlocks(region, filter, replacement);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int replaceBlocks(final Region region, final Set<BaseBlock> filter, final Pattern pattern) throws
|
||||||
|
MaxChangedBlocksException {
|
||||||
|
return extent.replaceBlocks(region, filter, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int replaceBlocks(final Region region, final Mask mask, final Pattern pattern) throws MaxChangedBlocksException {
|
||||||
|
return extent.replaceBlocks(region, mask, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int setBlocks(final Set<BlockVector3> vset, final Pattern pattern) {
|
||||||
|
return extent.setBlocks(vset, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinY() {
|
public int getMinY() {
|
||||||
return extent.getMinY();
|
return extent.getMinY();
|
||||||
@ -295,23 +363,29 @@ public class AbstractDelegateExtent implements Extent {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Filter> T apply(final Region region, final T filter, final boolean full) {
|
||||||
|
return extent.apply(region, filter, full);
|
||||||
|
}
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
protected Operation commitBefore() {
|
protected Operation commitBefore() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BiomeType getBiome(BlockVector3 position) {
|
||||||
|
//FAWE start - switch top x,y,z
|
||||||
|
return extent.getBiomeType(position.getX(), position.getY(), position.getZ());
|
||||||
|
//FAWE end
|
||||||
|
}
|
||||||
|
|
||||||
|
//FAWE start
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiomeType(int x, int y, int z) {
|
public BiomeType getBiomeType(int x, int y, int z) {
|
||||||
return extent.getBiomeType(x, y, z);
|
return extent.getBiomeType(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BiomeType getBiome(BlockVector3 position) {
|
|
||||||
return extent.getBiome(position);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
History
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEmittedLight(int x, int y, int z) {
|
public int getEmittedLight(int x, int y, int z) {
|
||||||
return extent.getEmittedLight(x, y, z);
|
return extent.getEmittedLight(x, y, z);
|
||||||
@ -341,13 +415,17 @@ public class AbstractDelegateExtent implements Extent {
|
|||||||
new ExtentTraverser<>(this).setNext(new HistoryExtent(extent, changeSet));
|
new ExtentTraverser<>(this).setNext(new HistoryExtent(extent, changeSet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block)
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
//FAWE start - switch to x,y,z
|
||||||
return extent.setBlock(position.getX(), position.getY(), position.getZ(), block);
|
return extent.setBlock(position.getX(), position.getY(), position.getZ(), block);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FAWE start
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(
|
public <T extends BlockStateHolder<T>> boolean setBlock(
|
||||||
int x, int y,
|
int x, int y,
|
||||||
@ -360,6 +438,7 @@ public class AbstractDelegateExtent implements Extent {
|
|||||||
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile));
|
return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile));
|
||||||
}
|
}
|
||||||
|
//FAWE end
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean fullySupports3DBiomes() {
|
public boolean fullySupports3DBiomes() {
|
||||||
@ -367,13 +446,16 @@ public class AbstractDelegateExtent implements Extent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||||
return extent.setBiome(x, y, z, biome);
|
//FAWE start - switch to x,y,z
|
||||||
|
return extent.setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
||||||
|
//FAWE end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FAWE start
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||||
return extent.setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
return extent.setBiome(x, y, z, biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -73,7 +73,10 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable, Fl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link ReadOnlyClipboard}.
|
* Creates a new {@link ReadOnlyClipboard}.
|
||||||
|
*
|
||||||
|
* @deprecated Internal use only. Use {@link BlockArrayClipboard#BlockArrayClipboard(Region)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
static Clipboard create(Region region) {
|
static Clipboard create(Region region) {
|
||||||
checkNotNull(region);
|
checkNotNull(region);
|
||||||
checkNotNull(
|
checkNotNull(
|
||||||
@ -95,7 +98,10 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable, Fl
|
|||||||
* - {@link DiskOptimizedClipboard}
|
* - {@link DiskOptimizedClipboard}
|
||||||
* - {@link CPUOptimizedClipboard}
|
* - {@link CPUOptimizedClipboard}
|
||||||
* - {@link MemoryOptimizedClipboard}
|
* - {@link MemoryOptimizedClipboard}
|
||||||
|
*
|
||||||
|
* @deprecated Internal use only. Use {@link BlockArrayClipboard#BlockArrayClipboard(Region, UUID)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
static Clipboard create(Region region, UUID uuid) {
|
static Clipboard create(Region region, UUID uuid) {
|
||||||
if (Settings.settings().CLIPBOARD.USE_DISK) {
|
if (Settings.settings().CLIPBOARD.USE_DISK) {
|
||||||
return new DiskOptimizedClipboard(region, uuid);
|
return new DiskOptimizedClipboard(region, uuid);
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* WorldEdit, a Minecraft world manipulation toolkit
|
||||||
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||||
|
* Copyright (C) WorldEdit team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.extent.clipboard.io;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raised when a known exception occurs during schematic load.
|
||||||
|
*/
|
||||||
|
public final class SchematicLoadException extends RuntimeException {
|
||||||
|
|
||||||
|
private final Component message;
|
||||||
|
|
||||||
|
public SchematicLoadException(Component message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message of this exception as a rich text component.
|
||||||
|
*
|
||||||
|
* @return The rich message
|
||||||
|
*/
|
||||||
|
public Component getRichMessage() {
|
||||||
|
return this.message;
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent.clipboard.io;
|
package com.sk89q.worldedit.extent.clipboard.io;
|
||||||
|
|
||||||
|
import com.fastasyncworldedit.core.configuration.Caption;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.sk89q.jnbt.AdventureNBTConverter;
|
import com.sk89q.jnbt.AdventureNBTConverter;
|
||||||
import com.sk89q.jnbt.ByteArrayTag;
|
import com.sk89q.jnbt.ByteArrayTag;
|
||||||
@ -46,6 +47,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.world.DataFixer;
|
import com.sk89q.worldedit.world.DataFixer;
|
||||||
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;
|
||||||
@ -137,9 +139,8 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
|||||||
BlockArrayClipboard clip = readVersion1(schematicTag);
|
BlockArrayClipboard clip = readVersion1(schematicTag);
|
||||||
return readVersion2(clip, schematicTag);
|
return readVersion2(clip, schematicTag);
|
||||||
}
|
}
|
||||||
throw new IOException("This schematic version is not supported; Version: " + schematicVersion + ", DataVersion: " + dataVersion + "." +
|
throw new SchematicLoadException(Caption.of("worldedit.schematic.load.unsupported-version",
|
||||||
"It's very likely your schematic has an invalid file extension, if the schematic has been created on a version lower than" +
|
TextComponent.of(schematicVersion)));
|
||||||
"1.13.2, the extension MUST be `.schematic`, elsewise the schematic can't be read properly.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -169,6 +170,13 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
|||||||
// Check
|
// Check
|
||||||
Map<String, Tag> schematic = schematicTag.getValue();
|
Map<String, Tag> schematic = schematicTag.getValue();
|
||||||
|
|
||||||
|
// Be lenient about the specific nesting level of the Schematic tag
|
||||||
|
// Also allows checking the version from newer versions of the specification
|
||||||
|
if (schematic.size() == 1 && schematic.containsKey("Schematic")) {
|
||||||
|
schematicTag = requireTag(schematic, "Schematic", CompoundTag.class);
|
||||||
|
schematic = schematicTag.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
schematicVersion = requireTag(schematic, "Version", IntTag.class).getValue();
|
schematicVersion = requireTag(schematic, "Version", IntTag.class).getValue();
|
||||||
return schematicTag;
|
return schematicTag;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
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;
|
||||||
|
|
||||||
@ -34,7 +35,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class DataValidatorExtent extends AbstractDelegateExtent {
|
public class DataValidatorExtent extends AbstractDelegateExtent {
|
||||||
|
|
||||||
private final World world;
|
private final int minY;
|
||||||
|
private final int maxY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
@ -43,16 +45,27 @@ public class DataValidatorExtent extends AbstractDelegateExtent {
|
|||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public DataValidatorExtent(Extent extent, World world) {
|
public DataValidatorExtent(Extent extent, World world) {
|
||||||
|
this(extent, checkNotNull(world).getMinY(), world.getMaxY());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new instance.
|
||||||
|
*
|
||||||
|
* @param extent The extent
|
||||||
|
* @param minY The minimum Y height to allow (inclusive)
|
||||||
|
* @param maxY The maximum Y height to allow (inclusive)
|
||||||
|
*/
|
||||||
|
public DataValidatorExtent(Extent extent, int minY, int maxY) {
|
||||||
super(extent);
|
super(extent);
|
||||||
checkNotNull(world);
|
this.minY = minY;
|
||||||
this.world = world;
|
this.maxY = maxY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
|
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
|
||||||
final int y = location.getBlockY();
|
final int y = location.getBlockY();
|
||||||
final BlockType type = block.getBlockType();
|
final BlockType type = block.getBlockType();
|
||||||
if (y < world.getMinY() || y > world.getMaxY()) {
|
if (y < minY || y > maxY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,4 +77,15 @@ public class DataValidatorExtent extends AbstractDelegateExtent {
|
|||||||
return super.setBlock(location, block);
|
return super.setBlock(location, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setBiome(BlockVector3 location, BiomeType biome) {
|
||||||
|
final int y = location.getBlockY();
|
||||||
|
|
||||||
|
if (y < minY || y > maxY) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.setBiome(location, biome);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import com.sk89q.worldedit.WorldEdit;
|
|||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.command.InsufficientArgumentsException;
|
import com.sk89q.worldedit.command.InsufficientArgumentsException;
|
||||||
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.SchematicLoadException;
|
||||||
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
import com.sk89q.worldedit.internal.expression.ExpressionException;
|
||||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
@ -187,6 +188,11 @@ public class WorldEditExceptionConverter extends ExceptionConverterHelper {
|
|||||||
throw newCommandException(Caption.of("worldedit.error.file-aborted"), e);
|
throw newCommandException(Caption.of("worldedit.error.file-aborted"), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExceptionMatch
|
||||||
|
public void convert(SchematicLoadException e) throws CommandException {
|
||||||
|
throw newCommandException(e.getRichMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
@ExceptionMatch
|
@ExceptionMatch
|
||||||
public void convert(WorldEditException e) throws CommandException {
|
public void convert(WorldEditException e) throws CommandException {
|
||||||
throw newCommandException(e.getRichMessage(), e);
|
throw newCommandException(e.getRichMessage(), e);
|
||||||
|
@ -195,6 +195,33 @@ public class AffineTransform implements Transform, Serializable {
|
|||||||
// ===================================================================
|
// ===================================================================
|
||||||
// general methods
|
// general methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the affine transform created by applying first the affine
|
||||||
|
* transform given by the parameters, then this affine transform.
|
||||||
|
*
|
||||||
|
* @return the composition this * that
|
||||||
|
*/
|
||||||
|
public AffineTransform concatenate(double o00, double o01, double o02, double o03,
|
||||||
|
double o10, double o11, double o12, double o13,
|
||||||
|
double o20, double o21, double o22, double o23) {
|
||||||
|
double n00 = m00 * o00 + m01 * o10 + m02 * o20;
|
||||||
|
double n01 = m00 * o01 + m01 * o11 + m02 * o21;
|
||||||
|
double n02 = m00 * o02 + m01 * o12 + m02 * o22;
|
||||||
|
double n03 = m00 * o03 + m01 * o13 + m02 * o23 + m03;
|
||||||
|
double n10 = m10 * o00 + m11 * o10 + m12 * o20;
|
||||||
|
double n11 = m10 * o01 + m11 * o11 + m12 * o21;
|
||||||
|
double n12 = m10 * o02 + m11 * o12 + m12 * o22;
|
||||||
|
double n13 = m10 * o03 + m11 * o13 + m12 * o23 + m13;
|
||||||
|
double n20 = m20 * o00 + m21 * o10 + m22 * o20;
|
||||||
|
double n21 = m20 * o01 + m21 * o11 + m22 * o21;
|
||||||
|
double n22 = m20 * o02 + m21 * o12 + m22 * o22;
|
||||||
|
double n23 = m20 * o03 + m21 * o13 + m22 * o23 + m23;
|
||||||
|
return new AffineTransform(
|
||||||
|
n00, n01, n02, n03,
|
||||||
|
n10, n11, n12, n13,
|
||||||
|
n20, n21, n22, n23);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the affine transform created by applying first the affine
|
* Returns the affine transform created by applying first the affine
|
||||||
* transform given by {@code that}, then this affine transform.
|
* transform given by {@code that}, then this affine transform.
|
||||||
@ -203,22 +230,10 @@ public class AffineTransform implements Transform, Serializable {
|
|||||||
* @return the composition this * that
|
* @return the composition this * that
|
||||||
*/
|
*/
|
||||||
public AffineTransform concatenate(AffineTransform that) {
|
public AffineTransform concatenate(AffineTransform that) {
|
||||||
double n00 = m00 * that.m00 + m01 * that.m10 + m02 * that.m20;
|
return concatenate(
|
||||||
double n01 = m00 * that.m01 + m01 * that.m11 + m02 * that.m21;
|
that.m00, that.m01, that.m02, that.m03,
|
||||||
double n02 = m00 * that.m02 + m01 * that.m12 + m02 * that.m22;
|
that.m10, that.m11, that.m12, that.m13,
|
||||||
double n03 = m00 * that.m03 + m01 * that.m13 + m02 * that.m23 + m03;
|
that.m20, that.m21, that.m22, that.m23
|
||||||
double n10 = m10 * that.m00 + m11 * that.m10 + m12 * that.m20;
|
|
||||||
double n11 = m10 * that.m01 + m11 * that.m11 + m12 * that.m21;
|
|
||||||
double n12 = m10 * that.m02 + m11 * that.m12 + m12 * that.m22;
|
|
||||||
double n13 = m10 * that.m03 + m11 * that.m13 + m12 * that.m23 + m13;
|
|
||||||
double n20 = m20 * that.m00 + m21 * that.m10 + m22 * that.m20;
|
|
||||||
double n21 = m20 * that.m01 + m21 * that.m11 + m22 * that.m21;
|
|
||||||
double n22 = m20 * that.m02 + m21 * that.m12 + m22 * that.m22;
|
|
||||||
double n23 = m20 * that.m03 + m21 * that.m13 + m22 * that.m23 + m23;
|
|
||||||
return new AffineTransform(
|
|
||||||
n00, n01, n02, n03,
|
|
||||||
n10, n11, n12, n13,
|
|
||||||
n20, n21, n22, n23
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,40 +273,37 @@ public class AffineTransform implements Transform, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AffineTransform translate(double x, double y, double z) {
|
public AffineTransform translate(double x, double y, double z) {
|
||||||
return concatenate(new AffineTransform(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z));
|
return concatenate(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AffineTransform rotateX(double theta) {
|
public AffineTransform rotateX(double theta) {
|
||||||
double cot = MathUtils.dCos(theta);
|
double cot = MathUtils.dCos(theta);
|
||||||
double sit = MathUtils.dSin(theta);
|
double sit = MathUtils.dSin(theta);
|
||||||
return concatenate(
|
return concatenate(
|
||||||
new AffineTransform(
|
|
||||||
1, 0, 0, 0,
|
1, 0, 0, 0,
|
||||||
0, cot, -sit, 0,
|
0, cot, -sit, 0,
|
||||||
0, sit, cot, 0
|
0, sit, cot, 0
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AffineTransform rotateY(double theta) {
|
public AffineTransform rotateY(double theta) {
|
||||||
double cot = MathUtils.dCos(theta);
|
double cot = MathUtils.dCos(theta);
|
||||||
double sit = MathUtils.dSin(theta);
|
double sit = MathUtils.dSin(theta);
|
||||||
return concatenate(
|
return concatenate(
|
||||||
new AffineTransform(
|
|
||||||
cot, 0, sit, 0,
|
cot, 0, sit, 0,
|
||||||
0, 1, 0, 0,
|
0, 1, 0, 0,
|
||||||
-sit, 0, cot, 0
|
-sit, 0, cot, 0
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AffineTransform rotateZ(double theta) {
|
public AffineTransform rotateZ(double theta) {
|
||||||
double cot = MathUtils.dCos(theta);
|
double cot = MathUtils.dCos(theta);
|
||||||
double sit = MathUtils.dSin(theta);
|
double sit = MathUtils.dSin(theta);
|
||||||
return concatenate(
|
return concatenate(
|
||||||
new AffineTransform(
|
|
||||||
cot, -sit, 0, 0,
|
cot, -sit, 0, 0,
|
||||||
sit, cot, 0, 0,
|
sit, cot, 0, 0,
|
||||||
0, 0, 1, 0
|
0, 0, 1, 0
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AffineTransform scale(double s) {
|
public AffineTransform scale(double s) {
|
||||||
@ -299,7 +311,7 @@ public class AffineTransform implements Transform, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AffineTransform scale(double sx, double sy, double sz) {
|
public AffineTransform scale(double sx, double sy, double sz) {
|
||||||
return concatenate(new AffineTransform(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0));
|
return concatenate(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AffineTransform scale(Vector3 vec) {
|
public AffineTransform scale(Vector3 vec) {
|
||||||
@ -352,9 +364,9 @@ public class AffineTransform implements Transform, Serializable {
|
|||||||
//FAWE start - check other identity
|
//FAWE start - check other identity
|
||||||
if (other instanceof Identity || other.isIdentity()) {
|
if (other instanceof Identity || other.isIdentity()) {
|
||||||
return this;
|
return this;
|
||||||
} else if (other instanceof AffineTransform) {
|
} else if (other instanceof AffineTransform otherTransform) {
|
||||||
//FAWE end
|
//FAWE end
|
||||||
return concatenate((AffineTransform) other);
|
return concatenate(otherTransform);
|
||||||
} else {
|
} else {
|
||||||
return new CombinedTransform(this, other);
|
return new CombinedTransform(this, other);
|
||||||
}
|
}
|
||||||
|
@ -178,10 +178,19 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
|||||||
String name = property.getName();
|
String name = property.getName();
|
||||||
|
|
||||||
charSequence.setSubstring(propStrStart + name.length() + 2, state.length() - 1);
|
charSequence.setSubstring(propStrStart + name.length() + 2, state.length() - 1);
|
||||||
|
try {
|
||||||
int index = charSequence.length() <= 0 ? -1 : property.getIndexFor(charSequence);
|
int index = charSequence.length() <= 0 ? -1 : property.getIndexFor(charSequence);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
return type.withPropertyId(index);
|
return type.withPropertyId(index);
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new InputParseException(Caption.of(
|
||||||
|
"fawe.error.invalid-block-state-property",
|
||||||
|
TextComponent.of(charSequence.toString()),
|
||||||
|
TextComponent.of(name),
|
||||||
|
TextComponent.of(state)
|
||||||
|
), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int stateId;
|
int stateId;
|
||||||
if (defaultState != null) {
|
if (defaultState != null) {
|
||||||
@ -200,7 +209,17 @@ public class BlockState implements BlockStateHolder<BlockState>, Pattern {
|
|||||||
case ',': {
|
case ',': {
|
||||||
charSequence.setSubstring(last, i);
|
charSequence.setSubstring(last, i);
|
||||||
if (property != null) {
|
if (property != null) {
|
||||||
int index = property.getIndexFor(charSequence);
|
int index;
|
||||||
|
try {
|
||||||
|
index = property.getIndexFor(charSequence);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new InputParseException(Caption.of(
|
||||||
|
"fawe.error.invalid-block-state-property",
|
||||||
|
TextComponent.of(charSequence.toString()),
|
||||||
|
TextComponent.of(property.getName()),
|
||||||
|
TextComponent.of(state)
|
||||||
|
), e);
|
||||||
|
}
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
throw SuggestInputParseException.of(charSequence.toString(), (List<Object>) property.getValues());
|
throw SuggestInputParseException.of(charSequence.toString(), (List<Object>) property.getValues());
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@
|
|||||||
"fawe.error.parser.invalid-data": "Invalid data: {0}",
|
"fawe.error.parser.invalid-data": "Invalid data: {0}",
|
||||||
"fawe.error.unsupported": "Unsupported!",
|
"fawe.error.unsupported": "Unsupported!",
|
||||||
"fawe.error.invalid-block-type": "Does not match a valid block type: {0}",
|
"fawe.error.invalid-block-type": "Does not match a valid block type: {0}",
|
||||||
|
"fawe.error.invalid-block-state-property": "Cannot parse value `{0}` for property `{1}`, block state: `{2}`",
|
||||||
"fawe.error.nbt.forbidden": "You are not allowed to use nbt. Lacking permission: {0}",
|
"fawe.error.nbt.forbidden": "You are not allowed to use nbt. Lacking permission: {0}",
|
||||||
"fawe.error.invalid-arguments": "Invalid amount of arguments. Expected: {0}",
|
"fawe.error.invalid-arguments": "Invalid amount of arguments. Expected: {0}",
|
||||||
"fawe.error.unrecognised-tag": "Unrecognised tag: {0} {1}",
|
"fawe.error.unrecognised-tag": "Unrecognised tag: {0} {1}",
|
||||||
@ -353,6 +354,7 @@
|
|||||||
"worldedit.schematic.unknown-format": "Unknown schematic format: {0}.",
|
"worldedit.schematic.unknown-format": "Unknown schematic format: {0}.",
|
||||||
"worldedit.schematic.load.does-not-exist": "Schematic {0} does not exist!",
|
"worldedit.schematic.load.does-not-exist": "Schematic {0} does not exist!",
|
||||||
"worldedit.schematic.load.loading": "(Please wait... loading schematic.)",
|
"worldedit.schematic.load.loading": "(Please wait... loading schematic.)",
|
||||||
|
"worldedit.schematic.load.unsupported-version": "This schematic is not supported. Version: {0}.",
|
||||||
"worldedit.schematic.save.already-exists": "That schematic already exists. Use the -f flag to overwrite it.",
|
"worldedit.schematic.save.already-exists": "That schematic already exists. Use the -f flag to overwrite it.",
|
||||||
"worldedit.schematic.save.failed-directory": "Could not create folder for schematics!",
|
"worldedit.schematic.save.failed-directory": "Could not create folder for schematics!",
|
||||||
"worldedit.schematic.save.saving": "(Please wait... saving schematic.)",
|
"worldedit.schematic.save.saving": "(Please wait... saving schematic.)",
|
||||||
|
@ -28,7 +28,7 @@ dependencies {
|
|||||||
})
|
})
|
||||||
api("org.apache.logging.log4j:log4j-api")
|
api("org.apache.logging.log4j:log4j-api")
|
||||||
api("org.bstats:bstats-sponge:1.7")
|
api("org.bstats:bstats-sponge:1.7")
|
||||||
testImplementation("org.mockito:mockito-core:5.8.0")
|
testImplementation("org.mockito:mockito-core:5.9.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren