This commit is contained in:
Aurora 2020-07-26 19:03:46 +02:00
commit b411ea9af4
608 changed files with 4704 additions and 3740 deletions

View File

@ -1,5 +1,5 @@
---
name: Bug / Issue report for FastAsyncWorldEdit v1.15.2
name: Bug / Issue report for FastAsyncWorldEdit v1.16.1
about: Bug / Issue report about this plugin
title: ''
labels: Requires Testing
@ -7,9 +7,9 @@ assignees: ''
---
# Bug report for FastAsyncWorldEdit 1.15.2
<!--- If you are using 1.13 or 1.14 consider updating to 1.15.2 before raising an issue -->
<!--- The priority lays on 1.15 right now, so issues reported for 1.13 or 1.14 will be fixed for the 1.15 versions -->
# Bug report for FastAsyncWorldEdit 1.16.1
<!--- If you are using 1.13 or 1.14 consider updating to 1.16.1 before raising an issue -->
<!--- The priority lays on 1.16 right now, so issues reported for 1.13 or 1.14 will be fixed for the 1.16 versions -->
<!--- In order to create a valid issue report you have to follow this template. -->
<!--- Remove this template if making a suggestion or asking a question. -->
<!--- Incomplete reports will most likely be marked as invalid, and closed, with few exceptions.-->
@ -41,5 +41,5 @@ assignees: ''
<!--- Make sure you've completed the following steps (put an "X" between of brackets): -->
- [] I included all information required in the sections above
- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/FastAsyncWorldEdit/issues?q=is%3Aissue)
- [] I made sure I am using an up-to-date version of [FastAsyncWorldEdit for 1.15.2](https://ci.athion.net/job/FastAsyncWorldEdit-1.15/)
- [] I made sure I am using an up-to-date version of [FastAsyncWorldEdit for 1.16.1](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/)
- [] I made sure the bug/error is not caused by any other plugin

View File

@ -16,4 +16,4 @@ You can do so here: https://github.com/IntellectualSites/FastAsyncWorldEdit/issu
- [] I included all information required in the sections above
- [] I tested my changes and approved their functionality
- [] I ensured my changes do not break other parts of the code
- [] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/FastAsyncWorldEdit/blob/1.15/CONTRIBUTING.md)
- [] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/FastAsyncWorldEdit/blob/1.16/CONTRIBUTING.md)

View File

@ -3,10 +3,10 @@ name: Java CI
on:
push:
branches:
- '1.15'
- '1.16'
pull_request:
branches:
- '1.15'
- '1.16'
jobs:
test:

18
NOTICE.txt Normal file
View File

@ -0,0 +1,18 @@
This project uses code from the following projects. In some cases the code used may be modified.
SnakeYAML
Copyright (c) 2008, http://www.snakeyaml.org
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -11,20 +11,15 @@ FAWE is a fork of WorldEdit that has huge speed and memory improvements and cons
* [Spigot Page](https://www.spigotmc.org/threads/fast-async-worldedit.100104/)
* [Discord](https://discord.gg/KxkjDVg)
* [Wiki](https://wiki.intellectualsites.com/FastAsyncWorldEdit/index)
* [Report Issue](https://github.com/IntellectualSites/FastAsyncWorldEdit-1.13/issues)
* [Report Issue](https://github.com/IntellectualSites/FastAsyncWorldEdit/issues)
* [Crowdin](https://intellectualsites.crowdin.com/fastasyncworldedit)
* [JavaDocs](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/javadoc/)
## Downloads
### 1.13+
### 1.14+
* [Download](https://intellectualsites.github.io/download/fawe.html)
* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/)
### < 1.12.2
* [Download](https://intellectualsites.github.io/download/fawe.html)
* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit/)
* [Repository](https://github.com/boy0001/FastAsyncWorldedit)
* [JavaDoc](https://ci.athion.net/job/FastAsyncWorldEdit/javadoc/)
## Building
FAWE uses gradle to build
@ -32,7 +27,7 @@ You can safely ignore `gradlew setupDecompWorkspace` if you are not planning to
```
$ gradlew setupDecompWorkspace
$ gradlew build
$ gradlew clean build -x test
```
The jar is located in `worldedit-bukkit/build/libs/FastAsyncWorldEdit-1.16-###.jar`

View File

@ -51,10 +51,10 @@ 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
extensions.getByName<Grgit>("grgit").head()?.abbreviatedId
} catch (e: Exception) {
logger.warn("Error getting commit hash", e)
"no_git_id"
"no.git.id"
}
}

View File

@ -30,9 +30,9 @@ 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"
"commons-io:commons-io:2.6",
"org.ow2.asm:asm:8.0.1",
"org.ow2.asm:asm-commons:8.0.1"
)
}
}
@ -48,13 +48,13 @@ val mixinVersion: String = properties.getProperty("mixin.version")
dependencies {
implementation(gradleApi())
implementation("gradle.plugin.net.minecrell:licenser:0.4.1")
implementation("org.ajoberstar.grgit:grgit-gradle:3.1.1")
implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
implementation("org.ajoberstar.grgit:grgit-gradle:4.0.2")
implementation("com.github.jengelman.gradle.plugins:shadow:5.2.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")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.16.0")
implementation("gradle.plugin.org.spongepowered:spongegradle:0.9.0")
implementation("net.minecraftforge.gradle:ForgeGradle:3.0.168")
implementation("net.minecraftforge.gradle:ForgeGradle:3.0.179")
implementation("net.fabricmc:fabric-loom:$loomVersion")
implementation("net.fabricmc:sponge-mixin:$mixinVersion")
implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0")

View File

@ -10,7 +10,7 @@ fun Project.applyCommonConfiguration() {
mavenLocal()
maven { url = uri("https://mvn.intellectualsites.com/content/groups/public/") }
maven { url = uri("https://plotsquared.com/mvn/") }
maven { url = uri("https://maven.sk89q.com/repo/") }
maven { url = uri("https://maven.enginehub.org/repo/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { url = uri("https://ci.athion.net/plugin/repository/tools/") }
maven { url = uri("https://repo.destroystokyo.com/repository/maven-public") }
@ -21,7 +21,7 @@ fun Project.applyCommonConfiguration() {
}
configurations.all {
resolutionStrategy {
cacheChangingModulesFor(5, "minutes")
cacheChangingModulesFor(5, "MINUTES")
}
}
}

View File

@ -22,7 +22,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
apply(plugin = "java")
apply(plugin = "idea")
apply(plugin = "maven")
//apply(plugin = "checkstyle")
// apply(plugin = "checkstyle")
apply(plugin = "com.github.johnrengelman.shadow")
ext["internalVersion"] = "$version;${rootProject.ext["gitCommitHash"]}"
@ -34,7 +34,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
// configure<CheckstyleExtension> {
// configFile = rootProject.file("config/checkstyle/checkstyle.xml")
// toolVersion = "7.6.1"
// toolVersion = "8.34"
// }
tasks.withType<Test>().configureEach {

View File

@ -3,7 +3,7 @@ import org.gradle.api.Project
object Versions {
const val TEXT = "3.0.4"
const val TEXT_EXTRAS = "3.0.5"
const val PISTON = "0.5.5"
const val PISTON = "0.5.6"
const val AUTO_VALUE = "1.7"
const val JUNIT = "5.6.1"
const val MOCKITO = "3.3.3"

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress files=".*DataFixer\.java" checks="MethodName|FallThrough"/>
<suppress files=".*[\\/]MathUtils.java" checks="MethodName"/>
<suppress files=".*[\\/]bPermissionsResolver.java" checks="TypeName"/>
<!-- This thing only works via the use of a finalizer. -->
<suppress files=".*[\\/]TracedEditSession.java" checks="NoFinalizer"/>
<!-- None of the old command stuff really matters -->
<suppress files=".*[\\/]minecraft[\\/]util[\\/]commands[\\/].*\.java" checks=".*"/>
</suppressions>

View File

@ -1,64 +1,189 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- Tabs are strictly banned -->
<module name="FileTabCharacter"/>
<module name="SuppressWarningsFilter" />
<module name="TreeWalker">
<module name="SuppressWarningsHolder" /> <!-- allows for @SuppressWarnings annotation -->
<!-- Important basics -->
<!-- <module name="PackageDeclaration"/> Unlikely that we would miss this in a PR -->
<module name="OuterTypeFilename"/> <!-- TypeName -> TypeName.java -->
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Control package usage, so people don't insert Bukkit into WE where it shouldn't belong, etc.
It is a bit draconian, so update as necessary!
-->
<!--
<module name="ImportControl">
<property name="file" value="${config_loc}/import-control.xml"/>
</module>
-->
Checks based on Google Checks, modified for EngineHub.
-->
<!-- Code -->
<module name="HideUtilityClassConstructor"/> <!-- Utility classes should not have a constructor -->
<module name="CovariantEquals"/>
<module name="EqualsHashCode"/> <!-- equals() and hashCode() go together -->
<module name="NestedTryDepth"> <!-- SHOULD not need to adjust this -->
<property name="max" value="2"/>
</module>
<module name="SuperFinalize"/> <!-- We don't actually use this -->
<module name="Checker">
<property name="charset" value="UTF-8"/>
<!-- Style -->
<module name="LeftCurly"> <!-- Left brace never goes on another line -->
<property name="option" value="eol"/>
</module> <!-- We don't check right brance -->
<module name="DefaultComesLast"/> <!-- default case in switch should be last -->
<module name="GenericWhitespace"/>
<property name="severity" value="error"/>
<!-- Naming -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z][a-zA-Z0-9]*$"/>
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName">
<property name="format" value="^[a-z_][a-zA-Z0-9]*$"/>
<module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(08|09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message" value="Avoid using corresponding octal or Unicode escape."/>
</module>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowEscapesForControlCharacters" value="true"/>
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="RightCurly">
<property name="option" value="alone"/>
<property name="tokens"
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
</module>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="WhitespaceAfter">
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. (4.1.3)"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="MissingSwitchDefault"/>
<module name="FallThrough">
<property name="reliefPattern" value="FALL-THROUGH|falls?[ -]?thr(u|ough)"/>
</module>
<module name="UpperEll"/>
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
<message key="name.invalidPattern"
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z_][a-zA-Z0-9]*$"/>
<property name="format" value="^([a-z][_a-zA-Z0-9]+|[xyz])$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^([a-z][a-z0-9][_a-zA-Z0-9]*|[a-z])$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ClassTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|(^[A-Z][a-zA-Z0-9]*$)"/>
<message key="name.invalidPattern"
value="Class type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="(^[A-Z][0-9]?)$|(^[A-Z][a-zA-Z0-9]*$)"/>
<message key="name.invalidPattern"
value="Method type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="Regexp">
<property name="format" value="[ \t]+$"/>
<property name="illegalPattern" value="true"/>
<property name="message" value="Trailing whitespace"/>
</module>
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="4"/>
</module>
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="customImportOrderRules" value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###STATIC"/>
</module>
<module name="MethodParamPad"/>
<module name="OperatorWrap">
<property name="option" value="NL"/>
<property name="tokens"
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
</module>
<module name="AnnotationLocation">
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>
<module name="AnnotationLocation">
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation"/>
<module name="SummaryJavadocCheck">
<property name="forbiddenSummaryFragments"
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
</module>
<module name="JavadocParagraph"/>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<!-- No javadoc for now -->
<!--<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="minLineCount" value="2"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="allowThrowsTagsForSubclasses" value="true"/>
</module>-->
<module name="MethodName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<!-- <module name="PackageName"/> Unlikely that we would miss this in a PR -->
<module name="ParameterName"/>
<!-- <module name="TypeName"/> Unlikely that we would miss this in a PR -->
<!-- Validate assignment operators -->
<module name="WhitespaceAround">
<property name="tokens" value="ASSIGN"/>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected|ignored"/>
</module>
<module name="CommentsIndentation"/>
<!-- Validate String.to(Lower|Upper)Case() calls include Locale argument -->
<module name="Regexp">
<property name="message" value="Case-conversion calls must include an explicit Locale"/>
@ -70,4 +195,7 @@
<module name="RegexpMultiline">
<property name="format" value="^( +)@(Arg|Switch|Command)\(.*?\r?\n\1 {5,}"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/checkstyle-suppression.xml"/>
</module>
</module>

View File

@ -1,101 +0,0 @@
<!DOCTYPE import-control PUBLIC
"-//Puppy Crawl//DTD Import Control 1.1//EN"
"http://checkstyle.sourceforge.net/dtds/import_control_1_1.dtd">
<import-control pkg="com.sk89q">
<allow pkg="java"/>
<allow pkg="javax"/>
<allow pkg="org.junit"/>
<allow pkg="org.hamcrest"/>
<allow pkg="org.mockito"/>
<allow pkg="com.sk89q"/>
<allow pkg="com.boydti"/>
<allow pkg="com.google.common"/>
<allow pkg="com.thoughtworks.paranamer"/>
<allow pkg="gnu.trove"/>
<allow pkg="com.google.gson"/>
<allow pkg="net.royawesome.jlibnoise"/>
<allow pkg="org.json.simple" />
<allow pkg="org.slf4j"/>
<allow pkg="org.enginehub"/>
<subpackage name="util.yaml">
<allow pkg="org.yaml.snakeyaml"/>
</subpackage>
<subpackage name="bukkit">
<allow pkg="org.bukkit"/>
</subpackage>
<subpackage name="wepif">
<allow pkg="org.bukkit"/>
<allow pkg="de.bananaco"/>
<allow pkg="org.anjocaido"/>
<allow pkg="com.nijiko"/>
<allow pkg="com.nijikokun"/>
<allow pkg="ru.tehkode"/>
<allow pkg="net.milkbowl"/>
</subpackage>
<subpackage name="worldedit">
<allow pkg="org.mozilla.javascript"/>
<allow pkg="de.schlichtherle"/>
<allow pkg="com.google.auto"/>
<allow pkg="it.unimi.dsi.fastutil"/>
<subpackage name="util.io.file">
<allow pkg="net.java.truevfs"/>
</subpackage>
<subpackage name="internal.expression">
<allow pkg="org.antlr.v4"/>
</subpackage>
<subpackage name="bukkit">
<allow pkg="org.bukkit"/>
<allow pkg="org.bstats.bukkit"/>
<allow pkg="io.papermc.lib"/>
</subpackage>
<subpackage name="cli">
<allow pkg="org.apache.logging.log4j"/>
<allow pkg="org.apache.commons.cli" />
</subpackage>
<subpackage name="forge">
<allow pkg="cpw"/>
<allow pkg="net.minecraft"/>
<allow pkg="net.minecraftforge"/>
<allow pkg="com.mojang.authlib"/>
<allow pkg="org.apache.logging.log4j"/>
<allow pkg="org.lwjgl"/>
<allow pkg="io.netty.buffer"/>
<allow pkg="org.spongepowered.api" />
<allow pkg="com.mojang.brigadier" />
<allow pkg="com.mojang.datafixers" />
<allow pkg="org.apache.commons" />
</subpackage>
<subpackage name="fabric">
<allow pkg="net.minecraft"/>
<allow pkg="net.fabricmc"/>
<allow pkg="com.mojang.authlib"/>
<allow pkg="org.apache.logging.log4j"/>
<allow pkg="org.lwjgl"/>
<allow pkg="io.netty.buffer"/>
<allow pkg="org.spongepowered" />
<allow pkg="com.mojang.brigadier" />
<allow pkg="com.mojang.datafixers" />
</subpackage>
<subpackage name="sponge">
<allow pkg="net.minecraft"/>
<allow pkg="com.google.inject" />
<allow pkg="com.flowpowered.math" />
<allow pkg="org.spongepowered.api" />
<allow pkg="org.slf4j" />
<allow pkg="org.bstats.sponge"/>
<allow pkg="ninja.leaping.configurate" />
</subpackage>
</subpackage>
</import-control>

View File

@ -29,12 +29,6 @@ import com.boydti.fawe.util.image.ImageViewer;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitPlayer;
import io.papermc.lib.PaperLib;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.UUID;
import java.util.function.Supplier;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -47,6 +41,13 @@ import org.bukkit.plugin.PluginManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.UUID;
import java.util.function.Supplier;
public class FaweBukkit implements IFawe, Listener {
private static final Logger log = LoggerFactory.getLogger(FaweBukkit.class);
@ -83,7 +84,8 @@ public class FaweBukkit implements IFawe, Listener {
Bukkit.getServer().shutdown();
}
chunksStretched = Integer.parseInt(Bukkit.getBukkitVersion().split("-")[0].split("\\.")[1]) >= 16;
chunksStretched =
Integer.parseInt(Bukkit.getBukkitVersion().split("-")[0].split("\\.")[1]) >= 16;
//Vault is Spigot/Paper only so this needs to be done in the Bukkit module
setupVault();
@ -94,7 +96,8 @@ public class FaweBukkit implements IFawe, Listener {
// Registered delayed Event Listeners
TaskManager.IMP.task(() -> {
// Fix for ProtocolSupport
Settings.IMP.PROTOCOL_SUPPORT_FIX = Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
Settings.IMP.PROTOCOL_SUPPORT_FIX =
Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
// This class
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
@ -112,28 +115,31 @@ public class FaweBukkit implements IFawe, Listener {
}
}
@Override
public QueueHandler getQueueHandler() {
@Override public QueueHandler getQueueHandler() {
return new BukkitQueueHandler();
}
@Override
public synchronized ImageViewer getImageViewer(com.sk89q.worldedit.entity.Player player) {
if (listeningImages && imageListener == null) return null;
if (listeningImages && imageListener == null) {
return null;
}
try {
listeningImages = true;
registerPacketListener();
PluginManager manager = Bukkit.getPluginManager();
if (manager.getPlugin("PacketListenerApi") == null) {
File output = new File(plugin.getDataFolder().getParentFile(), "PacketListenerAPI_v3.7.6-SNAPSHOT.jar");
File output = new File(plugin.getDataFolder().getParentFile(),
"PacketListenerAPI_v3.7.6-SNAPSHOT.jar");
byte[] jarData = Jars.PL_v3_7_6.download();
try (FileOutputStream fos = new FileOutputStream(output)) {
fos.write(jarData);
}
}
if (manager.getPlugin("MapManager") == null) {
File output = new File(plugin.getDataFolder().getParentFile(), "MapManager_v1.7.8-SNAPSHOT.jar");
File output = new File(plugin.getDataFolder().getParentFile(),
"MapManager_v1.7.8-SNAPSHOT.jar");
byte[] jarData = Jars.MM_v1_7_8.download();
try (FileOutputStream fos = new FileOutputStream(output)) {
fos.write(jarData);
@ -144,17 +150,16 @@ public class FaweBukkit implements IFawe, Listener {
this.imageListener = new BukkitImageListener(plugin);
}
return viewer;
} catch (Throwable ignore) {}
} catch (Throwable ignore) {
}
return null;
}
@Override
public void debug(final String message) {
@Override public void debug(final String message) {
Bukkit.getConsoleSender().sendMessage(message);
}
@Override
public File getDirectory() {
@Override public File getDirectory() {
return plugin.getDataFolder();
}
@ -172,9 +177,6 @@ public class FaweBukkit implements IFawe, Listener {
return tmp;
}
/**
* Vault isn't required, but used for setting player permissions (WorldEdit bypass)
*/
private void setupVault() {
try {
this.vault = new VaultUtil();
@ -182,8 +184,7 @@ public class FaweBukkit implements IFawe, Listener {
}
}
@Override
public String getDebugInfo() {
@Override public String getDebugInfo() {
StringBuilder msg = new StringBuilder();
msg.append("Server Version: ").append(Bukkit.getVersion()).append("\n");
msg.append("Plugins: \n");
@ -195,10 +196,9 @@ public class FaweBukkit implements IFawe, Listener {
}
/**
* The task manager handles sync/async tasks
* The task manager handles sync/async tasks.
*/
@Override
public TaskManager getTaskManager() {
@Override public TaskManager getTaskManager() {
return new BukkitTaskMan(plugin);
}
@ -209,9 +209,9 @@ public class FaweBukkit implements IFawe, Listener {
/**
* A mask manager handles region restrictions e.g., PlotSquared plots / WorldGuard regions
*/
@Override
public Collection<FaweMaskManager> getMaskManagers() {
final Plugin worldguardPlugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
@Override public Collection<FaweMaskManager> getMaskManagers() {
final Plugin worldguardPlugin =
Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
final ArrayList<FaweMaskManager> managers = new ArrayList<>();
if (worldguardPlugin != null && worldguardPlugin.isEnabled()) {
try {
@ -236,7 +236,8 @@ public class FaweBukkit implements IFawe, Listener {
} catch (Throwable ignored) {
}
}
final Plugin griefpreventionPlugin = Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
final Plugin griefpreventionPlugin =
Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
try {
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
@ -258,8 +259,7 @@ public class FaweBukkit implements IFawe, Listener {
private volatile boolean keepUnloaded;
@EventHandler(priority = EventPriority.MONITOR)
public void onWorldLoad(WorldLoadEvent event) {
@EventHandler(priority = EventPriority.MONITOR) public void onWorldLoad(WorldLoadEvent event) {
if (keepUnloaded) {
org.bukkit.World world = event.getWorld();
world.setKeepSpawnInMemory(false);
@ -282,38 +282,34 @@ public class FaweBukkit implements IFawe, Listener {
wePlayer.unregister();
}
@Override
public String getPlatform() {
@Override public String getPlatform() {
return "Bukkit";
}
@Override
public UUID getUUID(String name) {
@Override public UUID getUUID(String name) {
return Bukkit.getOfflinePlayer(name).getUniqueId();
}
@Override
public String getName(UUID uuid) {
@Override public String getName(UUID uuid) {
return Bukkit.getOfflinePlayer(uuid).getName();
}
@Override
public Preloader getPreloader() {
@Override public Preloader getPreloader() {
if (PaperLib.isPaper()) {
return new AsyncPreloader();
}
return null;
}
@Override
public boolean isChunksStretched() {
@Override public boolean isChunksStretched() {
return chunksStretched;
}
private void setupPlotSquared() {
Plugin plotSquared = this.plugin.getServer().getPluginManager().getPlugin("PlotSquared");
if (plotSquared == null)
if (plotSquared == null) {
return;
}
if (plotSquared.getClass().getPackage().toString().contains("intellectualsites")) {
WEManager.IMP.managers
.add(new com.boydti.fawe.bukkit.regions.plotsquaredv4.PlotSquaredFeature());

View File

@ -1,7 +1,5 @@
package com.boydti.fawe.bukkit.adapter.mc1_14;
import static org.slf4j.LoggerFactory.getLogger;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkSet;
@ -28,21 +26,6 @@ import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.AbstractSet;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import net.minecraft.server.v1_14_R1.BiomeBase;
import net.minecraft.server.v1_14_R1.BlockPosition;
import net.minecraft.server.v1_14_R1.Chunk;
@ -72,6 +55,25 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.AbstractSet;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import static org.slf4j.LoggerFactory.getLogger;
@SuppressWarnings("checkstyle:TypeName")
public class BukkitGetBlocks_1_14 extends CharGetBlocks {
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_14.class);
@ -79,26 +81,27 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
public ChunkSection[] sections;
public Chunk nmsChunk;
public WorldServer world;
public int X, Z;
public int chunkX;
public int chunkZ;
public NibbleArray[] blockLight = new NibbleArray[16];
public NibbleArray[] skyLight = new NibbleArray[16];
public BukkitGetBlocks_1_14(World world, int X, int Z) {
this(((CraftWorld) world).getHandle(), X, Z);
public BukkitGetBlocks_1_14(World world, int chunkX, int chunkZ) {
this(((CraftWorld) world).getHandle(), chunkX, chunkZ);
}
public BukkitGetBlocks_1_14(WorldServer world, int X, int Z) {
public BukkitGetBlocks_1_14(WorldServer world, int chunkX, int chunkZ) {
this.world = world;
this.X = X;
this.Z = Z;
this.chunkX = chunkX;
this.chunkZ = chunkZ;
}
public int getX() {
return X;
return chunkX;
}
public int getZ() {
return Z;
return chunkZ;
}
@Override
@ -109,16 +112,21 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
@Override
public CompoundTag getTile(int x, int y, int z) {
TileEntity tileEntity = getChunk().getTileEntity(new BlockPosition((x & 15) + (X << 4), y, (z & 15) + (Z << 4)));
TileEntity tileEntity = getChunk().getTileEntity(
new BlockPosition((x & 15) + (chunkX << 4), y, (z & 15) + (chunkZ << 4)));
if (tileEntity == null) {
return null;
}
return new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
return new LazyCompoundTag_1_14(
Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
}
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
private static final Function<BlockPosition, BlockVector3> posNms2We =
v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
private final static Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_14(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
private static final Function<TileEntity, CompoundTag> nmsTile2We =
tileEntity -> new LazyCompoundTag_1_14(
Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
@Override
public Map<BlockVector3, CompoundTag> getTiles() {
@ -135,19 +143,23 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
if (skyLight[layer] == null) {
//getDataLayerData
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition);
NibbleArray nibbleArray =
world.getChunkProvider().getLightEngine().a(EnumSkyBlock.SKY).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) {
byte[] a = new byte[2048];
// Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
Arrays.fill(a, (byte) 15);
nibbleArray = new NibbleArray(a);
((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.SKY, sectionPosition, nibbleArray);
((LightEngine) world.getChunkProvider().getLightEngine())
.a(EnumSkyBlock.SKY, sectionPosition, nibbleArray);
}
skyLight[layer] = nibbleArray;
}
long l = BlockPosition.a(x, y, z);
return skyLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
return skyLight[layer]
.a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)),
SectionPosition.b(BlockPosition.d(l)));
}
@Override
@ -156,19 +168,23 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
if (blockLight[layer] == null) {
//getDataLayerData
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
NibbleArray nibbleArray =
world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null
if (nibbleArray == null) {
byte[] a = new byte[2048];
// Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway.
Arrays.fill(a, (byte) 15);
nibbleArray = new NibbleArray(a);
((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.BLOCK, sectionPosition, nibbleArray);
((LightEngine) world.getChunkProvider().getLightEngine())
.a(EnumSkyBlock.BLOCK, sectionPosition, nibbleArray);
}
blockLight[layer] = nibbleArray;
}
long l = BlockPosition.a(x, y, z);
return blockLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
return blockLight[layer]
.a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)),
SectionPosition.b(BlockPosition.d(l)));
}
@Override
@ -196,7 +212,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
List<Entity>[] slices = getChunk().getEntitySlices();
int size = 0;
for (List<Entity> slice : slices) {
if (slice != null) size += slice.size();
if (slice != null) {
size += slice.size();
}
}
if (slices.length == 0) {
return Collections.emptySet();
@ -238,10 +256,11 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
@NotNull
@Override
public Iterator<CompoundTag> iterator() {
Iterable<CompoundTag> result = StreamSupport
.stream(Iterables.concat(slices).spliterator(), false).map(input -> {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance()
.getBukkitImplAdapter();
Iterable<CompoundTag> result =
StreamSupport.stream(Iterables.concat(slices).spliterator(), false)
.map(input -> {
BukkitImplAdapter adapter =
WorldEditPlugin.getInstance().getBukkitImplAdapter();
NBTTagCompound tag = new NBTTagCompound();
return (CompoundTag) adapter.toNative(input.save(tag));
}).collect(Collectors.toList());
@ -250,7 +269,8 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
};
}
private void updateGet(BukkitGetBlocks_1_14 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) {
private void updateGet(BukkitGetBlocks_1_14 get, Chunk nmsChunk, ChunkSection[] sections,
ChunkSection section, char[] arr, int layer) {
synchronized (get) {
if (this.nmsChunk != nmsChunk) {
this.nmsChunk = nmsChunk;
@ -271,15 +291,16 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
entity.die();
}
public Chunk ensureLoaded(net.minecraft.server.v1_14_R1.World nmsWorld, int X, int Z) {
return BukkitAdapter_1_14.ensureLoaded(nmsWorld, X, Z);
public Chunk ensureLoaded(net.minecraft.server.v1_14_R1.World nmsWorld, int chunkX,
int chunkZ) {
return BukkitAdapter_1_14.ensureLoaded(nmsWorld, chunkX, chunkZ);
}
@Override
public <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) {
try {
WorldServer nmsWorld = world;
Chunk nmsChunk = ensureLoaded(nmsWorld, X, Z);
Chunk nmsChunk = ensureLoaded(nmsWorld, chunkX, chunkZ);
boolean fastmode = set.isFastMode() && Settings.IMP.QUEUE.NO_TICK_FASTMODE;
// Remove existing tiles
@ -308,7 +329,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
ChunkSection[] sections = nmsChunk.getSections();
for (int layer = 0; layer < 16; layer++) {
if (!set.hasSection(layer)) continue;
if (!set.hasSection(layer)) {
continue;
}
bitMask |= 1 << layer;
@ -317,13 +340,16 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
ChunkSection existingSection = sections[layer];
if (existingSection == null) {
newSection = BukkitAdapter_1_14.newChunkSection(layer, setArr, fastmode);
if (BukkitAdapter_1_14.setSectionAtomic(sections, null, newSection, layer)) {
if (BukkitAdapter_1_14
.setSectionAtomic(sections, null, newSection, layer)) {
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
continue;
} else {
existingSection = sections[layer];
if (existingSection == null) {
log.error("Skipping invalid null section. chunk:" + X + "," + Z + " layer: " + layer);
log.error(
"Skipping invalid null section. chunk:" + chunkX + "," + chunkZ
+ " layer: " + layer);
continue;
}
}
@ -348,9 +374,12 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
} else if (lock.isModified()) {
this.reset(layer);
}
newSection = BukkitAdapter_1_14.newChunkSection(layer, this::load, setArr, fastmode);
if (!BukkitAdapter_1_14.setSectionAtomic(sections, existingSection, newSection, layer)) {
log.error("Failed to set chunk section:" + X + "," + Z + " layer: " + layer);
newSection = BukkitAdapter_1_14
.newChunkSection(layer, this::load, setArr, fastmode);
if (!BukkitAdapter_1_14
.setSectionAtomic(sections, existingSection, newSection, layer)) {
log.error("Failed to set chunk section:" + chunkX + "," + chunkZ
+ " layer: " + layer);
continue;
} else {
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
@ -398,12 +427,14 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
Runnable[] syncTasks = null;
int bx = X << 4;
int bz = Z << 4;
int bx = chunkX << 4;
int bz = chunkZ << 4;
Set<UUID> entityRemoves = set.getEntityRemoves();
if (entityRemoves != null && !entityRemoves.isEmpty()) {
if (syncTasks == null) syncTasks = new Runnable[3];
if (syncTasks == null) {
syncTasks = new Runnable[3];
}
syncTasks[2] = () -> {
final List<Entity>[] entities = nmsChunk.getEntitySlices();
@ -425,7 +456,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
Set<CompoundTag> entities = set.getEntities();
if (entities != null && !entities.isEmpty()) {
if (syncTasks == null) syncTasks = new Runnable[2];
if (syncTasks == null) {
syncTasks = new Runnable[2];
}
syncTasks[1] = () -> {
for (final CompoundTag nativeTag : entities) {
@ -434,7 +467,8 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
if (idTag == null || posTag == null || rotTag == null) {
getLogger(BukkitGetBlocks_1_14.class).debug("Unknown entity tag: " + nativeTag);
getLogger(BukkitGetBlocks_1_14.class)
.debug("Unknown entity tag: " + nativeTag);
continue;
}
final double x = posTag.getDouble(0);
@ -455,7 +489,8 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
}
entity.f(tag);
entity.setLocation(x, y, z, yaw, pitch);
nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM);
nmsWorld
.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM);
}
}
}
@ -466,7 +501,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
// set tiles
Map<BlockVector3, CompoundTag> tiles = set.getTiles();
if (tiles != null && !tiles.isEmpty()) {
if (syncTasks == null) syncTasks = new Runnable[1];
if (syncTasks == null) {
syncTasks = new Runnable[1];
}
syncTasks[0] = () -> {
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
@ -484,8 +521,10 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
tileEntity = nmsWorld.getTileEntity(pos);
}
if (tileEntity != null) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag);
BukkitImplAdapter adapter =
WorldEditPlugin.getInstance().getBukkitImplAdapter();
final NBTTagCompound tag =
(NBTTagCompound) adapter.fromNative(nativeTag);
tag.set("x", new NBTTagInt(x));
tag.set("y", new NBTTagInt(y));
tag.set("z", new NBTTagInt(z));
@ -508,8 +547,11 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
nmsChunk.mustNotSave = false;
nmsChunk.markDirty();
// send to player
BukkitAdapter_1_14.sendChunk(nmsWorld, X, Z, finalMask, finalLightUpdate);
if (finalizer != null) finalizer.run();
BukkitAdapter_1_14
.sendChunk(nmsWorld, chunkX, chunkZ, finalMask, finalLightUpdate);
if (finalizer != null) {
finalizer.run();
}
};
}
if (syncTasks != null) {
@ -526,7 +568,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
}
}
if (callback == null) {
if (finalizer != null) finalizer.run();
if (finalizer != null) {
finalizer.run();
}
return null;
} else {
return queueHandler.async(callback, null);
@ -539,7 +583,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
return (T) (Future) queueHandler.sync(chain);
} else {
if (callback == null) {
if (finalizer != null) finalizer.run();
if (finalizer != null) {
finalizer.run();
}
} else {
callback.run();
}
@ -571,11 +617,13 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
lock.setModified(false);
// Efficiently convert ChunkSection to raw data
try {
FAWE_Spigot_v1_14_R4 adapter = ((FAWE_Spigot_v1_14_R4) WorldEditPlugin.getInstance().getBukkitImplAdapter());
FAWE_Spigot_v1_14_R4 adapter =
((FAWE_Spigot_v1_14_R4) WorldEditPlugin.getInstance().getBukkitImplAdapter());
final DataPaletteBlock<IBlockData> blocks = section.getBlocks();
final DataBits bits = (DataBits) BukkitAdapter_1_14.fieldBits.get(blocks);
final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_14.fieldPalette.get(blocks);
final DataPalette<IBlockData> palette =
(DataPalette<IBlockData>) BukkitAdapter_1_14.fieldPalette.get(blocks);
final int bitsPerEntry = bits.c();
final long[] blockStates = bits.a();
@ -689,7 +737,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
synchronized (this) {
tmp = nmsChunk;
if (tmp == null) {
nmsChunk = tmp = ensureLoaded(this.world, X, Z);
nmsChunk = tmp = ensureLoaded(this.world, chunkX, chunkZ);
}
}
}
@ -702,12 +750,14 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
continue;
}
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), Y);
NibbleArray nibble = world.getChunkProvider().getLightEngine().a(skyBlock).a(sectionPosition);
NibbleArray nibble =
world.getChunkProvider().getLightEngine().a(skyBlock).a(sectionPosition);
if (nibble == null) {
byte[] a = new byte[2048];
Arrays.fill(a, skyBlock == EnumSkyBlock.SKY ? (byte) 15 : (byte) 0);
nibble = new NibbleArray(a);
((LightEngine) world.getChunkProvider().getLightEngine()).a(skyBlock, sectionPosition, nibble);
((LightEngine) world.getChunkProvider().getLightEngine())
.a(skyBlock, sectionPosition, nibble);
}
synchronized (nibble) {
for (int i = 0; i < 4096; i++) {
@ -739,7 +789,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
try {
final DataPaletteBlock<IBlockData> blocksExisting = existing.getBlocks();
final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_14.fieldPalette.get(blocksExisting);
final DataPalette<IBlockData> palette =
(DataPalette<IBlockData>) BukkitAdapter_1_14.fieldPalette
.get(blocksExisting);
int paletteSize;
if (palette instanceof DataPaletteLinear) {

View File

@ -105,8 +105,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
return AdaptedMap.immutable(nmsTiles, posNms2We, nmsTile2We);
}
@Override
public int getSkyLight(int x, int y, int z) {
@Override public int getSkyLight(int x, int y, int z) {
int layer = y >> 4;
if (skyLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
@ -125,10 +124,9 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
return skyLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));
}
@Override
public int getEmmittedLight(int x, int y, int z) {
@Override public int getEmmittedLight(int x, int y, int z) {
int layer = y >> 4;
if (skyLight[layer] == null) {
if (blockLight[layer] == null) {
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
NibbleArray nibbleArray = world.getChunkProvider().getLightEngine().a(EnumSkyBlock.BLOCK).a(sectionPosition);
// If the server hasn't generated the section's NibbleArray yet, it will be null
@ -139,7 +137,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
nibbleArray = new NibbleArray(a);
((LightEngine) world.getChunkProvider().getLightEngine()).a(EnumSkyBlock.BLOCK, sectionPosition, nibbleArray, true);
}
skyLight[layer] = nibbleArray;
blockLight[layer] = nibbleArray;
}
long l = BlockPosition.a(x, y, z);
return blockLight[layer].a(SectionPosition.b(BlockPosition.b(l)), SectionPosition.b(BlockPosition.c(l)), SectionPosition.b(BlockPosition.d(l)));

View File

@ -16,6 +16,7 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEdit;
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.io.ClipboardFormats;
import com.sk89q.worldedit.function.FlatRegionFunction;
@ -24,6 +25,7 @@ import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.visitor.FlatRegionVisitor;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
@ -41,7 +43,7 @@ import static org.bukkit.Bukkit.getWorld;
public class FaweRegionManager extends RegionManager {
private RegionManager parent;
private final RegionManager parent;
public FaweRegionManager(RegionManager parent) {
this.parent = parent;
@ -59,6 +61,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean setCuboids(final PlotArea area, final Set<CuboidRegion> regions, final Pattern blocks, final int minY, final int maxY) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.CUBOIDS) {
return parent.setCuboids(area, regions, blocks, minY, maxY);
}
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
World world = BukkitAdapter.adapt(getWorld(area.getWorldName()));
@ -80,7 +85,7 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean notifyClear(PlotManager manager) {
if (!(manager instanceof HybridPlotManager)) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.CLEAR || !(manager instanceof HybridPlotManager)) {
return false;
}
final HybridPlotWorld hpw = ((HybridPlotManager) manager).getHybridPlotWorld();
@ -89,7 +94,7 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean handleClear(final Plot plot, final Runnable whenDone, final PlotManager manager) {
if (!(manager instanceof HybridPlotManager)) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.CLEAR || !(manager instanceof HybridPlotManager)) {
return false;
}
TaskManager.IMP.async(() -> {
@ -108,21 +113,29 @@ public class FaweRegionManager extends RegionManager {
final Pattern filling = hybridPlotWorld.MAIN_BLOCK.toPattern();
final Pattern plotfloor = hybridPlotWorld.TOP_BLOCK.toPattern();
final BiomeType biome = hybridPlotWorld.getPlotBiome();
BlockVector3 pos1 = plot.getBottomAbs().getBlockVector3();
BlockVector3 pos2 = plot.getExtendedTopAbs().getBlockVector3();
BlockVector3 pos1 = BlockVector3.ZERO;
BlockVector3 pos2 = BlockVector3.at(hybridPlotWorld.PLOT_WIDTH - 1, 255, hybridPlotWorld.PLOT_WIDTH - 1);
Region bedrockRegion = new CuboidRegion(pos1.withY(0), pos2.withY(0));
Region bedrockRegion = new CuboidRegion(pos1, pos2.withY(0));
Region fillingRegion = new CuboidRegion(pos1.withY(1), pos2.withY(hybridPlotWorld.PLOT_HEIGHT - 1));
Region floorRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT),
pos2.withY(hybridPlotWorld.PLOT_HEIGHT));
Region airRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1),
pos2.withY(manager.getWorldHeight()));
Region floorRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT), pos2.withY(hybridPlotWorld.PLOT_HEIGHT));
Region airRegion = new CuboidRegion(pos1.withY(hybridPlotWorld.PLOT_HEIGHT + 1), pos2.withY(manager.getWorldHeight()));
editSession.setBlocks(bedrockRegion, bedrock);
editSession.setBlocks(fillingRegion, filling);
editSession.setBlocks(floorRegion, plotfloor);
editSession.setBlocks(airRegion, air);
Clipboard clipboard = new BlockArrayClipboard(new CuboidRegion(pos1, pos2));
clipboard.setBlocks(bedrockRegion, bedrock);
clipboard.setBlocks(fillingRegion, filling);
clipboard.setBlocks(floorRegion, plotfloor);
clipboard.setBlocks(airRegion, air);
for (int x = pos1.getX(); x <= pos2.getX(); x ++) {
for (int z = pos1.getZ(); z <= pos2.getZ(); z ++) {
clipboard.setBiome(BlockVector2.at(x, z), biome);
}
}
clipboard.paste(editSession, plot.getBottomAbs().getBlockVector3().withY(0), true, false, true);
}
if (hybridPlotWorld.PLOT_SCHEMATIC) {
@ -149,13 +162,15 @@ public class FaweRegionManager extends RegionManager {
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
parent.swap(pos1, pos2, pos3, pos4, whenDone);
}
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
//todo because of the following code this should proably be in the Bukkit module
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
WorldEdit.getInstance().getEditSessionFactory().getEditSession(
pos1World,-1);
WorldEdit.getInstance().getEditSessionFactory().getEditSession(pos1World,-1);
EditSession sessionA = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
EditSession sessionB = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
CuboidRegion regionA = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
@ -177,6 +192,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, String world, Runnable whenDone) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.SET_BIOME) {
parent.setBiome(region, extendBiome, biome, world, whenDone);
}
region.expand(BlockVector3.at(extendBiome, 0, extendBiome));
region.expand(BlockVector3.at(-extendBiome, 0, -extendBiome));
TaskManager.IMP.async(() -> {
@ -197,6 +215,9 @@ public class FaweRegionManager extends RegionManager {
@Override
public boolean copyRegion(final Location pos1, final Location pos2, final Location pos3, final Runnable whenDone) {
if (!com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
return parent.copyRegion(pos1, pos2, pos3, whenDone);
}
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
@ -222,11 +243,8 @@ public class FaweRegionManager extends RegionManager {
TaskManager.IMP.async(() -> {
synchronized (FaweRegionManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
try (EditSession editSession = new EditSessionBuilder(pos1World).checkMemory(false)
.fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
CuboidRegion region = new CuboidRegion(
BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()),
BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
try (EditSession editSession = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build()) {
CuboidRegion region = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
editSession.regenerate(region);
editSession.flushQueue();
}

View File

@ -39,7 +39,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() {
super("PlotSquared");
log.debug("Optimizing PlotSquared");
if (com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_HOOK) {
if (com.boydti.fawe.config.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try {
setupBlockQueue();

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.bukkit.regions.plotsquaredv4;
import static org.bukkit.Bukkit.getWorld;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.util.EditSessionBuilder;
import com.boydti.fawe.util.TaskManager;
import com.github.intellectualsites.plotsquared.plot.object.Location;
@ -49,6 +50,9 @@ public class FaweChunkManager extends ChunkManager {
@Override
public void swap(final Location pos1, final Location pos2, final Location pos3, final Location pos4, final Runnable whenDone) {
if (!Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
parent.swap(pos1, pos2, pos3, pos4, whenDone);
}
TaskManager.IMP.async(() -> {
synchronized (FaweChunkManager.class) {
//todo because of the following code this should proably be in the Bukkit module
@ -77,6 +81,9 @@ public class FaweChunkManager extends ChunkManager {
@Override
public boolean copyRegion(final Location pos1, final Location pos2, final Location pos3, final Runnable whenDone) {
if (!Settings.IMP.PLOTSQUARED_INTEGRATION.COPY_AND_SWAP) {
return parent.copyRegion(pos1, pos2, pos3, whenDone);
}
TaskManager.IMP.async(() -> {
synchronized (FaweChunkManager.class) {
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));

View File

@ -41,7 +41,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
public PlotSquaredFeature() {
super("PlotSquared");
log.debug("Optimizing PlotSquared");
if (com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_HOOK) {
if (com.boydti.fawe.config.Settings.IMP.ENABLED_COMPONENTS.PLOTSQUARED_HOOK) {
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
try {
setupBlockQueue();

View File

@ -8,16 +8,16 @@ import java.lang.reflect.Method;
public class BukkitReflectionUtils {
/**
* prefix of bukkit classes
* Prefix of Bukkit classes.
*/
private static volatile String preClassB = null;
/**
* prefix of minecraft classes
* Prefix of Minecraft classes.
*/
private static volatile String preClassM = null;
/**
* check server version and class names
* Check server version and class names.
*/
public static void init() {
final Server server = Bukkit.getServer();
@ -50,18 +50,22 @@ public class BukkitReflectionUtils {
* @return RefClass object
* @throws RuntimeException if no class found
*/
public static ReflectionUtils.RefClass getRefClass(final String... classes) throws RuntimeException {
public static ReflectionUtils.RefClass getRefClass(final String... classes)
throws RuntimeException {
if (preClassM == null) {
init();
}
for (String className : classes) {
try {
className = className.replace("{cb}", preClassB).replace("{nms}", preClassM).replace("{nm}", "net.minecraft");
className = className.replace("{cb}", preClassB).replace("{nms}", preClassM)
.replace("{nm}", "net.minecraft");
return ReflectionUtils.getRefClass(Class.forName(className));
} catch (final ClassNotFoundException ignored) {
}
}
throw new RuntimeException("no class found: " + classes[0].replace("{cb}", preClassB).replace("{nms}", preClassM).replace("{nm}", "net.minecraft"));
throw new RuntimeException(
"no class found: " + classes[0].replace("{cb}", preClassB).replace("{nms}", preClassM)
.replace("{nm}", "net.minecraft"));
}
public static Class<?> getNmsClass(final String name) {

View File

@ -9,10 +9,8 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockID;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import java.util.Collections;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Location;
import org.bukkit.Material;
@ -31,8 +29,8 @@ import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.jetbrains.annotations.Nullable;
public class AsyncBlock implements Block {
@ -72,27 +70,33 @@ public class AsyncBlock implements Block {
return world.getBlock(x, y, z).getBlockType().getInternalId();
}
@NotNull @Override
@NotNull
@Override
public AsyncBlock getRelative(int modX, int modY, int modZ) {
return new AsyncBlock(world, x + modX, y + modY, z + modZ);
}
@NotNull @Override
@NotNull
@Override
public AsyncBlock getRelative(BlockFace face) {
return this.getRelative(face.getModX(), face.getModY(), face.getModZ());
}
@NotNull @Override
@NotNull
@Override
public AsyncBlock getRelative(BlockFace face, int distance) {
return this.getRelative(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);
return this.getRelative(face.getModX() * distance, face.getModY() * distance,
face.getModZ() * distance);
}
@NotNull @Override
@NotNull
@Override
public Material getType() {
return getBlockData().getMaterial();
}
@NotNull @Override
@NotNull
@Override
public BlockData getBlockData() {
return BukkitAdapter.adapt(world.getBlock(x, y, z));
}
@ -137,7 +141,8 @@ public class AsyncBlock implements Block {
return (byte) 15;
}
@NotNull @Override
@NotNull
@Override
public AsyncWorld getWorld() {
return world;
}
@ -157,14 +162,15 @@ public class AsyncBlock implements Block {
return z;
}
@NotNull @Override
@NotNull
@Override
public Location getLocation() {
return new Location(world, x, y, z);
}
@Override
public Location getLocation(Location loc) {
if(loc != null) {
if (loc != null) {
loc.setWorld(this.getWorld());
loc.setX(this.x);
loc.setY(this.y);
@ -173,7 +179,8 @@ public class AsyncBlock implements Block {
return loc;
}
@NotNull @Override
@NotNull
@Override
public AsyncChunk getChunk() {
return world.getChunkAt(x >> 4, z >> 4);
}
@ -219,7 +226,8 @@ public class AsyncBlock implements Block {
return null;
}
@NotNull @Override
@NotNull
@Override
public AsyncBlockState getState() {
BaseBlock state = world.getFullBlock(x, y, z);
switch (state.getBlockType().getInternalId()) {
@ -247,7 +255,8 @@ public class AsyncBlock implements Block {
return getState();
}
@NotNull @Override
@NotNull
@Override
public Biome getBiome() {
return world.getAdapter().adapt(world.getBiomeType(x, y, z));
}
@ -340,12 +349,14 @@ public class AsyncBlock implements Block {
return TaskManager.IMP.sync(() -> getUnsafeBlock().breakNaturally(tool));
}
@NotNull @Override
@NotNull
@Override
public Collection<ItemStack> getDrops() {
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops());
}
@NotNull @Override
@NotNull
@Override
public Collection<ItemStack> getDrops(@NotNull ItemStack tool) {
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops(tool));
}
@ -355,7 +366,8 @@ public class AsyncBlock implements Block {
this.getUnsafeBlock().setMetadata(metadataKey, newMetadataValue);
}
@NotNull @Override
@NotNull
@Override
public List<MetadataValue> getMetadata(@NotNull String metadataKey) {
return this.getUnsafeBlock().getMetadata(metadataKey);
}
@ -376,11 +388,13 @@ public class AsyncBlock implements Block {
}
@Override
public RayTraceResult rayTrace(@NotNull Location arg0, @NotNull Vector arg1, double arg2, @NotNull FluidCollisionMode arg3) {
public RayTraceResult rayTrace(@NotNull Location arg0, @NotNull Vector arg1, double arg2,
@NotNull FluidCollisionMode arg3) {
return this.getUnsafeBlock().rayTrace(arg0, arg1, arg2, arg3);
}
@NotNull @Override
@NotNull
@Override
public BoundingBox getBoundingBox() {
return this.getUnsafeBlock().getBoundingBox();
}

View File

@ -1,19 +1,14 @@
package com.boydti.fawe.bukkit.wrapper;
import com.boydti.fawe.FaweCache;
import com.sk89q.jnbt.CompoundTag;
import java.util.List;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
@ -22,6 +17,8 @@ import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class AsyncBlockState implements BlockState {
private BaseBlock state;
@ -165,7 +162,8 @@ public class AsyncBlockState implements BlockState {
@Override
public void setRawData(byte data) {
int combinedId = getTypeId() + (data << BlockTypesCache.BIT_OFFSET);
state = com.sk89q.worldedit.world.block.BlockState.getFromInternalId(combinedId).toBaseBlock(state.getNbtData());
state = com.sk89q.worldedit.world.block.BlockState.getFromInternalId(combinedId)
.toBaseBlock(state.getNbtData());
this.blockData = BukkitAdapter.adapt(state);
}

View File

@ -1,10 +1,8 @@
package com.boydti.fawe.bukkit.wrapper;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.TaskManager;
import java.util.function.Supplier;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.World;
@ -15,6 +13,7 @@ import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.function.Supplier;
public class AsyncChunk implements Chunk {
@ -68,11 +67,14 @@ public class AsyncChunk implements Chunk {
}
@Override
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome,
boolean includeBiomeTempRain) {
if (Fawe.isMainThread()) {
return world.getChunkAt(x, z).getChunkSnapshot(includeMaxblocky, includeBiome, includeBiomeTempRain);
return world.getChunkAt(x, z)
.getChunkSnapshot(includeMaxblocky, includeBiome, includeBiomeTempRain);
}
return whenLoaded(() -> world.getChunkAt(x, z).getChunkSnapshot(includeBiome, includeBiome, includeBiomeTempRain));
return whenLoaded(() -> world.getChunkAt(x, z)
.getChunkSnapshot(includeBiome, includeBiome, includeBiomeTempRain));
}
private <T> T whenLoaded(Supplier<T> task) {

View File

@ -13,14 +13,6 @@ import com.sk89q.worldedit.extent.PassthroughExtent;
import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockState;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import org.bukkit.BlockChangeDelegate;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
@ -69,12 +61,22 @@ import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
/**
* Modify the world from an async thread<br>
* - Use world.commit() to execute all the changes<br>
* - Any Chunk/Block/BlockState objects returned should also be safe to use from the same async thread<br>
* - Only block read,write and biome write are fast, other methods will perform slower async<br>
* -
*
* @see #wrap(World)
* @see #create(WorldCreator)
*/
@ -84,14 +86,15 @@ public class AsyncWorld extends PassthroughExtent implements World {
private BukkitImplAdapter adapter;
@Override
public <T> void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6, T t) {
public <T> void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i,
double v3, double v4, double v5, double v6, T t) {
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5, v6, t);
}
/**
* @deprecated use {@link #wrap(World)} instead
* @param parent Parent world
* @param autoQueue
* @deprecated use {@link #wrap(World)} instead
*/
@Deprecated
public AsyncWorld(World parent, boolean autoQueue) {
@ -103,9 +106,9 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
/**
* @deprecated use {@link #wrap(World)} instead
* @param parent
* @param extent
* @deprecated use {@link #wrap(World)} instead
*/
@Deprecated
public AsyncWorld(World parent, Extent extent) {
@ -115,7 +118,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
/**
* Wrap a world for async usage
* Wrap a world for async usage.
*
* @param world
* @return
*/
@ -138,6 +142,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
/**
* Create a world async (untested)
* - Only optimized for 1.10
*
* @param creator
* @return
*/
@ -173,47 +178,56 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i, T t) {
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i,
T t) {
parent.spawnParticle(particle, location, i, t);
}
@Override
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, T data) {
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z,
int count, T data) {
parent.spawnParticle(particle, x, y, z, count, data);
}
@Override
public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ) {
public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count,
double offsetX, double offsetY, double offsetZ) {
parent.spawnParticle(particle, location, count, offsetX, offsetY, offsetZ);
}
@Override
public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5) {
public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i,
double v3, double v4, double v5) {
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5);
}
@Override
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i, double v, double v1, double v2, T t) {
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i,
double v, double v1, double v2, T t) {
parent.spawnParticle(particle, location, i, v, v1, v2, t);
}
@Override
public <T> void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, T t) {
public <T> void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i,
double v3, double v4, double v5, T t) {
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5, t);
}
@Override
public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i, double v, double v1, double v2, double v3) {
public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i,
double v, double v1, double v2, double v3) {
parent.spawnParticle(particle, location, i, v, v1, v2, v3);
}
@Override
public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6) {
public void spawnParticle(@NotNull Particle particle, double v, double v1, double v2, int i,
double v3, double v4, double v5, double v6) {
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5, v6);
}
@Override
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i, double v, double v1, double v2, double v3, T t) {
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int i,
double v, double v1, double v2, double v3, T t) {
parent.spawnParticle(particle, location, i, v, v1, v2, v3, t);
}
@ -236,7 +250,9 @@ public class AsyncWorld extends PassthroughExtent implements World {
public int getHighestBlockYAt(int x, int z) {
for (int y = getMaxHeight() - 1; y >= 0; y--) {
BlockState state = this.getBlock(x, y, z);
if (!state.getMaterial().isAir()) return y;
if (!state.getMaterial().isAir()) {
return y;
}
}
return 0;
}
@ -259,7 +275,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
@Override
public int getHighestBlockYAt(int i, int i1, @NotNull HeightMap heightMap) {
return parent.getHighestBlockYAt(i,i1, heightMap);
return parent.getHighestBlockYAt(i, i1, heightMap);
}
@Override
@ -410,17 +426,20 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public @NotNull Item dropItemNaturally(final @NotNull Location location, final @NotNull ItemStack item) {
public @NotNull Item dropItemNaturally(final @NotNull Location location,
final @NotNull ItemStack item) {
return TaskManager.IMP.sync(() -> parent.dropItemNaturally(location, item));
}
@Override
public @NotNull Arrow spawnArrow(final @NotNull Location location, final @NotNull Vector direction, final float speed, final float spread) {
public @NotNull Arrow spawnArrow(final @NotNull Location location,
final @NotNull Vector direction, final float speed, final float spread) {
return TaskManager.IMP.sync(() -> parent.spawnArrow(location, direction, speed, spread));
}
@Override
public <T extends AbstractArrow> @NotNull T spawnArrow(@NotNull Location location, @NotNull Vector direction, float speed, float spread, @NotNull Class<T> clazz) {
public <T extends AbstractArrow> @NotNull T spawnArrow(@NotNull Location location,
@NotNull Vector direction, float speed, float spread, @NotNull Class<T> clazz) {
return parent.spawnArrow(location, direction, speed, spread, clazz);
}
@ -430,7 +449,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public boolean generateTree(final @NotNull Location loc, final @NotNull TreeType type, final @NotNull BlockChangeDelegate delegate) {
public boolean generateTree(final @NotNull Location loc, final @NotNull TreeType type,
final @NotNull BlockChangeDelegate delegate) {
return TaskManager.IMP.sync(() -> parent.generateTree(loc, type, delegate));
}
@ -466,7 +486,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public <T extends Entity> @NotNull Collection<T> getEntitiesByClass(final @NotNull Class<T> cls) {
public <T extends Entity> @NotNull Collection<T> getEntitiesByClass(
final @NotNull Class<T> cls) {
return TaskManager.IMP.sync(() -> parent.getEntitiesByClass(cls));
}
@ -481,7 +502,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public @NotNull Collection<Entity> getNearbyEntities(final @NotNull Location location, final double x, final double y, final double z) {
public @NotNull Collection<Entity> getNearbyEntities(final @NotNull Location location,
final double x, final double y, final double z) {
return TaskManager.IMP.sync(() -> parent.getNearbyEntities(location, x, y, z));
}
@ -576,17 +598,17 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public boolean createExplosion(final double x, final double y, final double z, final float power, final boolean setFire, final boolean breakBlocks) {
return TaskManager.IMP.sync(
() ->
parent.createExplosion(x, y, z, power, setFire, breakBlocks));
public boolean createExplosion(final double x, final double y, final double z,
final float power, final boolean setFire, final boolean breakBlocks) {
return TaskManager.IMP
.sync(() -> parent.createExplosion(x, y, z, power, setFire, breakBlocks));
}
@Override
public boolean createExplosion(double x, double y, double z, float power, boolean setFire,
boolean breakBlocks, @Nullable Entity source) {
return TaskManager.IMP.sync(
() -> parent.createExplosion(x, y, z, power, setFire, breakBlocks, source));
return TaskManager.IMP
.sync(() -> parent.createExplosion(x, y, z, power, setFire, breakBlocks, source));
}
@Override
@ -641,33 +663,40 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public <T extends Entity> @NotNull T spawn(final @NotNull Location location, final @NotNull Class<T> clazz) throws IllegalArgumentException {
public <T extends Entity> @NotNull T spawn(final @NotNull Location location,
final @NotNull Class<T> clazz) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz));
}
@Override
public <T extends Entity> @NotNull T spawn(@NotNull Location location, @NotNull Class<T> clazz, Consumer<T> function) throws IllegalArgumentException {
public <T extends Entity> @NotNull T spawn(@NotNull Location location, @NotNull Class<T> clazz,
Consumer<T> function) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz, function));
}
@Override
public <T extends Entity> @NotNull T spawn(@NotNull Location location, @NotNull Class<T> clazz, @Nullable Consumer<T> function, CreatureSpawnEvent.@NotNull SpawnReason reason) throws IllegalArgumentException {
public <T extends Entity> @NotNull T spawn(@NotNull Location location, @NotNull Class<T> clazz,
@Nullable Consumer<T> function, CreatureSpawnEvent.@NotNull SpawnReason reason)
throws IllegalArgumentException {
return null;
}
@Override
public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException {
public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location,
@NotNull MaterialData data) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, data));
}
@Override
@Deprecated
public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull Material material, byte data) throws IllegalArgumentException {
public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location,
@NotNull Material material, byte data) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, material, data));
}
@Override
public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData blockData) throws IllegalArgumentException {
public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location,
@NotNull BlockData blockData) throws IllegalArgumentException {
return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, blockData));
}
@ -677,7 +706,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public void playEffect(final @NotNull Location location, final @NotNull Effect effect, final int data, final int radius) {
public void playEffect(final @NotNull Location location, final @NotNull Effect effect,
final int data, final int radius) {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override
public void run(Object value) {
@ -692,7 +722,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public <T> void playEffect(final @NotNull Location location, final @NotNull Effect effect, final T data, final int radius) {
public <T> void playEffect(final @NotNull Location location, final @NotNull Effect effect,
final T data, final int radius) {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override
public void run(Object value) {
@ -702,9 +733,10 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public @NotNull ChunkSnapshot getEmptyChunkSnapshot(final int x, final int z, final boolean includeBiome, final boolean includeBiomeTempRain) {
return TaskManager.IMP.sync(
() -> parent.getEmptyChunkSnapshot(x, z, includeBiome, includeBiomeTempRain));
public @NotNull ChunkSnapshot getEmptyChunkSnapshot(final int x, final int z,
final boolean includeBiome, final boolean includeBiomeTempRain) {
return TaskManager.IMP
.sync(() -> parent.getEmptyChunkSnapshot(x, z, includeBiome, includeBiomeTempRain));
}
@Override
@ -729,7 +761,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
@Override
public @NotNull Biome getBiome(int x, int y, int z) {
return adapter.adapt(getExtent().getBiomeType(x,y,z));
return adapter.adapt(getExtent().getBiomeType(x, y, z));
}
@Override
@ -884,11 +916,13 @@ public class AsyncWorld extends PassthroughExtent implements World {
parent.setWaterAnimalSpawnLimit(limit);
}
@Override public int getWaterAmbientSpawnLimit() {
@Override
public int getWaterAmbientSpawnLimit() {
return parent.getWaterAmbientSpawnLimit();
}
@Override public void setWaterAmbientSpawnLimit(int limit) {
@Override
public void setWaterAmbientSpawnLimit(int limit) {
parent.setWaterAmbientSpawnLimit(limit);
}
@ -903,7 +937,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public void playSound(final @NotNull Location location, final @NotNull Sound sound, final float volume, final float pitch) {
public void playSound(final @NotNull Location location, final @NotNull Sound sound,
final float volume, final float pitch) {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override
public void run(Object value) {
@ -913,7 +948,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public void playSound(final @NotNull Location location, final @NotNull String sound, final float volume, final float pitch) {
public void playSound(final @NotNull Location location, final @NotNull String sound,
final float volume, final float pitch) {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override
public void run(Object value) {
@ -923,7 +959,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public void playSound(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch) {
public void playSound(@NotNull Location location, @NotNull Sound sound,
@NotNull SoundCategory category, float volume, float pitch) {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override
public void run(Object value) {
@ -933,7 +970,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch) {
public void playSound(@NotNull Location location, @NotNull String sound,
@NotNull SoundCategory category, float volume, float pitch) {
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override
public void run(Object value) {
@ -1042,13 +1080,14 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public @NotNull Collection<Entity> getNearbyEntities(@NotNull BoundingBox arg0, Predicate<Entity> arg1) {
public @NotNull Collection<Entity> getNearbyEntities(@NotNull BoundingBox arg0,
Predicate<Entity> arg1) {
return parent.getNearbyEntities(arg0, arg1);
}
@Override
public @NotNull Collection<Entity> getNearbyEntities(@NotNull Location arg0, double arg1, double arg2, double arg3,
Predicate<Entity> arg4) {
public @NotNull Collection<Entity> getNearbyEntities(@NotNull Location arg0, double arg1,
double arg2, double arg3, Predicate<Entity> arg4) {
return parent.getNearbyEntities(arg0, arg1, arg2, arg3, arg4);
}
@ -1058,7 +1097,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public Location locateNearestStructure(@NotNull Location arg0, @NotNull StructureType arg1, int arg2, boolean arg3) {
public Location locateNearestStructure(@NotNull Location arg0, @NotNull StructureType arg1,
int arg2, boolean arg3) {
return parent.locateNearestStructure(arg0, arg1, arg2, arg3);
}
@ -1083,46 +1123,51 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public RayTraceResult rayTrace(
@NotNull Location arg0, @NotNull Vector arg1, double arg2, @NotNull FluidCollisionMode arg3, boolean arg4,
double arg5, Predicate<Entity> arg6) {
public RayTraceResult rayTrace(@NotNull Location arg0, @NotNull Vector arg1, double arg2,
@NotNull FluidCollisionMode arg3, boolean arg4, double arg5, Predicate<Entity> arg6) {
return parent.rayTrace(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
}
@Override
public RayTraceResult rayTraceBlocks(@NotNull Location arg0, @NotNull Vector arg1, double arg2) {
public RayTraceResult rayTraceBlocks(@NotNull Location arg0, @NotNull Vector arg1,
double arg2) {
return parent.rayTraceBlocks(arg0, arg1, arg2);
}
@Override
public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode) {
public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction,
double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode) {
return parent.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode);
}
@Override
public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double arg2, @NotNull FluidCollisionMode fluidCollisionMode,
boolean ignorePassableBlocks) {
return parent.rayTraceBlocks(start, direction, arg2, fluidCollisionMode, ignorePassableBlocks);
public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction,
double arg2, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
return parent
.rayTraceBlocks(start, direction, arg2, fluidCollisionMode, ignorePassableBlocks);
}
@Override
public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance) {
public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction,
double maxDistance) {
return parent.rayTraceEntities(start, direction, maxDistance);
}
@Override
public RayTraceResult rayTraceEntities(@NotNull Location arg0, @NotNull Vector arg1, double arg2, double arg3) {
public RayTraceResult rayTraceEntities(@NotNull Location arg0, @NotNull Vector arg1,
double arg2, double arg3) {
return parent.rayTraceEntities(arg0, arg1, arg2, arg3);
}
@Override
public RayTraceResult rayTraceEntities(@NotNull Location arg0, @NotNull Vector arg1, double arg2, Predicate<Entity> arg3) {
public RayTraceResult rayTraceEntities(@NotNull Location arg0, @NotNull Vector arg1,
double arg2, Predicate<Entity> arg3) {
return parent.rayTraceEntities(arg0, arg1, arg2, arg3);
}
@Override
public RayTraceResult rayTraceEntities(@NotNull Location arg0, @NotNull Vector arg1, double arg2, double arg3,
Predicate<Entity> arg4) {
public RayTraceResult rayTraceEntities(@NotNull Location arg0, @NotNull Vector arg1,
double arg2, double arg3, Predicate<Entity> arg4) {
return parent.rayTraceEntities(arg0, arg1, arg2, arg3, arg4);
}
@ -1170,7 +1215,9 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public int getHighestBlockYAt(int x, int z, com.destroystokyo.paper.@NotNull HeightmapType heightmap) throws UnsupportedOperationException {
public int getHighestBlockYAt(int x, int z,
com.destroystokyo.paper.@NotNull HeightmapType heightmap)
throws UnsupportedOperationException {
return TaskManager.IMP.sync(() -> parent.getHighestBlockYAt(x, z, heightmap));
}
@ -1205,7 +1252,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public @NotNull CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) {
public @NotNull CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen,
boolean urgent) {
return null;
}
@ -1241,8 +1289,10 @@ public class AsyncWorld extends PassthroughExtent implements World {
}
@Override
public boolean createExplosion(Entity source, @NotNull Location loc, float power, boolean setFire, boolean breakBlocks) {
return TaskManager.IMP.sync(() -> parent.createExplosion(source, loc, power, setFire, breakBlocks));
public boolean createExplosion(Entity source, @NotNull Location loc, float power,
boolean setFire, boolean breakBlocks) {
return TaskManager.IMP
.sync(() -> parent.createExplosion(source, loc, power, setFire, breakBlocks));
}
@Override
@ -1259,13 +1309,17 @@ public class AsyncWorld extends PassthroughExtent implements World {
@Override
public <T> void spawnParticle(
@NotNull Particle particle, List<Player> receivers, @NotNull Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) {
parent.spawnParticle(particle, receivers, source, x, y, z, count, offsetX, offsetY, offsetZ, extra, data);
public <T> void spawnParticle(@NotNull Particle particle, List<Player> receivers,
@NotNull Player source, double x, double y, double z, int count, double offsetX,
double offsetY, double offsetZ, double extra, T data) {
parent.spawnParticle(particle, receivers, source, x, y, z, count, offsetX, offsetY, offsetZ,
extra, data);
}
@Override
public <T> void spawnParticle(@NotNull Particle particle, List<Player> list, Player player, double v, double v1, double v2, int i, double v3, double v4, double v5, double v6, T t, boolean b) {
public <T> void spawnParticle(@NotNull Particle particle, List<Player> list, Player player,
double v, double v1, double v2, int i, double v3, double v4, double v5, double v6, T t,
boolean b) {
parent.spawnParticle(particle, list, player, v, v1, v2, i, v3, v4, v5, v6, t, b);
}
@ -1273,7 +1327,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count,
double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data,
boolean force) {
parent.spawnParticle(particle, location, count, offsetX, offsetY, offsetZ, extra, data, force);
parent.spawnParticle(particle, location, count, offsetX, offsetY, offsetZ, extra, data,
force);
}
@Override

View File

@ -23,7 +23,8 @@ public class CommandInfo {
private final String[] aliases;
private final Object registeredWith;
private final String usage, desc;
private final String usage;
private final String desc;
private final String[] permissions;
public CommandInfo(String usage, String desc, String[] aliases, Object registeredWith) {

View File

@ -37,7 +37,8 @@ import java.util.Set;
public class CommandRegistration {
static {
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(DynamicPluginCommand.class, new DynamicPluginCommandHelpTopic.Factory());
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(DynamicPluginCommand.class,
new DynamicPluginCommandHelpTopic.Factory());
}
protected final Plugin plugin;
@ -55,7 +56,9 @@ public class CommandRegistration {
}
public Plugin getCommandOwner(String label) {
if (serverCommandMap == null) return null;
if (serverCommandMap == null) {
return null;
}
Command command = serverCommandMap.getCommand(label);
if (command instanceof PluginIdentifiableCommand) {
return ((PluginIdentifiableCommand) command).getPlugin();
@ -87,8 +90,8 @@ public class CommandRegistration {
CommandMap commandMap = ReflectionUtil.getField(plugin.getServer().getPluginManager(), "commandMap");
if (commandMap == null) {
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName() +
": Could not retrieve server CommandMap, using fallback instead!");
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName()
+ ": Could not retrieve server CommandMap, using fallback instead!");
fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer());
Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin);
} else {

View File

@ -22,8 +22,6 @@ package com.sk89q.bukkit.util;
import com.sk89q.minecraft.util.commands.CommandsManager;
import com.sk89q.util.StringUtil;
import com.sk89q.wepif.PermissionsResolverManager;
import java.util.Arrays;
import java.util.List;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -31,8 +29,11 @@ import org.bukkit.command.PluginIdentifiableCommand;
import org.bukkit.command.TabCompleter;
import org.bukkit.plugin.Plugin;
import java.util.Arrays;
import java.util.List;
/**
* An implementation of a dynamically registered {@link org.bukkit.command.Command} attached to a plugin
* An implementation of a dynamically registered {@link org.bukkit.command.Command} attached to a plugin.
*/
@SuppressWarnings("deprecation")
public class DynamicPluginCommand extends org.bukkit.command.Command implements PluginIdentifiableCommand {
@ -105,7 +106,7 @@ public class DynamicPluginCommand extends org.bukkit.command.Command implements
}
}
return false;
} catch (Throwable ignore) {
} catch (Throwable ignored) {
}
} else if (PermissionsResolverManager.isInitialized() && sender instanceof OfflinePlayer) {
for (String permission : permissions) {

View File

@ -31,10 +31,10 @@ import java.util.Map;
import java.util.Set;
public class ConfigurationPermissionsResolver implements PermissionsResolver {
private YAMLProcessor config;
private Map<String, Set<String>> userPermissionsCache;
private Set<String> defaultPermissionsCache;
private Map<String, Set<String>> userGroups;
private final YAMLProcessor config;
private final Map<String, Set<String>> userPermissionsCache = new HashMap<>();
private final Set<String> defaultPermissionsCache = new HashSet<>();
private final Map<String, Set<String>> userGroups = new HashMap<>();
public ConfigurationPermissionsResolver(YAMLProcessor config) {
this.config = config;
@ -44,7 +44,8 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
section.setProperty("groups.default.permissions", new String[] {
"worldedit.reload",
"worldedit.selection",
"worlds.creative.worldedit.region"});
"worlds.creative.worldedit.region"
});
section.setProperty("groups.admins.permissions", new String[] { "*" });
section.setProperty("users.sk89q.permissions", new String[] { "worldedit" });
section.setProperty("users.sk89q.groups", new String[] { "admins" });
@ -53,9 +54,9 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
@Override
public void load() {
userGroups = new HashMap<>();
userPermissionsCache = new HashMap<>();
defaultPermissionsCache = new HashSet<>();
userGroups.clear();
userPermissionsCache.clear();
defaultPermissionsCache.clear();
Map<String, Set<String>> userGroupPermissions = new HashMap<>();

View File

@ -78,6 +78,8 @@ public class DinnerPermsResolver implements PermissionsResolver {
return false;
case 1:
return true;
default:
break;
}
int dotPos = permission.lastIndexOf(".");
while (dotPos > -1) {
@ -86,6 +88,8 @@ public class DinnerPermsResolver implements PermissionsResolver {
return false;
case 1:
return true;
default:
break;
}
dotPos = permission.lastIndexOf(".", dotPos - 1);
}
@ -126,19 +130,23 @@ public class DinnerPermsResolver implements PermissionsResolver {
}
public Permissible getPermissible(OfflinePlayer offline) {
if (offline == null) return null;
if (offline == null) {
return null;
}
Permissible perm = null;
if (offline instanceof Permissible) {
perm = (Permissible) offline;
} else {
Player player = offline.getPlayer();
if (player != null) perm = player;
if (player != null) {
perm = player;
}
}
return perm;
}
/**
* Checks the permission from dinnerperms
* Checks the permission from dinnerperms.
*
* @param perms Permissible to check for
* @param permission The permission to check

View File

@ -35,8 +35,8 @@ public class NijiPermissionsResolver implements PermissionsResolver {
private static final Logger log = LoggerFactory.getLogger(NijiPermissionsResolver.class);
private Server server;
private Permissions api;
private final Server server;
private final Permissions api;
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
PluginManager pluginManager = server.getPluginManager();
@ -76,7 +76,9 @@ public class NijiPermissionsResolver implements PermissionsResolver {
public boolean hasPermission(String name, String permission) {
try {
Player player = server.getPlayerExact(name);
if (player == null) return false;
if (player == null) {
return false;
}
try {
return api.getHandler().has(player, permission);
} catch (Throwable t) {
@ -107,7 +109,9 @@ public class NijiPermissionsResolver implements PermissionsResolver {
public boolean inGroup(String name, String group) {
try {
Player player = server.getPlayerExact(name);
if (player == null) return false;
if (player == null) {
return false;
}
try {
return api.getHandler().inGroup(player.getWorld().getName(), name, group);
} catch (Throwable t) {
@ -124,13 +128,17 @@ public class NijiPermissionsResolver implements PermissionsResolver {
public String[] getGroups(String name) {
try {
Player player = server.getPlayerExact(name);
if (player == null) return new String[0];
if (player == null) {
return new String[0];
}
String[] groups = null;
try {
groups = api.getHandler().getGroups(player.getWorld().getName(), player.getName());
} catch (Throwable t) {
String group = api.Security.getGroup(player.getWorld().getName(), player.getName());
if (group != null) groups = new String[] { group };
if (group != null) {
groups = new String[] { group };
}
}
if (groups == null) {
return new String[0];

View File

@ -40,24 +40,24 @@ import java.util.List;
public class PermissionsResolverManager implements PermissionsResolver {
private static final String CONFIG_HEADER = "#\r\n" +
"# WEPIF Configuration File\r\n" +
"#\r\n" +
"# This file handles permissions configuration for every plugin using WEPIF\r\n" +
"#\r\n" +
"# About editing this file:\r\n" +
"# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If\r\n" +
"# you use an editor like Notepad++ (recommended for Windows users), you\r\n" +
"# must configure it to \"replace tabs with spaces.\" In Notepad++, this can\r\n" +
"# be changed in Settings > Preferences > Language Menu.\r\n" +
"# - Don't get rid of the indents. They are indented so some entries are\r\n" +
"# in categories (like \"enforce-single-session\" is in the \"protection\"\r\n" +
"# category.\r\n" +
"# - If you want to check the format of this file before putting it\r\n" +
"# into WEPIF, paste it into http://yaml-online-parser.appspot.com/\r\n" +
"# and see if it gives \"ERROR:\".\r\n" +
"# - Lines starting with # are comments and so they are ignored.\r\n" +
"\r\n";
private static final String CONFIG_HEADER = "#\r\n"
+ "# WEPIF Configuration File\r\n"
+ "#\r\n"
+ "# This file handles permissions configuration for every plugin using WEPIF\r\n"
+ "#\r\n"
+ "# About editing this file:\r\n"
+ "# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If\r\n"
+ "# you use an editor like Notepad++ (recommended for Windows users), you\r\n"
+ "# must configure it to \"replace tabs with spaces.\" In Notepad++, this can\r\n"
+ "# be changed in Settings > Preferences > Language Menu.\r\n"
+ "# - Don't get rid of the indents. They are indented so some entries are\r\n"
+ "# in categories (like \"enforce-single-session\" is in the \"protection\"\r\n"
+ "# category.\r\n"
+ "# - If you want to check the format of this file before putting it\r\n"
+ "# into WEPIF, paste it into https://yaml-online-parser.appspot.com/\r\n"
+ "# and see if it gives \"ERROR:\".\r\n"
+ "# - Lines starting with # are comments and so they are ignored.\r\n"
+ "\r\n";
private static PermissionsResolverManager instance;
@ -78,11 +78,11 @@ public class PermissionsResolverManager implements PermissionsResolver {
return instance;
}
private Server server;
private final Server server;
private PermissionsResolver permissionResolver;
private YAMLProcessor config;
private Logger logger = LoggerFactory.getLogger(getClass());
private List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>();
private final Logger logger = LoggerFactory.getLogger(getClass());
private final List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>();
@SuppressWarnings("unchecked")
protected Class<? extends PermissionsResolver>[] availableResolvers = new Class[] {
@ -225,7 +225,8 @@ public class PermissionsResolverManager implements PermissionsResolver {
Class<?> next = null;
try {
next = Class.forName(getClass().getPackage().getName() + "." + nextName);
} catch (ClassNotFoundException e) {}
} catch (ClassNotFoundException ignored) {
}
if (next == null || !PermissionsResolver.class.isAssignableFrom(next)) {
logger.warn("WEPIF: Invalid or unknown class found in enabled resolvers: "
@ -239,12 +240,12 @@ public class PermissionsResolverManager implements PermissionsResolver {
}
for (Class<?> clazz : availableResolvers) {
if (!stagedEnabled.contains(clazz.getSimpleName()) &&
!disabledResolvers.contains(clazz.getSimpleName())) {
if (!stagedEnabled.contains(clazz.getSimpleName())
&& !disabledResolvers.contains(clazz.getSimpleName())) {
disabledResolvers.add(clazz.getSimpleName());
logger.info("New permissions resolver: "
+ clazz.getSimpleName() + " detected. " +
"Added to disabled resolvers list.");
+ clazz.getSimpleName() + " detected. "
+ "Added to disabled resolvers list.");
isUpdated = true;
}
}

View File

@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
import java.io.File;
/**
* YAMLConfiguration but with setting for no op permissions and plugin root data folder
* YAMLConfiguration but with setting for no op permissions and plugin root data folder.
*/
public class BukkitConfiguration extends YAMLConfiguration {
@ -59,8 +59,8 @@ public class BukkitConfiguration extends YAMLConfiguration {
File toDir = new File(getWorkingDirectory(), file);
if (fromDir.exists() & !toDir.exists()) {
if (fromDir.renameTo(toDir)) {
plugin.getLogger().info("Migrated " + name + " folder '" + file +
"' from server root to plugin data folder.");
plugin.getLogger().info("Migrated " + name + " folder '" + file
+ "' from server root to plugin data folder.");
} else {
plugin.getLogger().warning("Error while migrating " + name + " folder!");
}

View File

@ -19,9 +19,6 @@
package com.sk89q.worldedit.bukkit;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
@ -35,9 +32,10 @@ import org.bukkit.entity.EntityType;
import java.lang.ref.WeakReference;
import java.util.Locale;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* An adapter to adapt a Bukkit entity into a WorldEdit one.
*/

View File

@ -194,7 +194,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
}
@Override
public void setPosition(Vector3 pos, float pitch, float yaw) {
public boolean trySetPosition(Vector3 pos, float pitch, float yaw) {
org.bukkit.World world = player.getWorld();
if (pos instanceof com.sk89q.worldedit.util.Location) {
com.sk89q.worldedit.util.Location loc = (com.sk89q.worldedit.util.Location) pos;
@ -203,7 +203,8 @@ public class BukkitPlayer extends AbstractPlayerActor {
world = Bukkit.getWorld(((World) extent).getName());
}
}
player.teleport(new Location(world, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch));
org.bukkit.World finalWorld = world;
return TaskManager.IMP.sync(() -> player.teleport(new Location(finalWorld, pos.getX(), pos.getY(), pos.getZ(), yaw, pitch)));
}
@Override

View File

@ -406,10 +406,11 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I
SingleThreadQueueExtent extent = new SingleThreadQueueExtent();
extent.init(null, (x, z) -> new BukkitGetBlocks_1_14(freshWorld, x, z) {
@Override
public Chunk ensureLoaded(World nmsWorld, int X, int Z) {
Chunk cached = nmsWorld.getChunkIfLoaded(X, Z);
public Chunk ensureLoaded(World nmsWorld, int chunkX, int chunkZ) {
Chunk cached = nmsWorld.getChunkIfLoaded(chunkX, chunkZ);
if (cached != null) return cached;
Future<Chunk> future = Fawe.get().getQueueHandler().sync((Supplier<Chunk>) () -> freshWorld.getChunkAt(X, Z));
Future<Chunk> future = Fawe.get().getQueueHandler().sync((Supplier<Chunk>) () -> freshWorld.getChunkAt(
chunkX, chunkZ));
while (!future.isDone()) {
// this feels so dirty
freshWorld.getChunkProvider().runTasks();

View File

@ -1,7 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.plugins.ide.idea.model.IdeaModel
import com.mendhak.gradlecrowdin.DownloadTranslationsTask
import com.mendhak.gradlecrowdin.UploadSourceFileTask
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
@ -94,8 +94,7 @@ plugins.withId("idea") {
}
}
sourceSets {
main {
sourceSets.named("main") {
java {
srcDir("src/main/java")
srcDir("src/legacy/java")
@ -103,7 +102,6 @@ sourceSets {
resources {
srcDir("src/main/resources")
}
}
}
tasks.named<Copy>("processResources") {
@ -147,7 +145,7 @@ if (project.hasProperty(crowdinApiKey) && !gradle.startParameter.isOffline) {
}
}
tasks.named("classes").configure {
tasks.named("classes") {
dependsOn("crowdinDownload")
}
}

View File

@ -63,8 +63,11 @@ public class SkullBlock extends BaseBlock {
if (owner == null) {
this.owner = "";
} else {
if (owner.length() > 16 || owner.isEmpty()) this.owner = "";
else this.owner = owner;
if (owner.length() > 16 || owner.isEmpty()) {
this.owner = "";
} else {
this.owner = owner;
}
}
}

View File

@ -18,6 +18,9 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
@ -28,17 +31,12 @@ import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import javax.management.InstanceAlreadyExistsException;
import javax.management.NotificationEmitter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* [ WorldEdit action]

View File

@ -29,18 +29,14 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
import com.sk89q.worldedit.internal.registry.AbstractFactory;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.world.World;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
@ -49,6 +45,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nullable;
/**
* The FaweAPI class offers a few useful functions.<br>

View File

@ -1,7 +1,5 @@
package com.boydti.fawe;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.Trimable;
import com.boydti.fawe.beta.implementation.queue.Pool;
@ -36,6 +34,8 @@ import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -54,7 +54,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.function.Supplier;
import org.jetbrains.annotations.NotNull;
import static com.google.common.base.Preconditions.checkNotNull;
public enum FaweCache implements Trimable {
IMP

View File

@ -1,12 +1,12 @@
package com.boydti.fawe;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.beta.implementation.cache.preloader.Preloader;
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.regions.FaweMaskManager;
import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.util.image.ImageViewer;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.world.World;
import java.io.File;
import java.util.Collection;
import java.util.UUID;

View File

@ -1,13 +1,10 @@
package com.boydti.fawe.beta;
import com.boydti.fawe.FaweCache;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.HashMap;

View File

@ -1,11 +1,11 @@
package com.boydti.fawe.beta;
import com.boydti.fawe.beta.implementation.filter.block.CharFilterBlock;
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
import com.sk89q.worldedit.regions.Region;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Range;
import javax.annotation.Nullable;
/**
* A filter is an interface used for setting blocks.
*/

View File

@ -6,6 +6,7 @@ import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.world.World;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
public class Flood {

View File

@ -7,10 +7,11 @@ import com.boydti.fawe.beta.implementation.processors.MultiBatchProcessor;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import org.jetbrains.annotations.Nullable;
public interface IBatchProcessor {
/**

View File

@ -11,11 +11,12 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockID;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.registry.BlockRegistry;
import org.jetbrains.annotations.Range;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
import java.util.stream.IntStream;
import org.jetbrains.annotations.Range;
/**
* A shared interface for IGetBlocks and ISetBlocks

View File

@ -1,11 +1,11 @@
package com.boydti.fawe.beta;
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.regions.Region;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Range;
import javax.annotation.Nullable;
/**
* Represents a chunk in the queue {@link IQueueExtent} Used for getting and setting blocks / biomes
* / entities

View File

@ -2,13 +2,10 @@ package com.boydti.fawe.beta;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.extent.InputExtent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;

View File

@ -6,9 +6,9 @@ import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import javax.annotation.Nullable;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nullable;
/**
* Interface for setting blocks

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.beta;
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
import com.sk89q.worldedit.regions.Region;
import javax.annotation.Nullable;
public interface IDelegateFilter extends Filter {

View File

@ -9,11 +9,12 @@ import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import org.jetbrains.annotations.Range;
import java.io.Flushable;
import java.util.Set;
import java.util.concurrent.Future;
import javax.annotation.Nullable;
import org.jetbrains.annotations.Range;
/**
* TODO: implement Extent (need to refactor Extent first) Interface for a queue based extent which

View File

@ -8,6 +8,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;

View File

@ -14,7 +14,12 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import java.util.*;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;
public class FallbackChunkGet implements IChunkGet {

View File

@ -11,8 +11,7 @@ import com.sk89q.worldedit.world.biome.BiomeTypes
import com.sk89q.worldedit.world.block.BaseBlock
import com.sk89q.worldedit.world.block.BlockState
import com.sk89q.worldedit.world.block.BlockTypes
import java.util.UUID
import java.util.*
import java.util.concurrent.Future
object NullChunkGet : IChunkGet {

View File

@ -19,11 +19,11 @@ import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import org.jetbrains.annotations.Range;
import javax.annotation.Nullable;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;
import javax.annotation.Nullable;
/**
* An abstract {@link IChunk} class that implements basic get/set blocks

View File

@ -12,7 +12,7 @@ import com.sk89q.worldedit.world.block.BaseBlock
import com.sk89q.worldedit.world.block.BlockState
import com.sk89q.worldedit.world.block.BlockStateHolder
import com.sk89q.worldedit.world.block.BlockTypes
import java.util.UUID
import java.util.*
import java.util.concurrent.Future
object NullChunk : IQueueChunk<Nothing> {

View File

@ -1,7 +1,8 @@
package com.boydti.fawe.beta.implementation.filter;
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
import com.boydti.fawe.beta.FilterBlockMask;
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
import java.awt.image.BufferedImage;
import java.util.concurrent.ThreadLocalRandom;

View File

@ -7,7 +7,6 @@ import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import java.util.ArrayList;

View File

@ -1,6 +1,7 @@
package com.boydti.fawe.beta.implementation.filter;
import com.boydti.fawe.beta.Filter;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

View File

@ -1,7 +1,7 @@
package com.boydti.fawe.beta.implementation.filter;
import com.boydti.fawe.beta.implementation.filter.block.DelegateFilter;
import com.boydti.fawe.beta.Filter;
import com.boydti.fawe.beta.implementation.filter.block.DelegateFilter;
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
import com.sk89q.worldedit.function.mask.Mask;

View File

@ -3,7 +3,7 @@ package com.boydti.fawe.beta.implementation.filter.block;
import com.sk89q.worldedit.extent.Extent;
/**
* Filter block with an extent
* Filter block with an extent.
*/
public abstract class AbstractExtentFilterBlock extends FilterBlock {

View File

@ -8,6 +8,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import javax.annotation.Nullable;
public abstract class AbstractFilterBlock extends FilterBlock {

View File

@ -82,11 +82,11 @@ public abstract class AbstractSingleFilterBlock extends FilterBlock {
setFullBlock(block.toBaseBlock());
return true;
}
return getExtent().setBlock(x,y, z, block);
return getExtent().setBlock(x, y, z, block);
}
@Override
public boolean setBiome(int x, int y, int z, BiomeType biome) {
return getExtent().setBiome(x, y, z,biome);
return getExtent().setBiome(x, y, z, biome);
}
}

View File

@ -8,6 +8,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import javax.annotation.Nullable;
public class ArrayFilterBlock extends AbstractExtentFilterBlock {

View File

@ -1,7 +1,5 @@
package com.boydti.fawe.beta.implementation.filter.block;
import static com.sk89q.worldedit.world.block.BlockTypesCache.states;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.Filter;
import com.boydti.fawe.beta.FilterBlockMask;
@ -22,9 +20,12 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import javax.annotation.Nullable;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nullable;
import static com.sk89q.worldedit.world.block.BlockTypesCache.states;
public class CharFilterBlock extends ChunkFilterBlock {
private static final SetDelegate FULL = (block, value) -> block.setArr[block.index] = value;

View File

@ -1,8 +1,6 @@
package com.boydti.fawe.beta.implementation.filter.block;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.TileEntityBlock;
import com.sk89q.worldedit.extent.Extent;
@ -10,6 +8,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import javax.annotation.Nullable;
/**

View File

@ -6,7 +6,6 @@ import com.boydti.fawe.beta.IBlocks;
import com.boydti.fawe.object.FaweOutputStream;
import com.boydti.fawe.object.io.FastByteArrayOutputStream;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEdit;
import java.util.HashMap;
import java.util.function.Function;

View File

@ -30,12 +30,12 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nullable;
public class LimitExtent extends PassthroughExtent {
private final FaweLimit limit;

View File

@ -1,12 +1,10 @@
package com.boydti.fawe.beta.implementation.processors;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.CombinedBlocks;
import com.boydti.fawe.beta.IBlocks;
import com.boydti.fawe.beta.IChunk;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.beta.implementation.IChunkExtent;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.boydti.fawe.util.MathMan;
@ -19,7 +17,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.function.Supplier;
import java.util.stream.Stream;
public class PersistentChunkSendProcessor extends ChunkSendProcessor {
private final Long2ObjectLinkedOpenHashMap<Character> current;

View File

@ -3,13 +3,13 @@ package com.boydti.fawe.beta.implementation.queue;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.beta.IChunkCache;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.IQueueChunk;
import com.boydti.fawe.beta.IQueueExtent;
import com.boydti.fawe.beta.Trimable;
import com.boydti.fawe.beta.implementation.cache.ChunkCache;
import com.boydti.fawe.beta.IChunkCache;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.collection.CleanableThreadLocal;
import com.boydti.fawe.util.MemUtil;
@ -17,6 +17,7 @@ import com.boydti.fawe.util.TaskManager;
import com.boydti.fawe.wrappers.WorldWrapper;
import com.google.common.util.concurrent.Futures;
import com.sk89q.worldedit.world.World;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Iterator;

View File

@ -20,6 +20,7 @@ import com.boydti.fawe.util.MemUtil;
import com.google.common.util.concurrent.Futures;
import com.sk89q.worldedit.extent.Extent;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

View File

@ -1,7 +1,5 @@
package com.boydti.fawe.command;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
@ -13,12 +11,15 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.annotation.Selection;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.world.biome.BiomeType;
import java.io.IOException;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch;
import java.io.IOException;
import static com.google.common.base.Preconditions.checkNotNull;
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class AnvilCommands {
@ -31,87 +32,87 @@ public class AnvilCommands {
checkNotNull(worldEdit);
}
// /**
// * Run safely on an unloaded world (no selection)
// *
// * @param player
// * @param folder
// * @param filter
// * @param <G>
// * @param <T>
// * @return
// */
// @Deprecated
// public static <G, T extends MCAFilter<G>> T runWithWorld(Player player, String folder, T filter, boolean force) {
// return runWithWorld(player, folder, filter, force, false);
// }
//
//
// @Deprecated
// public static <G, T extends MCAFilter<G>> T runWithWorld(Player player, String folder, T filter, boolean force, boolean unsafe) {
// boolean copy = false;
// if (FaweAPI.getWorld(folder) != null) {
// if (!force) {
// player.print(TranslatableComponent.of("fawe.worldedit.anvil.world.is.loaded"))
// return null;
// }
// copy = true;
// }
// IQueueExtent defaultQueue = SetQueue.IMP.getNewQueue(folder, true, false);
// MCAQueue queue = new MCAQueue(defaultQueue);
// if (copy && !unsafe) {
// return queue.filterCopy(filter, RegionWrapper.GLOBAL());
// } else {
// return queue.filterWorld(filter);
// }
// }
//
// /**
// * Run safely on an existing world within a selection
// *
// * @param player
// * @param editSession
// * @param selection
// * @param filter
// * @param <G>
// * @param <T>
// * @return
// */
// @Deprecated
// public static <G, T extends MCAFilter<G>> T runWithSelection(Player player, EditSession editSession, Region selection, T filter) {
// if (!(selection instanceof CuboidRegion)) {
// player.print(TranslatableComponent.of("fawe.error.no.region"))
// return null;
// }
// CuboidRegion cuboid = (CuboidRegion) selection;
// RegionWrapper wrappedRegion = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint());
// String worldName = editSession.getWorld().getName();
// IQueueExtent tmp = SetQueue.IMP.getNewQueue(worldName, true, false);
// MCAQueue queue = new MCAQueue(tmp);
// FawePlayer<Object> fp = FawePlayer.wrap(player);
// fp.checkAllowedRegion(selection);
// recordHistory(fp, editSession.getWorld(), iAnvilHistory -> {
// queue.filterCopy(filter, wrappedRegion, iAnvilHistory);
// });
// return filter;
// }
//
// public static void recordHistory(FawePlayer fp, World world, Consumer<IAnvilHistory> run) {
// LocalSession session = fp.getSession();
// if (session == null || session.hasFastMode()) {
// run.accept(new NullAnvilHistory());
// } else {
// AnvilHistory history = new AnvilHistory(world.getName(), fp.getUUID());
// run.accept(history);
// session.remember(fp.getPlayer(), world, history, fp.getLimit());
// }
// }
// /**
// * Run safely on an unloaded world (no selection)
// *
// * @param player
// * @param folder
// * @param filter
// * @param <G>
// * @param <T>
// * @return
// */
// @Deprecated
// public static <G, T extends MCAFilter<G>> T runWithWorld(Player player, String folder, T filter, boolean force) {
// return runWithWorld(player, folder, filter, force, false);
// }
//
//
// @Deprecated
// public static <G, T extends MCAFilter<G>> T runWithWorld(Player player, String folder, T filter, boolean force, boolean unsafe) {
// boolean copy = false;
// if (FaweAPI.getWorld(folder) != null) {
// if (!force) {
// player.print(TranslatableComponent.of("fawe.worldedit.anvil.world.is.loaded"))
// return null;
// }
// copy = true;
// }
// IQueueExtent defaultQueue = SetQueue.IMP.getNewQueue(folder, true, false);
// MCAQueue queue = new MCAQueue(defaultQueue);
// if (copy && !unsafe) {
// return queue.filterCopy(filter, RegionWrapper.GLOBAL());
// } else {
// return queue.filterWorld(filter);
// }
// }
//
// /**
// * Run safely on an existing world within a selection
// *
// * @param player
// * @param editSession
// * @param selection
// * @param filter
// * @param <G>
// * @param <T>
// * @return
// */
// @Deprecated
// public static <G, T extends MCAFilter<G>> T runWithSelection(Player player, EditSession editSession, Region selection, T filter) {
// if (!(selection instanceof CuboidRegion)) {
// player.print(TranslatableComponent.of("fawe.error.no.region"))
// return null;
// }
// CuboidRegion cuboid = (CuboidRegion) selection;
// RegionWrapper wrappedRegion = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint());
// String worldName = editSession.getWorld().getName();
// IQueueExtent tmp = SetQueue.IMP.getNewQueue(worldName, true, false);
// MCAQueue queue = new MCAQueue(tmp);
// FawePlayer<Object> fp = FawePlayer.wrap(player);
// fp.checkAllowedRegion(selection);
// recordHistory(fp, editSession.getWorld(), iAnvilHistory -> {
// queue.filterCopy(filter, wrappedRegion, iAnvilHistory);
// });
// return filter;
// }
//
// public static void recordHistory(FawePlayer fp, World world, Consumer<IAnvilHistory> run) {
// LocalSession session = fp.getSession();
// if (session == null || session.hasFastMode()) {
// run.accept(new NullAnvilHistory());
// } else {
// AnvilHistory history = new AnvilHistory(world.getName(), fp.getUUID());
// run.accept(history);
// session.remember(fp.getPlayer(), world, history, fp.getLimit());
// }
// }
@Command(
name = "replaceall",
aliases = {"rea", "repall"},
desc = "Replace all blocks in the selection with another"
)
)
@CommandPermissions("worldedit.anvil.replaceall")
public void replaceAll(Player player, String folder,
@Arg(name = "from", desc = "String", def = "")
@ -119,19 +120,19 @@ public class AnvilCommands {
String toPatternStr,
@Switch(name = 'd', desc = "Disable wildcard data matching")
boolean useData) throws WorldEditException {
// final FaweBlockMatcher matchFrom; TODO NOT IMPLEMENTED
// if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR;
// } else {
// if (from.contains(":")) {
// useData = true; //override d flag, if they specified data they want it
// }
// matchFrom = FaweBlockMatcher.fromBlocks(worldEdit.getBlocks(player, from, true), useData);
// }
// final FaweBlockMatcher matchTo = FaweBlockMatcher.setBlocks(worldEdit.getBlocks(player, to, true));
// ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo);
// ReplaceSimpleFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// final FaweBlockMatcher matchFrom; TODO NOT IMPLEMENTED
// if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR;
// } else {
// if (from.contains(":")) {
// useData = true; //override d flag, if they specified data they want it
// }
// matchFrom = FaweBlockMatcher.fromBlocks(worldEdit.getBlocks(player, from, true), useData);
// }
// final FaweBlockMatcher matchTo = FaweBlockMatcher.setBlocks(worldEdit.getBlocks(player, to, true));
// ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo);
// ReplaceSimpleFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
}
@Command(
@ -141,15 +142,15 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.remapall")
public void remapall(Player player, String folder) throws WorldEditException {
// ClipboardRemapper.RemapPlatform from; TODO NOT IMPLEMENTED
// ClipboardRemapper.RemapPlatform to;
// from = ClipboardRemapper.RemapPlatform.PE;
// to = ClipboardRemapper.RemapPlatform.PC;
// RemapFilter filter = new RemapFilter(from, to);
// RemapFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// ClipboardRemapper.RemapPlatform from; TODO NOT IMPLEMENTED
// ClipboardRemapper.RemapPlatform to;
// from = ClipboardRemapper.RemapPlatform.PE;
// to = ClipboardRemapper.RemapPlatform.PC;
// RemapFilter filter = new RemapFilter(from, to);
// RemapFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@ -164,11 +165,11 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.deleteallunvisited")
public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Arg(desc = "int", def = "60000") int fileDurationMillis) throws WorldEditException {
// DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
// DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
// DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -180,18 +181,18 @@ public class AnvilCommands {
"Have not been accessed since `file-duration` (ms) after creation and\n" +
"Have not been used in the past `chunk-inactivity` (ms)" +
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
)
)
@CommandPermissions("worldedit.anvil.deleteallunclaimed")
public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Arg(desc = "int", def = "60000") int fileDurationMillis, @Switch(name = 'd', desc = "TODO") boolean debug) throws WorldEditException {
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
// if (debug) {
// filter.enableDebug();
// }
// DeleteUnclaimedFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
// if (debug) {
// filter.enableDebug();
// }
// DeleteUnclaimedFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -203,17 +204,17 @@ public class AnvilCommands {
"Have not been accessed since `file-duration` (ms) after creation and\n" +
"Have not been used in the past `chunk-inactivity` (ms)" +
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
)
)
@CommandPermissions("worldedit.anvil.deleteunclaimed")
public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Arg(desc = "int", def = "60000") int fileDurationMillis, @Switch(name = 'd', desc = "TODO") boolean debug) throws WorldEditException {
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
// if (debug) {
// filter.enableDebug();
// }
// DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
// if (debug) {
// filter.enableDebug();
// }
// DeleteUnclaimedFilter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -225,12 +226,12 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.deletealloldregions")
public void deleteAllOldRegions(Player player, String folder, String time) throws WorldEditException {
// long duration = MainUtil.timeToSec(time) * 1000L; TODO NOT IMPLEMENTED
// DeleteOldFilter filter = new DeleteOldFilter(duration);
// DeleteOldFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// long duration = MainUtil.timeToSec(time) * 1000L; TODO NOT IMPLEMENTED
// DeleteOldFilter filter = new DeleteOldFilter(duration);
// DeleteOldFilter result = runWithWorld(player, folder, filter, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -241,16 +242,16 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.trimallplots")
public void trimAllPlots(Player player, @Switch(name = 'v', desc = "Delete unvisited chunks") boolean deleteUnvisited) throws WorldEditException {
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
// int visitTime = deleteUnvisited ? 1 : -1;
// PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000);
//// PlotTrimFilter result = runWithWorld(player, folder, filter, true);
// IQueueExtent defaultQueue = SetQueue.IMP.getNewQueue(folder, true, false);
// MCAQueue queue = new MCAQueue(defaultQueue);
// PlotTrimFilter result = queue.filterWorld(filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
// int visitTime = deleteUnvisited ? 1 : -1;
// PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000);
//// PlotTrimFilter result = runWithWorld(player, folder, filter, true);
// IQueueExtent defaultQueue = SetQueue.IMP.getNewQueue(folder, true, false);
// MCAQueue queue = new MCAQueue(defaultQueue);
// PlotTrimFilter result = queue.filterWorld(filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -259,11 +260,11 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.trimallair")
public void deleteBiome(Player player, String folder, BiomeType biome, @Switch(name = 'u', desc = "TODO") boolean unsafe) {
// DeleteBiomeFilterSimple filter = new DeleteBiomeFilterSimple(biome); TODO NOT IMPLEMENTED
// DeleteBiomeFilterSimple result = runWithWorld(player, folder, filter, true, unsafe);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// DeleteBiomeFilterSimple filter = new DeleteBiomeFilterSimple(biome); TODO NOT IMPLEMENTED
// DeleteBiomeFilterSimple result = runWithWorld(player, folder, filter, true, unsafe);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -272,11 +273,11 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.trimallair")
public void trimAllAir(Player player, String folder, @Switch(name = 'u', desc = "TODO") boolean unsafe) throws WorldEditException {
// TrimAirFilter filter = new TrimAirFilter(); TODO NOT IMPLEMENTED
// TrimAirFilter result = runWithWorld(player, folder, filter, true, unsafe);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// TrimAirFilter filter = new TrimAirFilter(); TODO NOT IMPLEMENTED
// TrimAirFilter result = runWithWorld(player, folder, filter, true, unsafe);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -286,11 +287,11 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.debugfixroads")
public void debugfixroads(Player player, String folder) throws WorldEditException {
// DebugFixP2Roads filter = new DebugFixP2Roads(); TODO NOT IMPLEMENTED
// DebugFixP2Roads result = runWithWorld(player, folder, filter, true, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// DebugFixP2Roads filter = new DebugFixP2Roads(); TODO NOT IMPLEMENTED
// DebugFixP2Roads result = runWithWorld(player, folder, filter, true, true);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -300,26 +301,26 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.replaceall")
public void replaceAllPattern(Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, Pattern toPattern, @Switch(name = 'd', desc = "TODO") boolean useData, @Switch(name = 'm', desc = "TODO") boolean useMap) throws WorldEditException {
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
// if (useMap) {
// if (to instanceof RandomPattern) {
// List<String> split = StringMan.split(from, ',');
// filter = new MappedReplacePatternFilter(from, (RandomPattern) to, useData);
// } else {
// player.print("Must be a pattern list!");
// return;
// }
// } else {
// final FaweBlockMatcher matchFrom;
// if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR;
// } else {
// matchFrom = FaweBlockMatcher.fromBlocks(worldEdit.getBlocks(player, from, true), useData || from.contains(":"));
// }
// filter = new ReplacePatternFilter(matchFrom, to);
// }
// MCAFilterCounter result = runWithWorld(player, folder, filter, true);
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
// if (useMap) {
// if (to instanceof RandomPattern) {
// List<String> split = StringMan.split(from, ',');
// filter = new MappedReplacePatternFilter(from, (RandomPattern) to, useData);
// } else {
// player.print("Must be a pattern list!");
// return;
// }
// } else {
// final FaweBlockMatcher matchFrom;
// if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR;
// } else {
// matchFrom = FaweBlockMatcher.fromBlocks(worldEdit.getBlocks(player, from, true), useData || from.contains(":"));
// }
// filter = new ReplacePatternFilter(matchFrom, to);
// }
// MCAFilterCounter result = runWithWorld(player, folder, filter, true);
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
}
//
@ -329,19 +330,19 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.countall")
public void countAll(Player player, EditSession editSession, String folder, String argStr, @Switch(name = 'd', desc = "TODO") boolean useData) throws WorldEditException {
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true);
// MCAFilterCounter filter;
// if (useData || arg.contains(":")) { // Optimize for both cases
// CountFilter counter = new CountFilter();
// searchBlocks.forEach(counter::addBlock);
// filter = counter;
// } else {
// CountIdFilter counter = new CountIdFilter();
// searchBlocks.forEach(counter::addBlock);
// filter = counter;
// }
// MCAFilterCounter result = runWithWorld(player, folder, filter, true);
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true);
// MCAFilterCounter filter;
// if (useData || arg.contains(":")) { // Optimize for both cases
// CountFilter counter = new CountFilter();
// searchBlocks.forEach(counter::addBlock);
// filter = counter;
// } else {
// CountIdFilter counter = new CountIdFilter();
// searchBlocks.forEach(counter::addBlock);
// filter = counter;
// }
// MCAFilterCounter result = runWithWorld(player, folder, filter, true);
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
}
@Command(
@ -351,50 +352,50 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.clear")
public void unset(Player player, EditSession editSession, @Selection Region selection) throws WorldEditException {
// BlockVector3 bot = selection.getMinimumPoint(); TODO NOT IMPLEMENTED
// BlockVector3 top = selection.getMaximumPoint();
// RegionWrapper region = new RegionWrapper(bot, top);
//
// MCAFilterCounter filter = new MCAFilterCounter() {
// @Override
// public MCAFile applyFile(MCAFile file) {
// int X = file.getX();
// int Z = file.getZ();
// int bcx = X << 5;
// int bcz = Z << 5;
// int bx = X << 9;
// int bz = Z << 9;
// if (region.isIn(bx, bz) && region.isIn(bx + 511, bz + 511)) {
// file.setDeleted(true);
// get().add(512 * 512 * 256);
// } else if (region.isInMCA(X, Z)) {
// file.init();
// final byte[] empty = new byte[4];
// RandomAccessFile raf = file.getRandomAccessFile();
// file.forEachChunk(new RunnableVal4<Integer, Integer, Integer, Integer>() {
// @Override
// public void run(Integer cx, Integer cz, Integer offset, Integer size) {
// if (region.isInChunk(bcx + cx, bcz + cz)) {
// int index = ((cx & 31) << 2) + ((cz & 31) << 7);
// try {
// raf.seek(index);
// raf.write(empty);
// get().add(16 * 16 * 256);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// });
// file.clear();
// }
// return null;
// }
// };
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// BlockVector3 bot = selection.getMinimumPoint(); TODO NOT IMPLEMENTED
// BlockVector3 top = selection.getMaximumPoint();
// RegionWrapper region = new RegionWrapper(bot, top);
//
// MCAFilterCounter filter = new MCAFilterCounter() {
// @Override
// public MCAFile applyFile(MCAFile file) {
// int X = file.getX();
// int Z = file.getZ();
// int bcx = X << 5;
// int bcz = Z << 5;
// int bx = X << 9;
// int bz = Z << 9;
// if (region.isIn(bx, bz) && region.isIn(bx + 511, bz + 511)) {
// file.setDeleted(true);
// get().add(512 * 512 * 256);
// } else if (region.isInMCA(X, Z)) {
// file.init();
// final byte[] empty = new byte[4];
// RandomAccessFile raf = file.getRandomAccessFile();
// file.forEachChunk(new RunnableVal4<Integer, Integer, Integer, Integer>() {
// @Override
// public void run(Integer cx, Integer cz, Integer offset, Integer size) {
// if (region.isInChunk(bcx + cx, bcz + cz)) {
// int index = ((cx & 31) << 2) + ((cz & 31) << 7);
// try {
// raf.seek(index);
// raf.write(empty);
// get().add(16 * 16 * 256);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// });
// file.clear();
// }
// return null;
// }
// };
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -403,19 +404,19 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.count")
public void count(Player player, EditSession editSession, @Selection Region selection, String argStr, @Switch(name = 'd', desc = "TODO") boolean useData) throws WorldEditException {
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true); TODO NOT IMPLEMENTED
// MCAFilterCounter filter;
// if (useData || arg.contains(":")) { // Optimize for both cases
// CountFilter counter = new CountFilter();
// searchBlocks.forEach(counter::addBlock);
// filter = counter;
// } else {
// CountIdFilter counter = new CountIdFilter();
// searchBlocks.forEach(counter::addBlock);
// filter = counter;
// }
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true); TODO NOT IMPLEMENTED
// MCAFilterCounter filter;
// if (useData || arg.contains(":")) { // Optimize for both cases
// CountFilter counter = new CountFilter();
// searchBlocks.forEach(counter::addBlock);
// filter = counter;
// } else {
// CountIdFilter counter = new CountIdFilter();
// searchBlocks.forEach(counter::addBlock);
// filter = counter;
// }
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) player.print(TranslatableComponent.of("fawe.worldedit.selection.selection.count", (result.getTotal())));
}
//
@ -425,75 +426,75 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.distr")
public void distr(Player player, EditSession editSession, @Selection Region selection, @Switch(name = 'd', desc = "TODO") boolean useData) throws WorldEditException {
// long total = 0; TODO NOT IMPLEMENTED
// long[] count;
// MCAFilter<long[]> counts;
// if (useData) {
// counts = runWithSelection(player, editSession, selection, new MCAFilter<long[]>() {
// @Override
// public void applyBlock(int x, int y, int z, BaseBlock block, long[] counts) {
// counts[block.getCombined()]++;
// }
//
// @Override
// public long[] init() {
// return new long[Character.MAX_VALUE + 1];
// }
// });
// count = new long[Character.MAX_VALUE + 1];
// } else {
// counts = runWithSelection(player, editSession, selection, new MCAFilter<long[]>() {
// @Override
// public void applyBlock(int x, int y, int z, BaseBlock block, long[] counts) {
// counts[block.getId()]++;
// }
//
// @Override
// public long[] init() {
// return new long[4096];
// }
// });
// count = new long[4096];
// }
// for (long[] value : counts) {
// for (int i = 0; i < value.length; i++) {
// count[i] += value[i];
// total += value[i];
// }
// }
// ArrayList<long[]> map = new ArrayList<>();
// for (int i = 0; i < count.length; i++) {
// if (count[i] != 0) map.add(new long[]{i, count[i]});
// }
// Collections.sort(map, new Comparator<long[]>() {
// @Override
// public int compare(long[] a, long[] b) {
// long vA = a[1];
// long vB = b[1];
// return (vA < vB) ? -1 : ((vA == vB) ? 0 : 1);
// }
// });
// if (useData) {
// for (long[] c : map) {
// BaseBlock block = FaweCache.IMP.CACHE_BLOCK[(int) c[0]];
// String name = BlockType.fromID(block.getId()).getName();
// String str = String.format("%-7s (%.3f%%) %s #%d:%d",
// String.valueOf(c[1]),
// ((c[1] * 10000) / total) / 100d,
// name == null ? "Unknown" : name,
// block.getType(), block.getData());
// player.print(str);
// }
// } else {
// for (long[] c : map) {
// BlockType block = BlockType.fromID((int) c[0]);
// String str = String.format("%-7s (%.3f%%) %s #%d",
// String.valueOf(c[1]),
// ((c[1] * 10000) / total) / 100d,
// block == null ? "Unknown" : block.getName(), c[0]);
// player.print(str);
// }
// }
// long total = 0; TODO NOT IMPLEMENTED
// long[] count;
// MCAFilter<long[]> counts;
// if (useData) {
// counts = runWithSelection(player, editSession, selection, new MCAFilter<long[]>() {
// @Override
// public void applyBlock(int x, int y, int z, BaseBlock block, long[] counts) {
// counts[block.getCombined()]++;
// }
//
// @Override
// public long[] init() {
// return new long[Character.MAX_VALUE + 1];
// }
// });
// count = new long[Character.MAX_VALUE + 1];
// } else {
// counts = runWithSelection(player, editSession, selection, new MCAFilter<long[]>() {
// @Override
// public void applyBlock(int x, int y, int z, BaseBlock block, long[] counts) {
// counts[block.getId()]++;
// }
//
// @Override
// public long[] init() {
// return new long[4096];
// }
// });
// count = new long[4096];
// }
// for (long[] value : counts) {
// for (int i = 0; i < value.length; i++) {
// count[i] += value[i];
// total += value[i];
// }
// }
// ArrayList<long[]> map = new ArrayList<>();
// for (int i = 0; i < count.length; i++) {
// if (count[i] != 0) map.add(new long[]{i, count[i]});
// }
// Collections.sort(map, new Comparator<long[]>() {
// @Override
// public int compare(long[] a, long[] b) {
// long vA = a[1];
// long vB = b[1];
// return (vA < vB) ? -1 : ((vA == vB) ? 0 : 1);
// }
// });
// if (useData) {
// for (long[] c : map) {
// BaseBlock block = FaweCache.IMP.CACHE_BLOCK[(int) c[0]];
// String name = BlockType.fromID(block.getId()).getName();
// String str = String.format("%-7s (%.3f%%) %s #%d:%d",
// String.valueOf(c[1]),
// ((c[1] * 10000) / total) / 100d,
// name == null ? "Unknown" : name,
// block.getType(), block.getData());
// player.print(str);
// }
// } else {
// for (long[] c : map) {
// BlockType block = BlockType.fromID((int) c[0]);
// String str = String.format("%-7s (%.3f%%) %s #%d",
// String.valueOf(c[1]),
// ((c[1] * 10000) / total) / 100d,
// block == null ? "Unknown" : block.getName(), c[0]);
// player.print(str);
// }
// }
}
//
@ -504,18 +505,18 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.replace")
public void replace(Player player, EditSession editSession, @Selection Region selection, @Arg(name = "from", desc = "String", def = "") String from, String toStr, @Switch(name = 'd', desc = "TODO") boolean useData) throws WorldEditException {
// final FaweBlockMatcher matchFrom; TODO NOT IMPLEMENTED
// if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR;
// } else {
// matchFrom = FaweBlockMatcher.fromBlocks(worldEdit.getBlocks(player, from, true), useData || from.contains(":"));
// }
// final FaweBlockMatcher matchTo = FaweBlockMatcher.setBlocks(worldEdit.getBlocks(player, to, true));
// ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo);
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// final FaweBlockMatcher matchFrom; TODO NOT IMPLEMENTED
// if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR;
// } else {
// matchFrom = FaweBlockMatcher.fromBlocks(worldEdit.getBlocks(player, from, true), useData || from.contains(":"));
// }
// final FaweBlockMatcher matchTo = FaweBlockMatcher.setBlocks(worldEdit.getBlocks(player, to, true));
// ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo);
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
//
@ -526,28 +527,28 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.replace")
public void replacePattern(Player player, EditSession editSession, @Selection Region selection, @Arg(name = "from", desc = "String", def = "") String from, final Pattern toPattern, @Switch(name = 'd', desc = "TODO") boolean useData, @Switch(name = 'm', desc = "TODO") boolean useMap) throws WorldEditException {
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
// if (useMap) {
// if (to instanceof RandomPattern) {
// List<String> split = StringMan.split(from, ',');
// filter = new MappedReplacePatternFilter(from, (RandomPattern) to, useData);
// } else {
// player.print("Must be a pattern list!");
// return;
// }
// } else {
// final FaweBlockMatcher matchFrom;
// if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR;
// } else {
// matchFrom = FaweBlockMatcher.fromBlocks(worldEdit.getBlocks(player, from, true), useData || from.contains(":"));
// }
// filter = new ReplacePatternFilter(matchFrom, to);
// }
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
// if (useMap) {
// if (to instanceof RandomPattern) {
// List<String> split = StringMan.split(from, ',');
// filter = new MappedReplacePatternFilter(from, (RandomPattern) to, useData);
// } else {
// player.print("Must be a pattern list!");
// return;
// }
// } else {
// final FaweBlockMatcher matchFrom;
// if (from == null) {
// matchFrom = FaweBlockMatcher.NOT_AIR;
// } else {
// matchFrom = FaweBlockMatcher.fromBlocks(worldEdit.getBlocks(player, from, true), useData || from.contains(":"));
// }
// filter = new ReplacePatternFilter(matchFrom, to);
// }
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -557,11 +558,11 @@ public class AnvilCommands {
@CommandPermissions("worldedit.anvil.set")
// Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern toPattern, @Switch(name = 'd', desc = "TODO") boolean useData, @Switch(name = 'm', desc = "TODO") boolean useMap
public void set(Player player, EditSession editSession, @Selection Region selection, final Pattern toPattern) throws WorldEditException {
// MCAFilterCounter filter = new SetPatternFilter(to); TODO NOT IMPLEMENTED
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// MCAFilterCounter filter = new SetPatternFilter(to); TODO NOT IMPLEMENTED
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@Command(
@ -571,15 +572,15 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.removelayer")
public void removeLayers(Player player, EditSession editSession, @Selection Region selection, int id) throws WorldEditException {
// BlockVector3 min = selection.getMinimumPoint(); TODO NOT IMPLEMENTED
// BlockVector3 max = selection.getMaximumPoint();
// int minY = min.getBlockY();
// int maxY = max.getBlockY();
// RemoveLayerFilter filter = new RemoveLayerFilter(minY, maxY, id);
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
// BlockVector3 min = selection.getMinimumPoint(); TODO NOT IMPLEMENTED
// BlockVector3 max = selection.getMaximumPoint();
// int minY = min.getBlockY();
// int maxY = max.getBlockY();
// RemoveLayerFilter filter = new RemoveLayerFilter(minY, maxY, id);
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
// if (result != null) {
// player.print(TranslatableComponent.of("fawe.worldedit.visitor.visitor.block", (result.getTotal())));
// }
}
@ -589,19 +590,19 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.copychunks")
public void copy(Player player, LocalSession session, EditSession editSession, @Selection Region selection) throws WorldEditException {
// if (!(selection instanceof CuboidRegion)) { TODO NOT IMPLEMENTED
// player.print(TranslatableComponent.of("fawe.error.no.region"))
// return;
// }
// CuboidRegion cuboid = (CuboidRegion) selection;
// String worldName = editSession.getWorld().getName();
// IQueueExtent tmp = SetQueue.IMP.getNewQueue(worldName, true, false);
// MCAQueue queue = new MCAQueue(tmp);
// BlockVector3 origin = session.getPlacementPosition(player);
// MCAClipboard clipboard = new MCAClipboard(queue, cuboid, origin);
// FawePlayer fp = FawePlayer.wrap(player);
// fp.setMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD, clipboard);
// player.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy" , selection.getArea()));
// if (!(selection instanceof CuboidRegion)) { TODO NOT IMPLEMENTED
// player.print(TranslatableComponent.of("fawe.error.no.region"))
// return;
// }
// CuboidRegion cuboid = (CuboidRegion) selection;
// String worldName = editSession.getWorld().getName();
// IQueueExtent tmp = SetQueue.IMP.getNewQueue(worldName, true, false);
// MCAQueue queue = new MCAQueue(tmp);
// BlockVector3 origin = session.getPlacementPosition(player);
// MCAClipboard clipboard = new MCAClipboard(queue, cuboid, origin);
// FawePlayer fp = FawePlayer.wrap(player);
// fp.setMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD, clipboard);
// player.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy" , selection.getArea()));
}
@Command(
@ -612,32 +613,32 @@ public class AnvilCommands {
)
@CommandPermissions("worldedit.anvil.pastechunks")
public void paste(Player player, LocalSession session, EditSession editSession, @Switch(name = 'c', desc = "TODO") boolean alignChunk) throws WorldEditException, IOException {
// FawePlayer fp = FawePlayer.wrap(player); TODO NOT IMPLEMENTED
// MCAClipboard clipboard = fp.getMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD);
// if (clipboard == null) {
// fp.sendMessage("You must first use `//anvil copy`");
// return;
// }
// CuboidRegion cuboid = clipboard.getRegion();
// RegionWrapper copyRegion = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint());
// final Vector offset = player.getPosition().subtract(clipboard.getOrigin());
// if (alignChunk) {
// offset.setComponents((offset.getBlockX() >> 4) << 4, offset.getBlockY(), (offset.getBlockZ() >> 4) << 4);
// }
// int oX = offset.getBlockX();
// int oZ = offset.getBlockZ();
// RegionWrapper pasteRegion = new RegionWrapper(copyRegion.minX + oX, copyRegion.maxX + oX, copyRegion.minZ + oZ, copyRegion.maxZ + oZ);
// String pasteWorldName = editSession.getWorld().getName();
// IQueueExtent tmpTo = SetQueue.IMP.getNewQueue(pasteWorldName, true, false);
// MCAQueue copyQueue = clipboard.getQueue();
// MCAQueue pasteQueue = new MCAQueue(tmpTo);
//
// fp.checkAllowedRegion(pasteRegion);
// recordHistory(fp, editSession.getWorld(), iAnvilHistory -> {
// try {
// pasteQueue.pasteRegion(copyQueue, copyRegion, offset, iAnvilHistory);
// } catch (IOException e) { throw new RuntimeException(e); }
// });
// player.print(TranslatableComponent.of("fawe.worldedit.paste.command.paste" , player.getPosition().toBlockVector()));
// FawePlayer fp = FawePlayer.wrap(player); TODO NOT IMPLEMENTED
// MCAClipboard clipboard = fp.getMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD);
// if (clipboard == null) {
// fp.sendMessage("You must first use `//anvil copy`");
// return;
// }
// CuboidRegion cuboid = clipboard.getRegion();
// RegionWrapper copyRegion = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint());
// final Vector offset = player.getPosition().subtract(clipboard.getOrigin());
// if (alignChunk) {
// offset.setComponents((offset.getBlockX() >> 4) << 4, offset.getBlockY(), (offset.getBlockZ() >> 4) << 4);
// }
// int oX = offset.getBlockX();
// int oZ = offset.getBlockZ();
// RegionWrapper pasteRegion = new RegionWrapper(copyRegion.minX + oX, copyRegion.maxX + oX, copyRegion.minZ + oZ, copyRegion.maxZ + oZ);
// String pasteWorldName = editSession.getWorld().getName();
// IQueueExtent tmpTo = SetQueue.IMP.getNewQueue(pasteWorldName, true, false);
// MCAQueue copyQueue = clipboard.getQueue();
// MCAQueue pasteQueue = new MCAQueue(tmpTo);
//
// fp.checkAllowedRegion(pasteRegion);
// recordHistory(fp, editSession.getWorld(), iAnvilHistory -> {
// try {
// pasteQueue.pasteRegion(copyQueue, copyRegion, offset, iAnvilHistory);
// } catch (IOException e) { throw new RuntimeException(e); }
// });
// player.print(TranslatableComponent.of("fawe.worldedit.paste.command.paste" , player.getPosition().toBlockVector()));
}
}

View File

@ -1,13 +1,14 @@
package com.boydti.fawe.command;
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.extension.input.InputParseException;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
public class SuggestInputParseException extends InputParseException {
private final InputParseException cause;

View File

@ -5,20 +5,25 @@ import com.sk89q.worldedit.util.formatting.WorldEditText;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.Style;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
public class Caption {
private static final Pattern colorCodes = Pattern.compile("&([0-9a-o])");
public static String toString(Component component) {
return toString(component, WorldEdit.getInstance().getTranslationManager().getDefaultLocale());
}
@ -39,9 +44,9 @@ public class Caption {
private static Component color(TextComponent text) {
String content = text.content();
if (content.indexOf('&') != -1) {
if (colorCodes.matcher(content).find()) {
TextComponent legacy = LegacyComponentSerializer.INSTANCE.deserialize(content, '&');
legacy = (TextComponent) legacy.style(text.style());
legacy.style().merge(text.style(), Style.Merge.Strategy.IF_ABSENT_ON_TARGET);
if (!text.children().isEmpty()) {
text = TextComponent.builder().append(legacy).append(text.children()).build();
} else {

View File

@ -1,9 +1,11 @@
package com.boydti.fawe.config;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.configuration.MemorySection;
import com.boydti.fawe.configuration.file.YamlConfiguration;
import com.boydti.fawe.util.StringMan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.PrintWriter;
@ -20,8 +22,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Config {

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.config;
import com.boydti.fawe.object.FaweLimit;
import com.sk89q.worldedit.extension.platform.Actor;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@ -14,8 +15,6 @@ public class Settings extends Config {
@Ignore
public boolean PROTOCOL_SUPPORT_FIX = false;
@Ignore
public boolean PLOTSQUARED_HOOK = true;
@Comment("These first 6 aren't configurable") // This is a comment
@Final // Indicates that this value isn't configurable
@ -46,6 +45,8 @@ public class Settings extends Config {
})
public int MAX_MEMORY_PERCENT = 95;
@Create
public ENABLED_COMPONENTS ENABLED_COMPONENTS;
@Create
public CLIPBOARD CLIPBOARD;
@Create
@ -55,6 +56,8 @@ public class Settings extends Config {
@Create
public WEB WEB;
@Create
public PLOTSQUARED_INTEGRATION PLOTSQUARED_INTEGRATION;
@Create
public EXTENT EXTENT;
@Create
public EXPERIMENTAL EXPERIMENTAL;
@ -67,11 +70,16 @@ public class Settings extends Config {
@Create
public REGION_RESTRICTIONS_OPTIONS REGION_RESTRICTIONS_OPTIONS;
@Create
public ENABLED_COMPONENTS ENABLED_COMPONENTS;
public ConfigBlock<LIMITS> LIMITS;
@Comment("Enable or disable core components")
public static final class ENABLED_COMPONENTS {
public boolean COMMANDS = true;
@Comment({
"Disable the FAWE-PlotSquared hook to take over most intense P2 queueing",
"Specific aspects can be turned on and off further below"
})
public boolean PLOTSQUARED_HOOK = true;
}
@Comment("Paths for various directories")
@ -103,10 +111,6 @@ public class Settings extends Config {
public String MODE = "MEMBER";
}
@Create // This value will be generated automatically
public ConfigBlock<LIMITS> LIMITS;
@Comment({
"The \"default\" limit group affects those without a specific limit permission.",
"To grant someone different limits, copy the default limits group",
@ -388,6 +392,13 @@ public class Settings extends Config {
public boolean ALLOW_TICK_EXISTING = true;
}
public static class PLOTSQUARED_INTEGRATION {
public boolean CLEAR = true;
public boolean CUBOIDS = true;
public boolean COPY_AND_SWAP = true;
public boolean SET_BIOME = true;
}
public static class WEB {
@Comment({
"Should download urls be shortened?",

View File

@ -15,9 +15,10 @@
*/
package org.yaml.snakeyaml;
import org.yaml.snakeyaml.nodes.Tag;
import java.util.HashMap;
import java.util.Map;
import org.yaml.snakeyaml.nodes.Tag;
/**
* Provides additional runtime information necessary to create a custom Java

View File

@ -1,30 +1,5 @@
/**
* Copyright (c) 2008, http://www.snakeyaml.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yaml.snakeyaml;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
import org.yaml.snakeyaml.DumperOptions.FlowStyle;
import org.yaml.snakeyaml.composer.Composer;
import org.yaml.snakeyaml.constructor.BaseConstructor;
@ -44,6 +19,17 @@ import org.yaml.snakeyaml.representer.Representer;
import org.yaml.snakeyaml.resolver.Resolver;
import org.yaml.snakeyaml.serializer.Serializer;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
/**
* Public YAML interface. Each Thread must have its own instance.
*/
@ -65,8 +51,7 @@ public class Yaml {
/**
* Create Yaml instance.
*
* @param dumperOptions
* DumperOptions to configure outgoing objects
* @param dumperOptions DumperOptions to configure outgoing objects
*/
public Yaml(DumperOptions dumperOptions) {
this(new Constructor(), new Representer(), dumperOptions);
@ -76,8 +61,7 @@ public class Yaml {
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param representer
* Representer to emit outgoing objects
* @param representer Representer to emit outgoing objects
*/
public Yaml(Representer representer) {
this(new Constructor(), representer);
@ -87,8 +71,7 @@ public class Yaml {
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor
* BaseConstructor to construct incoming documents
* @param constructor BaseConstructor to construct incoming documents
*/
public Yaml(BaseConstructor constructor) {
this(constructor, new Representer());
@ -98,10 +81,8 @@ public class Yaml {
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor
* BaseConstructor to construct incoming documents
* @param representer
* Representer to emit outgoing objects
* @param constructor BaseConstructor to construct incoming documents
* @param representer Representer to emit outgoing objects
*/
public Yaml(BaseConstructor constructor, Representer representer) {
this(constructor, representer, new DumperOptions());
@ -111,10 +92,8 @@ public class Yaml {
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param representer
* Representer to emit outgoing objects
* @param dumperOptions
* DumperOptions to configure outgoing objects
* @param representer Representer to emit outgoing objects
* @param dumperOptions DumperOptions to configure outgoing objects
*/
public Yaml(Representer representer, DumperOptions dumperOptions) {
this(new Constructor(), representer, dumperOptions, new Resolver());
@ -124,12 +103,9 @@ public class Yaml {
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor
* BaseConstructor to construct incoming documents
* @param representer
* Representer to emit outgoing objects
* @param dumperOptions
* DumperOptions to configure outgoing objects
* @param constructor BaseConstructor to construct incoming documents
* @param representer Representer to emit outgoing objects
* @param dumperOptions DumperOptions to configure outgoing objects
*/
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions) {
this(constructor, representer, dumperOptions, new Resolver());
@ -139,17 +115,12 @@ public class Yaml {
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor
* BaseConstructor to construct incoming documents
* @param representer
* Representer to emit outgoing objects
* @param dumperOptions
* DumperOptions to configure outgoing objects
* @param resolver
* Resolver to detect implicit type
* @param constructor BaseConstructor to construct incoming documents
* @param representer Representer to emit outgoing objects
* @param dumperOptions DumperOptions to configure outgoing objects
* @param resolver Resolver to detect implicit type
*/
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions,
Resolver resolver) {
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions, Resolver resolver) {
if (!constructor.isExplicitPropertyUtils()) {
constructor.setPropertyUtils(representer.getPropertyUtils());
} else if (!representer.isExplicitPropertyUtils()) {
@ -158,8 +129,7 @@ public class Yaml {
this.constructor = constructor;
representer.setDefaultFlowStyle(dumperOptions.getDefaultFlowStyle());
representer.setDefaultScalarStyle(dumperOptions.getDefaultScalarStyle());
representer.getPropertyUtils().setAllowReadOnlyProperties(
dumperOptions.isAllowReadOnlyProperties());
representer.getPropertyUtils().setAllowReadOnlyProperties(dumperOptions.isAllowReadOnlyProperties());
representer.setTimeZone(dumperOptions.getTimeZone());
this.representer = representer;
this.dumperOptions = dumperOptions;
@ -170,8 +140,7 @@ public class Yaml {
/**
* Serialize a Java object into a YAML String.
*
* @param data
* Java object to be Serialized to YAML
* @param data Java object to be Serialized to YAML
* @return YAML String
*/
public String dump(Object data) {
@ -183,11 +152,10 @@ public class Yaml {
/**
* Produce the corresponding representation tree for a given Object.
*
* @param data instance to build the representation tree for
* @return representation tree
* @see <a href="http://yaml.org/spec/1.1/#id859333">Figure 3.1. Processing
* Overview</a>
* @param data
* instance to build the representation tree for
* @return representation tree
*/
public Node represent(Object data) {
return representer.represent(data);
@ -196,8 +164,7 @@ public class Yaml {
/**
* Serialize a sequence of Java objects into a YAML String.
*
* @param data
* Iterator with Objects
* @param data Iterator with Objects
* @return YAML String with all the objects in proper sequence
*/
public String dumpAll(Iterator<? extends Object> data) {
@ -209,10 +176,8 @@ public class Yaml {
/**
* Serialize a Java object into a YAML stream.
*
* @param data
* Java object to be serialized to YAML
* @param output
* stream to write to
* @param data Java object to be serialized to YAML
* @param output stream to write to
*/
public void dump(Object data, Writer output) {
List<Object> list = new ArrayList<>(1);
@ -223,18 +188,15 @@ public class Yaml {
/**
* Serialize a sequence of Java objects into a YAML stream.
*
* @param data
* Iterator with Objects
* @param output
* stream to write to
* @param data Iterator with Objects
* @param output stream to write to
*/
public void dumpAll(Iterator<? extends Object> data, Writer output) {
dumpAll(data, output, null);
}
private void dumpAll(Iterator<? extends Object> data, Writer output, Tag rootTag) {
Serializer serializer = new Serializer(new Emitter(output, dumperOptions), resolver,
dumperOptions, rootTag);
Serializer serializer = new Serializer(new Emitter(output, dumperOptions), resolver, dumperOptions, rootTag);
try {
serializer.open();
while (data.hasNext()) {
@ -272,19 +234,15 @@ public class Yaml {
* handled as an instance of YourClass when loaded.
* </p>
*
* @param data
* Java object to be serialized to YAML
* @param rootTag
* the tag for the whole YAML document. The tag should be Tag.MAP
* @param data Java object to be serialized to YAML
* @param rootTag the tag for the whole YAML document. The tag should be Tag.MAP
* for a JavaBean to make the tag disappear (to use implicit tag
* !!map). If <code>null</code> is provided then the standard tag
* with the full class name is used.
* @param flowStyle
* flow style for the whole document. See Chapter 10. Collection
* @param flowStyle flow style for the whole document. See Chapter 10. Collection
* Styles http://yaml.org/spec/1.1/#id930798. If
* <code>null</code> is provided then the flow style from
* DumperOptions is used.
*
* @return YAML String
*/
public String dumpAs(Object data, Tag rootTag, FlowStyle flowStyle) {
@ -315,8 +273,7 @@ public class Yaml {
* (http://yaml.org/spec/1.1/#id934537)
* </p>
*
* @param data
* Java object to be serialized to YAML
* @param data Java object to be serialized to YAML
* @return YAML String
*/
public String dumpAsMap(Object data) {
@ -326,10 +283,9 @@ public class Yaml {
/**
* Serialize the representation tree into Events.
*
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
* @param data
* representation tree
* @param data representation tree
* @return Event list
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
*/
public List<Event> serialize(Node data) {
SilentEmitter emitter = new SilentEmitter();
@ -360,8 +316,7 @@ public class Yaml {
* Parse the only YAML document in a String and produce the corresponding
* Java object. (Because the encoding in known BOM is not respected.)
*
* @param yaml
* YAML data to load from (BOM must not be present)
* @param yaml YAML data to load from (BOM must not be present)
* @return parsed object
*/
public Object load(String yaml) {
@ -372,8 +327,7 @@ public class Yaml {
* Parse the only YAML document in a stream and produce the corresponding
* Java object.
*
* @param io
* data to load from (BOM is respected and removed)
* @param io data to load from (BOM is respected and removed)
* @return parsed object
*/
public Object load(InputStream io) {
@ -384,8 +338,7 @@ public class Yaml {
* Parse the only YAML document in a stream and produce the corresponding
* Java object.
*
* @param io
* data to load from (BOM must not be present)
* @param io data to load from (BOM must not be present)
* @return parsed object
*/
public Object load(Reader io) {
@ -396,12 +349,9 @@ public class Yaml {
* Parse the only YAML document in a stream and produce the corresponding
* Java object.
*
* @param <T>
* Class is defined by the second argument
* @param io
* data to load from (BOM must not be present)
* @param type
* Class of the object to be created
* @param <T> Class is defined by the second argument
* @param io data to load from (BOM must not be present)
* @param type Class of the object to be created
* @return parsed object
*/
@SuppressWarnings("unchecked")
@ -413,12 +363,9 @@ public class Yaml {
* Parse the only YAML document in a String and produce the corresponding
* Java object. (Because the encoding in known BOM is not respected.)
*
* @param <T>
* Class is defined by the second argument
* @param yaml
* YAML data to load from (BOM must not be present)
* @param type
* Class of the object to be created
* @param <T> Class is defined by the second argument
* @param yaml YAML data to load from (BOM must not be present)
* @param type Class of the object to be created
* @return parsed object
*/
@SuppressWarnings("unchecked")
@ -430,12 +377,9 @@ public class Yaml {
* Parse the only YAML document in a stream and produce the corresponding
* Java object.
*
* @param <T>
* Class is defined by the second argument
* @param input
* data to load from (BOM is respected and removed)
* @param type
* Class of the object to be created
* @param <T> Class is defined by the second argument
* @param input data to load from (BOM is respected and removed)
* @param type Class of the object to be created
* @return parsed object
*/
@SuppressWarnings("unchecked")
@ -453,8 +397,7 @@ public class Yaml {
* Parse all YAML documents in a String and produce corresponding Java
* objects. The documents are parsed only when the iterator is invoked.
*
* @param yaml
* YAML data to load from (BOM must not be present)
* @param yaml YAML data to load from (BOM must not be present)
* @return an iterator over the parsed Java objects in this String in proper
* sequence
*/
@ -494,8 +437,7 @@ public class Yaml {
* objects. (Because the encoding in known BOM is not respected.) The
* documents are parsed only when the iterator is invoked.
*
* @param yaml
* YAML data to load from (BOM must not be present)
* @param yaml YAML data to load from (BOM must not be present)
* @return an iterator over the parsed Java objects in this String in proper
* sequence
*/
@ -507,8 +449,7 @@ public class Yaml {
* Parse all YAML documents in a stream and produce corresponding Java
* objects. The documents are parsed only when the iterator is invoked.
*
* @param yaml
* YAML data to load from (BOM is respected and ignored)
* @param yaml YAML data to load from (BOM is respected and ignored)
* @return an iterator over the parsed Java objects in this stream in proper
* sequence
*/
@ -520,11 +461,10 @@ public class Yaml {
* Parse the first YAML document in a stream and produce the corresponding
* representation tree. (This is the opposite of the represent() method)
*
* @param yaml YAML document
* @return parsed root Node for the specified YAML document
* @see <a href="http://yaml.org/spec/1.1/#id859333">Figure 3.1. Processing
* Overview</a>
* @param yaml
* YAML document
* @return parsed root Node for the specified YAML document
*/
public Node compose(Reader yaml) {
Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
@ -536,10 +476,9 @@ public class Yaml {
* Parse all YAML documents in a stream and produce corresponding
* representation trees.
*
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
* @param yaml
* stream of YAML documents
* @param yaml stream of YAML documents
* @return parsed root Nodes for all the specified YAML documents
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
*/
public Iterable<Node> composeAll(Reader yaml) {
final Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
@ -576,12 +515,9 @@ public class Yaml {
* Add an implicit scalar detector. If an implicit scalar value matches the
* given regexp, the corresponding tag is assigned to the scalar.
*
* @param tag
* tag to assign to the node
* @param regexp
* regular expression to match against
* @param first
* a sequence of possible initial characters or null (which means
* @param tag tag to assign to the node
* @param regexp regular expression to match against
* @param first a sequence of possible initial characters or null (which means
* any).
*/
public void addImplicitResolver(Tag tag, Pattern regexp, String first) {
@ -607,8 +543,7 @@ public class Yaml {
/**
* Set a meaningful name to be shown in toString()
*
* @param name
* human readable name
* @param name human readable name
*/
public void setName(String name) {
this.name = name;
@ -617,10 +552,9 @@ public class Yaml {
/**
* Parse a YAML stream and produce parsing events.
*
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
* @param yaml
* YAML document(s)
* @param yaml YAML document(s)
* @return parsed events
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
*/
public Iterable<Event> parse(Reader yaml) {
final Parser parser = new ParserImpl(new StreamReader(yaml));

View File

@ -3,6 +3,7 @@ package com.boydti.fawe.configuration.file;
import com.boydti.fawe.configuration.Configuration;
import com.boydti.fawe.configuration.InvalidConfigurationException;
import com.boydti.fawe.configuration.MemoryConfiguration;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;

View File

@ -3,16 +3,20 @@ package com.boydti.fawe.configuration.file;
import com.boydti.fawe.configuration.Configuration;
import com.boydti.fawe.configuration.ConfigurationSection;
import com.boydti.fawe.configuration.InvalidConfigurationException;
import com.sk89q.worldedit.util.YAMLConfiguration;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.representer.Representer;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Map;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.representer.Representer;
import static org.slf4j.LoggerFactory.getLogger;
/**
* An implementation of {@link com.boydti.fawe.configuration.Configuration} which saves all files in Yaml.
@ -27,12 +31,16 @@ public class YamlConfiguration extends FileConfiguration {
/**
* Creates a new {@link com.boydti.fawe.configuration.file.YamlConfiguration}, loading from the given file.
*
* <p>
* Any errors loading the Configuration will be logged and then ignored.
* If the specified input is not a valid config, a blank config will be
* returned.
* </p>
*
* <p>
* The encoding used may follow the system dependent default.
* </p>
*
* @param file Input file
* @return Resulting configuration
@ -71,10 +79,12 @@ public class YamlConfiguration extends FileConfiguration {
/**
* Creates a new {@link com.boydti.fawe.configuration.file.YamlConfiguration}, loading from the given reader.
*
* <p>
* Any errors loading the Configuration will be logged and then ignored.
* If the specified input is not a valid config, a blank config will be
* returned.
* </p>
*
* @param reader input
* @return resulting configuration
@ -90,8 +100,7 @@ public class YamlConfiguration extends FileConfiguration {
try {
config.load(reader);
} catch (final IOException | InvalidConfigurationException ex) {
System.out.println("Cannot load configuration from stream");
ex.printStackTrace();
getLogger(YAMLConfiguration.class).error("Cannot load configuration from stream", ex);
}
return config;

View File

@ -1,8 +1,7 @@
package com.boydti.fawe.configuration.file;
/**
* Various settings for controlling the input and output of a {@link
* com.boydti.fawe.configuration.file.YamlConfiguration}
* Various settings for controlling the input and output of a {@link YamlConfiguration}.
*/
public class YamlConfigurationOptions extends FileConfigurationOptions {
private int indent = 2;
@ -42,8 +41,10 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
/**
* Gets how much spaces should be used to indent each line.
*
* <p>
* The minimum value this may be is 2, and the maximum is 9.
* </p>
*
* @return How much to indent by
*/

View File

@ -1,13 +1,14 @@
package com.boydti.fawe.configuration.file;
import com.boydti.fawe.configuration.serialization.ConfigurationSerialization;
import java.util.LinkedHashMap;
import java.util.Map;
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.Tag;
import java.util.LinkedHashMap;
import java.util.Map;
public class YamlConstructor extends SafeConstructor {
public YamlConstructor() {

View File

@ -3,11 +3,12 @@ package com.boydti.fawe.configuration.file;
import com.boydti.fawe.configuration.ConfigurationSection;
import com.boydti.fawe.configuration.serialization.ConfigurationSerializable;
import com.boydti.fawe.configuration.serialization.ConfigurationSerialization;
import java.util.LinkedHashMap;
import java.util.Map;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.representer.Representer;
import java.util.LinkedHashMap;
import java.util.Map;
public class YamlRepresenter extends Representer {
public YamlRepresenter() {

View File

@ -2,11 +2,12 @@ package com.boydti.fawe.database;
import com.boydti.fawe.config.Config;
import com.sk89q.worldedit.world.World;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class DBHandler {
private final Logger log = LoggerFactory.getLogger(Config.class);

View File

@ -9,6 +9,11 @@ import com.boydti.fawe.util.MainUtil;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.World;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
@ -24,10 +29,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import org.intellij.lang.annotations.Language;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RollbackDatabase extends AsyncNotifyQueue {

View File

@ -14,6 +14,7 @@ import com.sk89q.jnbt.LongTag;
import com.sk89q.jnbt.ShortTag;
import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

View File

@ -1,6 +1,5 @@
package com.boydti.fawe.jnbt.anvil;
import com.boydti.fawe.object.io.PGZIPOutputStream;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.jnbt.NBTOutputStream;
@ -9,7 +8,6 @@ import it.unimi.dsi.fastutil.io.FastBufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;

View File

@ -31,7 +31,6 @@ import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@ -42,6 +41,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Future;
import javax.annotation.Nullable;
public class MCAChunk implements IChunk {
public final boolean[] hasSections = new boolean[16];

View File

@ -1,7 +1,5 @@
package com.boydti.fawe.jnbt.anvil;
import static org.slf4j.LoggerFactory.getLogger;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.Trimable;
import com.boydti.fawe.beta.implementation.IChunkExtent;
@ -19,6 +17,7 @@ import com.sk89q.worldedit.world.World;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileNotFoundException;
@ -39,6 +38,8 @@ import java.util.zip.Deflater;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Chunk format: http://minecraft.gamepedia.com/Chunk_format#Entity_format
* e.g., `.Level.Entities.#` (Starts with a . as the root tag is unnamed)

View File

@ -2,14 +2,12 @@ package com.boydti.fawe.jnbt.anvil;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.google.common.base.Preconditions;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region;
@ -20,9 +18,9 @@ import com.sk89q.worldedit.world.AbstractWorld;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import javax.annotation.Nullable;
import java.io.File;
import java.util.Set;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkArgument;

View File

@ -7,6 +7,7 @@ import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.World;
import java.io.IOException;
import java.io.OutputStream;
import java.util.UUID;

View File

@ -3,6 +3,7 @@ package com.boydti.fawe.object;
import com.boydti.fawe.util.IOUtil;
import com.sk89q.jnbt.NBTInputStream;
import com.sk89q.jnbt.NamedTag;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.object;
import com.sk89q.jnbt.NBTOutputStream;
import com.sk89q.jnbt.Tag;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;

View File

@ -1,7 +1,5 @@
package com.boydti.fawe.object;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.object.changeset.AbstractChangeSet;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
@ -16,10 +14,13 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Stores changes to a {@link ChangeSet}.
*/

View File

@ -6,6 +6,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.history.change.Change;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import java.util.Collections;
import java.util.Iterator;

View File

@ -7,6 +7,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.Arrays;
public class BlendBall implements Brush {

View File

@ -10,6 +10,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.math.transform.AffineTransform;
import java.util.concurrent.ThreadLocalRandom;
public class BlobBrush implements Brush {
@ -74,10 +75,12 @@ public class BlobBrush implements Brush {
MutableVector3 mutable = new MutableVector3();
double roughness = 1 - sphericity;
for (int xr = -sizeInt; xr <= sizeInt; xr++) {
mutable.mutX(xr);
for (int yr = -sizeInt; yr <= sizeInt; yr++) {
mutable.mutY(yr);
for (int zr = -sizeInt; zr <= sizeInt; zr++) {
// pt == mutable as it's a MutableVector3
// so it must be set each time
mutable.mutX(xr);
mutable.mutY(yr);
mutable.mutZ(zr);
Vector3 pt = transform.apply(mutable);
int x = MathMan.roundInt(pt.getX());

View File

@ -1,8 +1,5 @@
package com.boydti.fawe.object.brush;
import static com.boydti.fawe.object.brush.BrushSettings.SettingType.BRUSH;
import static com.google.common.base.Preconditions.checkNotNull;
import com.boydti.fawe.object.brush.scroll.Scroll;
import com.boydti.fawe.object.extent.ResettableExtent;
import com.sk89q.worldedit.command.tool.brush.Brush;
@ -11,12 +8,16 @@ import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.expression.EvaluationException;
import com.sk89q.worldedit.internal.expression.Expression;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import static com.boydti.fawe.object.brush.BrushSettings.SettingType.BRUSH;
import static com.google.common.base.Preconditions.checkNotNull;
public class BrushSettings {
public enum SettingType {
BRUSH,
@ -29,6 +30,7 @@ public class BrushSettings {
SCROLL_ACTION,
}
private static final Expression DEFAULT_SIZE = Expression.compile("1");
private final Map<SettingType, Object> constructor = new ConcurrentHashMap<>();
@ -48,65 +50,65 @@ public class BrushSettings {
}
// TODO: Ping @MattBDev to reimplement 2020-02-04
// public static BrushSettings get(BrushTool tool, Player player, LocalSession session, Map<String, Object> settings) throws InputParseException {
// PlatformCommandManager manager = PlatformCommandManager.getInstance();
// String constructor = (String) settings.get(SettingType.BRUSH.name());
// if (constructor == null) {
// return new BrushSettings();
// }
// BrushSettings bs = manager.parseCommand(constructor, player);
// bs.constructor.put(SettingType.BRUSH, constructor);
// if (settings.containsKey(SettingType.PERMISSIONS.name())) {
// bs.permissions.addAll((Collection<? extends String>) settings.get(SettingType.PERMISSIONS.name()));
// }
// if (settings.containsKey(SettingType.SIZE.name())) {
// try {
// bs.size = Expression.compile((String) settings.getOrDefault(SettingType.SIZE.name(), -1));
// bs.size.optimize();
// } catch (ExpressionException e) {
// throw new RuntimeException(e);
// }
// }
//
// ParserContext parserContext = new ParserContext();
// parserContext.setActor(player);
// parserContext.setWorld(player.getWorld());
// parserContext.setSession(session);
//
// if (settings.containsKey(SettingType.MASK.name())) {
// String maskArgs = (String) settings.get(SettingType.MASK.name());
// Mask mask = WorldEdit.getInstance().getMaskFactory().parseFromInput(maskArgs, parserContext);
// bs.setMask(mask);
// bs.constructor.put(SettingType.MASK, maskArgs);
// }
// if (settings.containsKey(SettingType.SOURCE_MASK.name())) {
// String maskArgs = (String) settings.get(SettingType.SOURCE_MASK.name());
// Mask mask = WorldEdit.getInstance().getMaskFactory().parseFromInput(maskArgs, parserContext);
// bs.setSourceMask(mask);
// bs.constructor.put(SettingType.SOURCE_MASK, maskArgs);
// }
// if (settings.containsKey(SettingType.TRANSFORM.name())) {
// String transformArgs = (String) settings.get(SettingType.TRANSFORM.name());
// ResettableExtent extent = Fawe.get().getTransformParser().parseFromInput(transformArgs, parserContext);
// bs.setTransform(extent);
// bs.constructor.put(SettingType.TRANSFORM, transformArgs);
// }
// if (settings.containsKey(SettingType.FILL.name())) {
// String fillArgs = (String) settings.get(SettingType.FILL.name());
// Pattern pattern = WorldEdit.getInstance().getPatternFactory().parseFromInput(fillArgs, parserContext);
// bs.setFill(pattern);
// bs.constructor.put(SettingType.FILL, fillArgs);
// }
// if (settings.containsKey(SettingType.SCROLL_ACTION.name())) {
// String actionArgs = (String) settings.get(SettingType.SCROLL_ACTION.name());
// Scroll action = Scroll.fromArguments(tool, player, session, actionArgs, false);
// if (action != null) {
// bs.setScrollAction(action);
// bs.constructor.put(SettingType.SCROLL_ACTION, actionArgs);
// }
// }
// return bs;
// }
// public static BrushSettings get(BrushTool tool, Player player, LocalSession session, Map<String, Object> settings) throws InputParseException {
// PlatformCommandManager manager = PlatformCommandManager.getInstance();
// String constructor = (String) settings.get(SettingType.BRUSH.name());
// if (constructor == null) {
// return new BrushSettings();
// }
// BrushSettings bs = manager.parseCommand(constructor, player);
// bs.constructor.put(SettingType.BRUSH, constructor);
// if (settings.containsKey(SettingType.PERMISSIONS.name())) {
// bs.permissions.addAll((Collection<? extends String>) settings.get(SettingType.PERMISSIONS.name()));
// }
// if (settings.containsKey(SettingType.SIZE.name())) {
// try {
// bs.size = Expression.compile((String) settings.getOrDefault(SettingType.SIZE.name(), -1));
// bs.size.optimize();
// } catch (ExpressionException e) {
// throw new RuntimeException(e);
// }
// }
//
// ParserContext parserContext = new ParserContext();
// parserContext.setActor(player);
// parserContext.setWorld(player.getWorld());
// parserContext.setSession(session);
//
// if (settings.containsKey(SettingType.MASK.name())) {
// String maskArgs = (String) settings.get(SettingType.MASK.name());
// Mask mask = WorldEdit.getInstance().getMaskFactory().parseFromInput(maskArgs, parserContext);
// bs.setMask(mask);
// bs.constructor.put(SettingType.MASK, maskArgs);
// }
// if (settings.containsKey(SettingType.SOURCE_MASK.name())) {
// String maskArgs = (String) settings.get(SettingType.SOURCE_MASK.name());
// Mask mask = WorldEdit.getInstance().getMaskFactory().parseFromInput(maskArgs, parserContext);
// bs.setSourceMask(mask);
// bs.constructor.put(SettingType.SOURCE_MASK, maskArgs);
// }
// if (settings.containsKey(SettingType.TRANSFORM.name())) {
// String transformArgs = (String) settings.get(SettingType.TRANSFORM.name());
// ResettableExtent extent = Fawe.get().getTransformParser().parseFromInput(transformArgs, parserContext);
// bs.setTransform(extent);
// bs.constructor.put(SettingType.TRANSFORM, transformArgs);
// }
// if (settings.containsKey(SettingType.FILL.name())) {
// String fillArgs = (String) settings.get(SettingType.FILL.name());
// Pattern pattern = WorldEdit.getInstance().getPatternFactory().parseFromInput(fillArgs, parserContext);
// bs.setFill(pattern);
// bs.constructor.put(SettingType.FILL, fillArgs);
// }
// if (settings.containsKey(SettingType.SCROLL_ACTION.name())) {
// String actionArgs = (String) settings.get(SettingType.SCROLL_ACTION.name());
// Scroll action = Scroll.fromArguments(tool, player, session, actionArgs, false);
// if (action != null) {
// bs.setScrollAction(action);
// bs.constructor.put(SettingType.SCROLL_ACTION, actionArgs);
// }
// }
// return bs;
// }
public BrushSettings setBrush(Brush brush) {
Brush tmp = this.brush;
@ -148,25 +150,33 @@ public class BrushSettings {
}
public BrushSettings setMask(Mask mask) {
if (mask == null) constructor.remove(SettingType.MASK);
if (mask == null) {
constructor.remove(SettingType.MASK);
}
this.mask = mask;
return this;
}
public BrushSettings setSourceMask(Mask mask) {
if (mask == null) constructor.remove(SettingType.SOURCE_MASK);
if (mask == null) {
constructor.remove(SettingType.SOURCE_MASK);
}
this.sourceMask = mask;
return this;
}
public BrushSettings setTransform(ResettableExtent transform) {
if (transform == null) constructor.remove(SettingType.TRANSFORM);
if (transform == null) {
constructor.remove(SettingType.TRANSFORM);
}
this.transform = transform;
return this;
}
public BrushSettings setFill(Pattern pattern) {
if (pattern == null) constructor.remove(SettingType.FILL);
if (pattern == null) {
constructor.remove(SettingType.FILL);
}
this.material = pattern;
return this;
}
@ -187,7 +197,9 @@ public class BrushSettings {
}
public BrushSettings setScrollAction(Scroll scrollAction) {
if (scrollAction == null) constructor.remove(SettingType.SCROLL_ACTION);
if (scrollAction == null) {
constructor.remove(SettingType.SCROLL_ACTION);
}
this.scrollAction = scrollAction;
return this;
}
@ -245,7 +257,9 @@ public class BrushSettings {
public boolean canUse(Actor actor) {
Set<String> perms = getPermissions();
for (String perm : perms) {
if (actor.hasPermission(perm)) return true;
if (actor.hasPermission(perm)) {
return true;
}
}
return perms.isEmpty();
}

View File

@ -11,6 +11,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.util.Arrays;
import java.util.List;

Some files were not shown because too many files have changed in this diff Show More