geforkt von Mirrors/FastAsyncWorldEdit
Part 1 of upstream merge and format
Dieser Commit ist enthalten in:
Ursprung
79771e83e0
Commit
3bc692ff11
18
NOTICE.txt
Normale Datei
18
NOTICE.txt
Normale Datei
@ -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.
|
||||||
|
|
@ -51,10 +51,10 @@ version = String.format("%s-%s", rootVersion, buildNumber)
|
|||||||
if (!project.hasProperty("gitCommitHash")) {
|
if (!project.hasProperty("gitCommitHash")) {
|
||||||
apply(plugin = "org.ajoberstar.grgit")
|
apply(plugin = "org.ajoberstar.grgit")
|
||||||
ext["gitCommitHash"] = try {
|
ext["gitCommitHash"] = try {
|
||||||
(ext["grgit"] as Grgit?)?.head()?.abbreviatedId
|
extensions.getByName<Grgit>("grgit").head()?.abbreviatedId
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.warn("Error getting commit hash", e)
|
logger.warn("Error getting commit hash", e)
|
||||||
|
|
||||||
"no_git_id"
|
"no.git.id"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ configurations.all {
|
|||||||
resolutionStrategy {
|
resolutionStrategy {
|
||||||
// Fabric needs this.
|
// Fabric needs this.
|
||||||
force(
|
force(
|
||||||
"commons-io:commons-io:2.5",
|
"commons-io:commons-io:2.6",
|
||||||
"org.ow2.asm:asm:7.1",
|
"org.ow2.asm:asm:8.0.1",
|
||||||
"org.ow2.asm:asm-commons:7.1"
|
"org.ow2.asm:asm-commons:8.0.1"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,13 +48,13 @@ val mixinVersion: String = properties.getProperty("mixin.version")
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(gradleApi())
|
implementation(gradleApi())
|
||||||
implementation("gradle.plugin.net.minecrell:licenser:0.4.1")
|
implementation("gradle.plugin.net.minecrell:licenser:0.4.1")
|
||||||
implementation("org.ajoberstar.grgit:grgit-gradle:3.1.1")
|
implementation("org.ajoberstar.grgit:grgit-gradle:4.0.2")
|
||||||
implementation("com.github.jengelman.gradle.plugins:shadow:5.1.0")
|
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-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21")
|
||||||
implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.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("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:fabric-loom:$loomVersion")
|
||||||
implementation("net.fabricmc:sponge-mixin:$mixinVersion")
|
implementation("net.fabricmc:sponge-mixin:$mixinVersion")
|
||||||
implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0")
|
implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0")
|
||||||
|
@ -21,7 +21,7 @@ fun Project.applyCommonConfiguration() {
|
|||||||
}
|
}
|
||||||
configurations.all {
|
configurations.all {
|
||||||
resolutionStrategy {
|
resolutionStrategy {
|
||||||
cacheChangingModulesFor(5, "minutes")
|
cacheChangingModulesFor(5, "MINUTES")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
|||||||
|
|
||||||
// configure<CheckstyleExtension> {
|
// configure<CheckstyleExtension> {
|
||||||
// configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
// configFile = rootProject.file("config/checkstyle/checkstyle.xml")
|
||||||
// toolVersion = "7.6.1"
|
// toolVersion = "8.34"
|
||||||
// }
|
// }
|
||||||
|
|
||||||
tasks.withType<Test>().configureEach {
|
tasks.withType<Test>().configureEach {
|
||||||
|
@ -3,7 +3,7 @@ import org.gradle.api.Project
|
|||||||
object Versions {
|
object Versions {
|
||||||
const val TEXT = "3.0.4"
|
const val TEXT = "3.0.4"
|
||||||
const val TEXT_EXTRAS = "3.0.5"
|
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 AUTO_VALUE = "1.7"
|
||||||
const val JUNIT = "5.6.1"
|
const val JUNIT = "5.6.1"
|
||||||
const val MOCKITO = "3.3.3"
|
const val MOCKITO = "3.3.3"
|
||||||
|
@ -29,12 +29,6 @@ import com.boydti.fawe.util.image.ImageViewer;
|
|||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||||
import io.papermc.lib.PaperLib;
|
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.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -47,6 +41,13 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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 {
|
public class FaweBukkit implements IFawe, Listener {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(FaweBukkit.class);
|
private static final Logger log = LoggerFactory.getLogger(FaweBukkit.class);
|
||||||
@ -83,7 +84,8 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
Bukkit.getServer().shutdown();
|
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
|
//Vault is Spigot/Paper only so this needs to be done in the Bukkit module
|
||||||
setupVault();
|
setupVault();
|
||||||
@ -94,7 +96,8 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
// Registered delayed Event Listeners
|
// Registered delayed Event Listeners
|
||||||
TaskManager.IMP.task(() -> {
|
TaskManager.IMP.task(() -> {
|
||||||
// Fix for ProtocolSupport
|
// Fix for ProtocolSupport
|
||||||
Settings.IMP.PROTOCOL_SUPPORT_FIX = Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
|
Settings.IMP.PROTOCOL_SUPPORT_FIX =
|
||||||
|
Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
|
||||||
|
|
||||||
// This class
|
// This class
|
||||||
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
|
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
|
||||||
@ -112,28 +115,31 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public QueueHandler getQueueHandler() {
|
||||||
public QueueHandler getQueueHandler() {
|
|
||||||
return new BukkitQueueHandler();
|
return new BukkitQueueHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized ImageViewer getImageViewer(com.sk89q.worldedit.entity.Player player) {
|
public synchronized ImageViewer getImageViewer(com.sk89q.worldedit.entity.Player player) {
|
||||||
if (listeningImages && imageListener == null) return null;
|
if (listeningImages && imageListener == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
listeningImages = true;
|
listeningImages = true;
|
||||||
registerPacketListener();
|
registerPacketListener();
|
||||||
PluginManager manager = Bukkit.getPluginManager();
|
PluginManager manager = Bukkit.getPluginManager();
|
||||||
|
|
||||||
if (manager.getPlugin("PacketListenerApi") == null) {
|
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();
|
byte[] jarData = Jars.PL_v3_7_6.download();
|
||||||
try (FileOutputStream fos = new FileOutputStream(output)) {
|
try (FileOutputStream fos = new FileOutputStream(output)) {
|
||||||
fos.write(jarData);
|
fos.write(jarData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (manager.getPlugin("MapManager") == null) {
|
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();
|
byte[] jarData = Jars.MM_v1_7_8.download();
|
||||||
try (FileOutputStream fos = new FileOutputStream(output)) {
|
try (FileOutputStream fos = new FileOutputStream(output)) {
|
||||||
fos.write(jarData);
|
fos.write(jarData);
|
||||||
@ -144,17 +150,16 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
this.imageListener = new BukkitImageListener(plugin);
|
this.imageListener = new BukkitImageListener(plugin);
|
||||||
}
|
}
|
||||||
return viewer;
|
return viewer;
|
||||||
} catch (Throwable ignore) {}
|
} catch (Throwable ignore) {
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public void debug(final String message) {
|
||||||
public void debug(final String message) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(message);
|
Bukkit.getConsoleSender().sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public File getDirectory() {
|
||||||
public File getDirectory() {
|
|
||||||
return plugin.getDataFolder();
|
return plugin.getDataFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,9 +177,6 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Vault isn't required, but used for setting player permissions (WorldEdit bypass)
|
|
||||||
*/
|
|
||||||
private void setupVault() {
|
private void setupVault() {
|
||||||
try {
|
try {
|
||||||
this.vault = new VaultUtil();
|
this.vault = new VaultUtil();
|
||||||
@ -182,8 +184,7 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getDebugInfo() {
|
||||||
public String getDebugInfo() {
|
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Server Version: ").append(Bukkit.getVersion()).append("\n");
|
msg.append("Server Version: ").append(Bukkit.getVersion()).append("\n");
|
||||||
msg.append("Plugins: \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
|
@Override public TaskManager getTaskManager() {
|
||||||
public TaskManager getTaskManager() {
|
|
||||||
return new BukkitTaskMan(plugin);
|
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
|
* A mask manager handles region restrictions e.g., PlotSquared plots / WorldGuard regions
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override public Collection<FaweMaskManager> getMaskManagers() {
|
||||||
public Collection<FaweMaskManager> getMaskManagers() {
|
final Plugin worldguardPlugin =
|
||||||
final Plugin worldguardPlugin = Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
|
Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
|
||||||
final ArrayList<FaweMaskManager> managers = new ArrayList<>();
|
final ArrayList<FaweMaskManager> managers = new ArrayList<>();
|
||||||
if (worldguardPlugin != null && worldguardPlugin.isEnabled()) {
|
if (worldguardPlugin != null && worldguardPlugin.isEnabled()) {
|
||||||
try {
|
try {
|
||||||
@ -236,7 +236,8 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Plugin griefpreventionPlugin = Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
|
final Plugin griefpreventionPlugin =
|
||||||
|
Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention");
|
||||||
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
|
if (griefpreventionPlugin != null && griefpreventionPlugin.isEnabled()) {
|
||||||
try {
|
try {
|
||||||
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
|
managers.add(new GriefPreventionFeature(griefpreventionPlugin));
|
||||||
@ -258,8 +259,7 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
|
|
||||||
private volatile boolean keepUnloaded;
|
private volatile boolean keepUnloaded;
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR) public void onWorldLoad(WorldLoadEvent event) {
|
||||||
public void onWorldLoad(WorldLoadEvent event) {
|
|
||||||
if (keepUnloaded) {
|
if (keepUnloaded) {
|
||||||
org.bukkit.World world = event.getWorld();
|
org.bukkit.World world = event.getWorld();
|
||||||
world.setKeepSpawnInMemory(false);
|
world.setKeepSpawnInMemory(false);
|
||||||
@ -282,38 +282,34 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
wePlayer.unregister();
|
wePlayer.unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getPlatform() {
|
||||||
public String getPlatform() {
|
|
||||||
return "Bukkit";
|
return "Bukkit";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public UUID getUUID(String name) {
|
||||||
public UUID getUUID(String name) {
|
|
||||||
return Bukkit.getOfflinePlayer(name).getUniqueId();
|
return Bukkit.getOfflinePlayer(name).getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public String getName(UUID uuid) {
|
||||||
public String getName(UUID uuid) {
|
|
||||||
return Bukkit.getOfflinePlayer(uuid).getName();
|
return Bukkit.getOfflinePlayer(uuid).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public Preloader getPreloader() {
|
||||||
public Preloader getPreloader() {
|
|
||||||
if (PaperLib.isPaper()) {
|
if (PaperLib.isPaper()) {
|
||||||
return new AsyncPreloader();
|
return new AsyncPreloader();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override public boolean isChunksStretched() {
|
||||||
public boolean isChunksStretched() {
|
|
||||||
return chunksStretched;
|
return chunksStretched;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupPlotSquared() {
|
private void setupPlotSquared() {
|
||||||
Plugin plotSquared = this.plugin.getServer().getPluginManager().getPlugin("PlotSquared");
|
Plugin plotSquared = this.plugin.getServer().getPluginManager().getPlugin("PlotSquared");
|
||||||
if (plotSquared == null)
|
if (plotSquared == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (plotSquared.getClass().getPackage().toString().contains("intellectualsites")) {
|
if (plotSquared.getClass().getPackage().toString().contains("intellectualsites")) {
|
||||||
WEManager.IMP.managers
|
WEManager.IMP.managers
|
||||||
.add(new com.boydti.fawe.bukkit.regions.plotsquaredv4.PlotSquaredFeature());
|
.add(new com.boydti.fawe.bukkit.regions.plotsquaredv4.PlotSquaredFeature());
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
package com.boydti.fawe.bukkit.adapter.mc1_14;
|
||||||
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
import com.boydti.fawe.beta.IChunkSet;
|
||||||
@ -28,21 +26,6 @@ import com.sk89q.worldedit.internal.Constants;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
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.BiomeBase;
|
||||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_14_R1.Chunk;
|
import net.minecraft.server.v1_14_R1.Chunk;
|
||||||
@ -72,6 +55,25 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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 {
|
public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_14.class);
|
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 ChunkSection[] sections;
|
||||||
public Chunk nmsChunk;
|
public Chunk nmsChunk;
|
||||||
public WorldServer world;
|
public WorldServer world;
|
||||||
public int X, Z;
|
public int chunkX;
|
||||||
|
public int chunkZ;
|
||||||
public NibbleArray[] blockLight = new NibbleArray[16];
|
public NibbleArray[] blockLight = new NibbleArray[16];
|
||||||
public NibbleArray[] skyLight = new NibbleArray[16];
|
public NibbleArray[] skyLight = new NibbleArray[16];
|
||||||
|
|
||||||
public BukkitGetBlocks_1_14(World world, int X, int Z) {
|
public BukkitGetBlocks_1_14(World world, int chunkX, int chunkZ) {
|
||||||
this(((CraftWorld) world).getHandle(), X, Z);
|
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.world = world;
|
||||||
this.X = X;
|
this.chunkX = chunkX;
|
||||||
this.Z = Z;
|
this.chunkZ = chunkZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return X;
|
return chunkX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getZ() {
|
public int getZ() {
|
||||||
return Z;
|
return chunkZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -109,16 +112,21 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getTile(int x, int y, int z) {
|
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) {
|
if (tileEntity == null) {
|
||||||
return 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
|
@Override
|
||||||
public Map<BlockVector3, CompoundTag> getTiles() {
|
public Map<BlockVector3, CompoundTag> getTiles() {
|
||||||
@ -135,19 +143,23 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
if (skyLight[layer] == null) {
|
if (skyLight[layer] == null) {
|
||||||
//getDataLayerData
|
//getDataLayerData
|
||||||
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
|
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 the server hasn't generated the section's NibbleArray yet, it will be null
|
||||||
if (nibbleArray == null) {
|
if (nibbleArray == null) {
|
||||||
byte[] a = new byte[2048];
|
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.
|
// 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);
|
Arrays.fill(a, (byte) 15);
|
||||||
nibbleArray = new NibbleArray(a);
|
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;
|
skyLight[layer] = nibbleArray;
|
||||||
}
|
}
|
||||||
long l = BlockPosition.a(x, y, z);
|
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
|
@Override
|
||||||
@ -156,19 +168,23 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
if (blockLight[layer] == null) {
|
if (blockLight[layer] == null) {
|
||||||
//getDataLayerData
|
//getDataLayerData
|
||||||
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), layer);
|
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 the server hasn't generated the section's NibbleArray yet, it will be null
|
||||||
if (nibbleArray == null) {
|
if (nibbleArray == null) {
|
||||||
byte[] a = new byte[2048];
|
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.
|
// 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);
|
Arrays.fill(a, (byte) 15);
|
||||||
nibbleArray = new NibbleArray(a);
|
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;
|
blockLight[layer] = nibbleArray;
|
||||||
}
|
}
|
||||||
long l = BlockPosition.a(x, y, z);
|
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
|
@Override
|
||||||
@ -196,7 +212,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
List<Entity>[] slices = getChunk().getEntitySlices();
|
List<Entity>[] slices = getChunk().getEntitySlices();
|
||||||
int size = 0;
|
int size = 0;
|
||||||
for (List<Entity> slice : slices) {
|
for (List<Entity> slice : slices) {
|
||||||
if (slice != null) size += slice.size();
|
if (slice != null) {
|
||||||
|
size += slice.size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (slices.length == 0) {
|
if (slices.length == 0) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
@ -238,10 +256,11 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Iterator<CompoundTag> iterator() {
|
public Iterator<CompoundTag> iterator() {
|
||||||
Iterable<CompoundTag> result = StreamSupport
|
Iterable<CompoundTag> result =
|
||||||
.stream(Iterables.concat(slices).spliterator(), false).map(input -> {
|
StreamSupport.stream(Iterables.concat(slices).spliterator(), false)
|
||||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance()
|
.map(input -> {
|
||||||
.getBukkitImplAdapter();
|
BukkitImplAdapter adapter =
|
||||||
|
WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
return (CompoundTag) adapter.toNative(input.save(tag));
|
return (CompoundTag) adapter.toNative(input.save(tag));
|
||||||
}).collect(Collectors.toList());
|
}).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) {
|
synchronized (get) {
|
||||||
if (this.nmsChunk != nmsChunk) {
|
if (this.nmsChunk != nmsChunk) {
|
||||||
this.nmsChunk = nmsChunk;
|
this.nmsChunk = nmsChunk;
|
||||||
@ -272,15 +292,16 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
entity.valid = false;
|
entity.valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk ensureLoaded(net.minecraft.server.v1_14_R1.World nmsWorld, int X, int Z) {
|
public Chunk ensureLoaded(net.minecraft.server.v1_14_R1.World nmsWorld, int chunkX,
|
||||||
return BukkitAdapter_1_14.ensureLoaded(nmsWorld, X, Z);
|
int chunkZ) {
|
||||||
|
return BukkitAdapter_1_14.ensureLoaded(nmsWorld, chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) {
|
public <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) {
|
||||||
try {
|
try {
|
||||||
WorldServer nmsWorld = world;
|
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;
|
boolean fastmode = set.isFastMode() && Settings.IMP.QUEUE.NO_TICK_FASTMODE;
|
||||||
|
|
||||||
// Remove existing tiles
|
// Remove existing tiles
|
||||||
@ -309,7 +330,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
ChunkSection[] sections = nmsChunk.getSections();
|
ChunkSection[] sections = nmsChunk.getSections();
|
||||||
|
|
||||||
for (int layer = 0; layer < 16; layer++) {
|
for (int layer = 0; layer < 16; layer++) {
|
||||||
if (!set.hasSection(layer)) continue;
|
if (!set.hasSection(layer)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bitMask |= 1 << layer;
|
bitMask |= 1 << layer;
|
||||||
|
|
||||||
@ -318,13 +341,16 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
ChunkSection existingSection = sections[layer];
|
ChunkSection existingSection = sections[layer];
|
||||||
if (existingSection == null) {
|
if (existingSection == null) {
|
||||||
newSection = BukkitAdapter_1_14.newChunkSection(layer, setArr, fastmode);
|
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);
|
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
existingSection = sections[layer];
|
existingSection = sections[layer];
|
||||||
if (existingSection == null) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -349,9 +375,12 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
} else if (lock.isModified()) {
|
} else if (lock.isModified()) {
|
||||||
this.reset(layer);
|
this.reset(layer);
|
||||||
}
|
}
|
||||||
newSection = BukkitAdapter_1_14.newChunkSection(layer, this::load, setArr, fastmode);
|
newSection = BukkitAdapter_1_14
|
||||||
if (!BukkitAdapter_1_14.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
.newChunkSection(layer, this::load, setArr, fastmode);
|
||||||
log.error("Failed to set chunk section:" + X + "," + Z + " layer: " + layer);
|
if (!BukkitAdapter_1_14
|
||||||
|
.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
||||||
|
log.error("Failed to set chunk section:" + chunkX + "," + chunkZ
|
||||||
|
+ " layer: " + layer);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
|
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
|
||||||
@ -399,12 +428,14 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
|
|
||||||
Runnable[] syncTasks = null;
|
Runnable[] syncTasks = null;
|
||||||
|
|
||||||
int bx = X << 4;
|
int bx = chunkX << 4;
|
||||||
int bz = Z << 4;
|
int bz = chunkZ << 4;
|
||||||
|
|
||||||
Set<UUID> entityRemoves = set.getEntityRemoves();
|
Set<UUID> entityRemoves = set.getEntityRemoves();
|
||||||
if (entityRemoves != null && !entityRemoves.isEmpty()) {
|
if (entityRemoves != null && !entityRemoves.isEmpty()) {
|
||||||
if (syncTasks == null) syncTasks = new Runnable[3];
|
if (syncTasks == null) {
|
||||||
|
syncTasks = new Runnable[3];
|
||||||
|
}
|
||||||
|
|
||||||
syncTasks[2] = () -> {
|
syncTasks[2] = () -> {
|
||||||
final List<Entity>[] entities = nmsChunk.getEntitySlices();
|
final List<Entity>[] entities = nmsChunk.getEntitySlices();
|
||||||
@ -426,7 +457,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
|
|
||||||
Set<CompoundTag> entities = set.getEntities();
|
Set<CompoundTag> entities = set.getEntities();
|
||||||
if (entities != null && !entities.isEmpty()) {
|
if (entities != null && !entities.isEmpty()) {
|
||||||
if (syncTasks == null) syncTasks = new Runnable[2];
|
if (syncTasks == null) {
|
||||||
|
syncTasks = new Runnable[2];
|
||||||
|
}
|
||||||
|
|
||||||
syncTasks[1] = () -> {
|
syncTasks[1] = () -> {
|
||||||
for (final CompoundTag nativeTag : entities) {
|
for (final CompoundTag nativeTag : entities) {
|
||||||
@ -435,7 +468,8 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
|
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
|
||||||
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
||||||
if (idTag == null || posTag == null || rotTag == null) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
final double x = posTag.getDouble(0);
|
final double x = posTag.getDouble(0);
|
||||||
@ -450,18 +484,23 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
Entity entity = type.a(nmsWorld);
|
Entity entity = type.a(nmsWorld);
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
UUID uuid = entity.getUniqueID();
|
UUID uuid = entity.getUniqueID();
|
||||||
entityTagMap.put("UUIDMost", new LongTag(uuid.getMostSignificantBits()));
|
entityTagMap.put("UUIDMost",
|
||||||
entityTagMap.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits()));
|
new LongTag(uuid.getMostSignificantBits()));
|
||||||
|
entityTagMap.put("UUIDLeast",
|
||||||
|
new LongTag(uuid.getLeastSignificantBits()));
|
||||||
if (nativeTag != null) {
|
if (nativeTag != null) {
|
||||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
BukkitImplAdapter adapter =
|
||||||
final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag);
|
WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||||
|
final NBTTagCompound tag =
|
||||||
|
(NBTTagCompound) adapter.fromNative(nativeTag);
|
||||||
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
|
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
|
||||||
tag.remove(name);
|
tag.remove(name);
|
||||||
}
|
}
|
||||||
entity.f(tag);
|
entity.f(tag);
|
||||||
}
|
}
|
||||||
entity.setLocation(x, y, z, yaw, pitch);
|
entity.setLocation(x, y, z, yaw, pitch);
|
||||||
nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM);
|
nmsWorld
|
||||||
|
.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -472,7 +511,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
// set tiles
|
// set tiles
|
||||||
Map<BlockVector3, CompoundTag> tiles = set.getTiles();
|
Map<BlockVector3, CompoundTag> tiles = set.getTiles();
|
||||||
if (tiles != null && !tiles.isEmpty()) {
|
if (tiles != null && !tiles.isEmpty()) {
|
||||||
if (syncTasks == null) syncTasks = new Runnable[1];
|
if (syncTasks == null) {
|
||||||
|
syncTasks = new Runnable[1];
|
||||||
|
}
|
||||||
|
|
||||||
syncTasks[0] = () -> {
|
syncTasks[0] = () -> {
|
||||||
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
for (final Map.Entry<BlockVector3, CompoundTag> entry : tiles.entrySet()) {
|
||||||
@ -490,8 +531,10 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
tileEntity = nmsWorld.getTileEntity(pos);
|
tileEntity = nmsWorld.getTileEntity(pos);
|
||||||
}
|
}
|
||||||
if (tileEntity != null) {
|
if (tileEntity != null) {
|
||||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
BukkitImplAdapter adapter =
|
||||||
final NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(nativeTag);
|
WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||||
|
final NBTTagCompound tag =
|
||||||
|
(NBTTagCompound) adapter.fromNative(nativeTag);
|
||||||
tag.set("x", new NBTTagInt(x));
|
tag.set("x", new NBTTagInt(x));
|
||||||
tag.set("y", new NBTTagInt(y));
|
tag.set("y", new NBTTagInt(y));
|
||||||
tag.set("z", new NBTTagInt(z));
|
tag.set("z", new NBTTagInt(z));
|
||||||
@ -514,8 +557,11 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
nmsChunk.mustNotSave = false;
|
nmsChunk.mustNotSave = false;
|
||||||
nmsChunk.markDirty();
|
nmsChunk.markDirty();
|
||||||
// send to player
|
// send to player
|
||||||
BukkitAdapter_1_14.sendChunk(nmsWorld, X, Z, finalMask, finalLightUpdate);
|
BukkitAdapter_1_14
|
||||||
if (finalizer != null) finalizer.run();
|
.sendChunk(nmsWorld, chunkX, chunkZ, finalMask, finalLightUpdate);
|
||||||
|
if (finalizer != null) {
|
||||||
|
finalizer.run();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (syncTasks != null) {
|
if (syncTasks != null) {
|
||||||
@ -532,7 +578,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
if (finalizer != null) finalizer.run();
|
if (finalizer != null) {
|
||||||
|
finalizer.run();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return queueHandler.async(callback, null);
|
return queueHandler.async(callback, null);
|
||||||
@ -545,7 +593,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
return (T) (Future) queueHandler.sync(chain);
|
return (T) (Future) queueHandler.sync(chain);
|
||||||
} else {
|
} else {
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
if (finalizer != null) finalizer.run();
|
if (finalizer != null) {
|
||||||
|
finalizer.run();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
callback.run();
|
callback.run();
|
||||||
}
|
}
|
||||||
@ -577,11 +627,13 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
lock.setModified(false);
|
lock.setModified(false);
|
||||||
// Efficiently convert ChunkSection to raw data
|
// Efficiently convert ChunkSection to raw data
|
||||||
try {
|
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 DataPaletteBlock<IBlockData> blocks = section.getBlocks();
|
||||||
final DataBits bits = (DataBits) BukkitAdapter_1_14.fieldBits.get(blocks);
|
final DataBits bits = (DataBits) BukkitAdapter_1_14.fieldBits.get(blocks);
|
||||||
final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_14.fieldPalette.get(blocks);
|
final DataPalette<IBlockData> palette =
|
||||||
|
(DataPalette<IBlockData>) BukkitAdapter_1_14.fieldPalette.get(blocks);
|
||||||
|
|
||||||
final int bitsPerEntry = bits.c();
|
final int bitsPerEntry = bits.c();
|
||||||
final long[] blockStates = bits.a();
|
final long[] blockStates = bits.a();
|
||||||
@ -695,7 +747,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
tmp = nmsChunk;
|
tmp = nmsChunk;
|
||||||
if (tmp == null) {
|
if (tmp == null) {
|
||||||
nmsChunk = tmp = ensureLoaded(this.world, X, Z);
|
nmsChunk = tmp = ensureLoaded(this.world, chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -708,12 +760,14 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SectionPosition sectionPosition = SectionPosition.a(nmsChunk.getPos(), Y);
|
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) {
|
if (nibble == null) {
|
||||||
byte[] a = new byte[2048];
|
byte[] a = new byte[2048];
|
||||||
Arrays.fill(a, skyBlock == EnumSkyBlock.SKY ? (byte) 15 : (byte) 0);
|
Arrays.fill(a, skyBlock == EnumSkyBlock.SKY ? (byte) 15 : (byte) 0);
|
||||||
nibble = new NibbleArray(a);
|
nibble = new NibbleArray(a);
|
||||||
((LightEngine) world.getChunkProvider().getLightEngine()).a(skyBlock, sectionPosition, nibble);
|
((LightEngine) world.getChunkProvider().getLightEngine())
|
||||||
|
.a(skyBlock, sectionPosition, nibble);
|
||||||
}
|
}
|
||||||
synchronized (nibble) {
|
synchronized (nibble) {
|
||||||
for (int i = 0; i < 4096; i++) {
|
for (int i = 0; i < 4096; i++) {
|
||||||
@ -745,7 +799,9 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks {
|
|||||||
try {
|
try {
|
||||||
final DataPaletteBlock<IBlockData> blocksExisting = existing.getBlocks();
|
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;
|
int paletteSize;
|
||||||
|
|
||||||
if (palette instanceof DataPaletteLinear) {
|
if (palette instanceof DataPaletteLinear) {
|
||||||
|
@ -8,16 +8,16 @@ import java.lang.reflect.Method;
|
|||||||
|
|
||||||
public class BukkitReflectionUtils {
|
public class BukkitReflectionUtils {
|
||||||
/**
|
/**
|
||||||
* prefix of bukkit classes
|
* Prefix of Bukkit classes.
|
||||||
*/
|
*/
|
||||||
private static volatile String preClassB = null;
|
private static volatile String preClassB = null;
|
||||||
/**
|
/**
|
||||||
* prefix of minecraft classes
|
* Prefix of Minecraft classes.
|
||||||
*/
|
*/
|
||||||
private static volatile String preClassM = null;
|
private static volatile String preClassM = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check server version and class names
|
* Check server version and class names.
|
||||||
*/
|
*/
|
||||||
public static void init() {
|
public static void init() {
|
||||||
final Server server = Bukkit.getServer();
|
final Server server = Bukkit.getServer();
|
||||||
@ -50,18 +50,22 @@ public class BukkitReflectionUtils {
|
|||||||
* @return RefClass object
|
* @return RefClass object
|
||||||
* @throws RuntimeException if no class found
|
* @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) {
|
if (preClassM == null) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
for (String className : classes) {
|
for (String className : classes) {
|
||||||
try {
|
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));
|
return ReflectionUtils.getRefClass(Class.forName(className));
|
||||||
} catch (final ClassNotFoundException ignored) {
|
} 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) {
|
public static Class<?> getNmsClass(final String name) {
|
||||||
|
@ -9,10 +9,8 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockID;
|
import com.sk89q.worldedit.world.block.BlockID;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
import java.util.Collections;
|
|
||||||
import org.bukkit.FluidCollisionMode;
|
import org.bukkit.FluidCollisionMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -31,8 +29,8 @@ import org.bukkit.util.Vector;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class AsyncBlock implements Block {
|
public class AsyncBlock implements Block {
|
||||||
|
|
||||||
@ -72,27 +70,33 @@ public class AsyncBlock implements Block {
|
|||||||
return world.getBlock(x, y, z).getBlockType().getInternalId();
|
return world.getBlock(x, y, z).getBlockType().getInternalId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public AsyncBlock getRelative(int modX, int modY, int modZ) {
|
public AsyncBlock getRelative(int modX, int modY, int modZ) {
|
||||||
return new AsyncBlock(world, x + modX, y + modY, z + modZ);
|
return new AsyncBlock(world, x + modX, y + modY, z + modZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public AsyncBlock getRelative(BlockFace face) {
|
public AsyncBlock getRelative(BlockFace face) {
|
||||||
return this.getRelative(face.getModX(), face.getModY(), face.getModZ());
|
return this.getRelative(face.getModX(), face.getModY(), face.getModZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public AsyncBlock getRelative(BlockFace face, int distance) {
|
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() {
|
public Material getType() {
|
||||||
return getBlockData().getMaterial();
|
return getBlockData().getMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public BlockData getBlockData() {
|
public BlockData getBlockData() {
|
||||||
return BukkitAdapter.adapt(world.getBlock(x, y, z));
|
return BukkitAdapter.adapt(world.getBlock(x, y, z));
|
||||||
}
|
}
|
||||||
@ -137,7 +141,8 @@ public class AsyncBlock implements Block {
|
|||||||
return (byte) 15;
|
return (byte) 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public AsyncWorld getWorld() {
|
public AsyncWorld getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
@ -157,7 +162,8 @@ public class AsyncBlock implements Block {
|
|||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
return new Location(world, x, y, z);
|
return new Location(world, x, y, z);
|
||||||
}
|
}
|
||||||
@ -173,7 +179,8 @@ public class AsyncBlock implements Block {
|
|||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public AsyncChunk getChunk() {
|
public AsyncChunk getChunk() {
|
||||||
return world.getChunkAt(x >> 4, z >> 4);
|
return world.getChunkAt(x >> 4, z >> 4);
|
||||||
}
|
}
|
||||||
@ -219,7 +226,8 @@ public class AsyncBlock implements Block {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public AsyncBlockState getState() {
|
public AsyncBlockState getState() {
|
||||||
BaseBlock state = world.getFullBlock(x, y, z);
|
BaseBlock state = world.getFullBlock(x, y, z);
|
||||||
switch (state.getBlockType().getInternalId()) {
|
switch (state.getBlockType().getInternalId()) {
|
||||||
@ -247,7 +255,8 @@ public class AsyncBlock implements Block {
|
|||||||
return getState();
|
return getState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public Biome getBiome() {
|
public Biome getBiome() {
|
||||||
return world.getAdapter().adapt(world.getBiomeType(x, y, z));
|
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));
|
return TaskManager.IMP.sync(() -> getUnsafeBlock().breakNaturally(tool));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public Collection<ItemStack> getDrops() {
|
public Collection<ItemStack> getDrops() {
|
||||||
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops());
|
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public Collection<ItemStack> getDrops(@NotNull ItemStack tool) {
|
public Collection<ItemStack> getDrops(@NotNull ItemStack tool) {
|
||||||
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops(tool));
|
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops(tool));
|
||||||
}
|
}
|
||||||
@ -355,7 +366,8 @@ public class AsyncBlock implements Block {
|
|||||||
this.getUnsafeBlock().setMetadata(metadataKey, newMetadataValue);
|
this.getUnsafeBlock().setMetadata(metadataKey, newMetadataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public List<MetadataValue> getMetadata(@NotNull String metadataKey) {
|
public List<MetadataValue> getMetadata(@NotNull String metadataKey) {
|
||||||
return this.getUnsafeBlock().getMetadata(metadataKey);
|
return this.getUnsafeBlock().getMetadata(metadataKey);
|
||||||
}
|
}
|
||||||
@ -376,11 +388,13 @@ public class AsyncBlock implements Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return this.getUnsafeBlock().rayTrace(arg0, arg1, arg2, arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull @Override
|
@NotNull
|
||||||
|
@Override
|
||||||
public BoundingBox getBoundingBox() {
|
public BoundingBox getBoundingBox() {
|
||||||
return this.getUnsafeBlock().getBoundingBox();
|
return this.getUnsafeBlock().getBoundingBox();
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
package com.boydti.fawe.bukkit.wrapper;
|
package com.boydti.fawe.bukkit.wrapper;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
@ -22,6 +17,8 @@ import org.bukkit.metadata.MetadataValue;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class AsyncBlockState implements BlockState {
|
public class AsyncBlockState implements BlockState {
|
||||||
|
|
||||||
private BaseBlock state;
|
private BaseBlock state;
|
||||||
@ -165,7 +162,8 @@ public class AsyncBlockState implements BlockState {
|
|||||||
@Override
|
@Override
|
||||||
public void setRawData(byte data) {
|
public void setRawData(byte data) {
|
||||||
int combinedId = getTypeId() + (data << BlockTypesCache.BIT_OFFSET);
|
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);
|
this.blockData = BukkitAdapter.adapt(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package com.boydti.fawe.bukkit.wrapper;
|
package com.boydti.fawe.bukkit.wrapper;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.object.RunnableVal;
|
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import java.util.function.Supplier;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.ChunkSnapshot;
|
import org.bukkit.ChunkSnapshot;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -15,6 +13,7 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class AsyncChunk implements Chunk {
|
public class AsyncChunk implements Chunk {
|
||||||
|
|
||||||
@ -68,11 +67,14 @@ public class AsyncChunk implements Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
|
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome,
|
||||||
|
boolean includeBiomeTempRain) {
|
||||||
if (Fawe.isMainThread()) {
|
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) {
|
private <T> T whenLoaded(Supplier<T> task) {
|
||||||
|
@ -13,14 +13,6 @@ import com.sk89q.worldedit.extent.PassthroughExtent;
|
|||||||
import com.sk89q.worldedit.function.operation.Operation;
|
import com.sk89q.worldedit.function.operation.Operation;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
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.BlockChangeDelegate;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -69,12 +61,22 @@ import org.bukkit.util.Vector;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
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>
|
* Modify the world from an async thread<br>
|
||||||
* - Use world.commit() to execute all the changes<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>
|
* - 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>
|
* - Only block read,write and biome write are fast, other methods will perform slower async<br>
|
||||||
* -
|
* -
|
||||||
|
*
|
||||||
* @see #wrap(World)
|
* @see #wrap(World)
|
||||||
* @see #create(WorldCreator)
|
* @see #create(WorldCreator)
|
||||||
*/
|
*/
|
||||||
@ -84,14 +86,15 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
private BukkitImplAdapter adapter;
|
private BukkitImplAdapter adapter;
|
||||||
|
|
||||||
@Override
|
@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);
|
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5, v6, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated use {@link #wrap(World)} instead
|
|
||||||
* @param parent Parent world
|
* @param parent Parent world
|
||||||
* @param autoQueue
|
* @param autoQueue
|
||||||
|
* @deprecated use {@link #wrap(World)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public AsyncWorld(World parent, boolean autoQueue) {
|
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 parent
|
||||||
* @param extent
|
* @param extent
|
||||||
|
* @deprecated use {@link #wrap(World)} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public AsyncWorld(World parent, Extent extent) {
|
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
|
* @param world
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -138,6 +142,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
/**
|
/**
|
||||||
* Create a world async (untested)
|
* Create a world async (untested)
|
||||||
* - Only optimized for 1.10
|
* - Only optimized for 1.10
|
||||||
|
*
|
||||||
* @param creator
|
* @param creator
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -173,47 +178,56 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
parent.spawnParticle(particle, location, i, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
parent.spawnParticle(particle, x, y, z, count, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
parent.spawnParticle(particle, location, count, offsetX, offsetY, offsetZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
parent.spawnParticle(particle, location, i, v, v1, v2, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
parent.spawnParticle(particle, location, i, v, v1, v2, v3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
parent.spawnParticle(particle, v, v1, v2, i, v3, v4, v5, v6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
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) {
|
public int getHighestBlockYAt(int x, int z) {
|
||||||
for (int y = getMaxHeight() - 1; y >= 0; y--) {
|
for (int y = getMaxHeight() - 1; y >= 0; y--) {
|
||||||
BlockState state = this.getBlock(x, y, z);
|
BlockState state = this.getBlock(x, y, z);
|
||||||
if (!state.getMaterial().isAir()) return y;
|
if (!state.getMaterial().isAir()) {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -410,17 +426,20 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.dropItemNaturally(location, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.spawnArrow(location, direction, speed, spread));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return parent.spawnArrow(location, direction, speed, spread, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +449,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.generateTree(loc, type, delegate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,7 +486,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.getEntitiesByClass(cls));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +502,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.getNearbyEntities(location, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,17 +598,17 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean createExplosion(final double x, final double y, final double z, final float power, final boolean setFire, final boolean breakBlocks) {
|
public boolean createExplosion(final double x, final double y, final double z,
|
||||||
return TaskManager.IMP.sync(
|
final float power, final boolean setFire, final boolean breakBlocks) {
|
||||||
() ->
|
return TaskManager.IMP
|
||||||
parent.createExplosion(x, y, z, power, setFire, breakBlocks));
|
.sync(() -> parent.createExplosion(x, y, z, power, setFire, breakBlocks));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean createExplosion(double x, double y, double z, float power, boolean setFire,
|
public boolean createExplosion(double x, double y, double z, float power, boolean setFire,
|
||||||
boolean breakBlocks, @Nullable Entity source) {
|
boolean breakBlocks, @Nullable Entity source) {
|
||||||
return TaskManager.IMP.sync(
|
return TaskManager.IMP
|
||||||
() -> parent.createExplosion(x, y, z, power, setFire, breakBlocks, source));
|
.sync(() -> parent.createExplosion(x, y, z, power, setFire, breakBlocks, source));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -641,33 +663,40 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz, function));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@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));
|
return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, material, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.spawnFallingBlock(location, blockData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,7 +706,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(Object value) {
|
||||||
@ -692,7 +722,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(Object value) {
|
||||||
@ -702,9 +733,10 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ChunkSnapshot getEmptyChunkSnapshot(final int x, final int z, final boolean includeBiome, final boolean includeBiomeTempRain) {
|
public @NotNull ChunkSnapshot getEmptyChunkSnapshot(final int x, final int z,
|
||||||
return TaskManager.IMP.sync(
|
final boolean includeBiome, final boolean includeBiomeTempRain) {
|
||||||
() -> parent.getEmptyChunkSnapshot(x, z, includeBiome, includeBiomeTempRain));
|
return TaskManager.IMP
|
||||||
|
.sync(() -> parent.getEmptyChunkSnapshot(x, z, includeBiome, includeBiomeTempRain));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -884,11 +916,13 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
parent.setWaterAnimalSpawnLimit(limit);
|
parent.setWaterAnimalSpawnLimit(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getWaterAmbientSpawnLimit() {
|
@Override
|
||||||
|
public int getWaterAmbientSpawnLimit() {
|
||||||
return parent.getWaterAmbientSpawnLimit();
|
return parent.getWaterAmbientSpawnLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setWaterAmbientSpawnLimit(int limit) {
|
@Override
|
||||||
|
public void setWaterAmbientSpawnLimit(int limit) {
|
||||||
parent.setWaterAmbientSpawnLimit(limit);
|
parent.setWaterAmbientSpawnLimit(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -903,7 +937,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(Object value) {
|
||||||
@ -913,7 +948,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(Object value) {
|
||||||
@ -923,7 +959,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(Object value) {
|
||||||
@ -933,7 +970,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(Object value) {
|
||||||
@ -1042,13 +1080,14 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return parent.getNearbyEntities(arg0, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Collection<Entity> getNearbyEntities(@NotNull Location arg0, double arg1, double arg2, double arg3,
|
public @NotNull Collection<Entity> getNearbyEntities(@NotNull Location arg0, double arg1,
|
||||||
Predicate<Entity> arg4) {
|
double arg2, double arg3, Predicate<Entity> arg4) {
|
||||||
return parent.getNearbyEntities(arg0, arg1, arg2, arg3, arg4);
|
return parent.getNearbyEntities(arg0, arg1, arg2, arg3, arg4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,7 +1097,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return parent.locateNearestStructure(arg0, arg1, arg2, arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1083,46 +1123,51 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayTraceResult rayTrace(
|
public RayTraceResult rayTrace(@NotNull Location arg0, @NotNull Vector arg1, double arg2,
|
||||||
@NotNull Location arg0, @NotNull Vector arg1, double arg2, @NotNull FluidCollisionMode arg3, boolean arg4,
|
@NotNull FluidCollisionMode arg3, boolean arg4, double arg5, Predicate<Entity> arg6) {
|
||||||
double arg5, Predicate<Entity> arg6) {
|
|
||||||
return parent.rayTrace(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
|
return parent.rayTrace(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return parent.rayTraceBlocks(arg0, arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return parent.rayTraceBlocks(start, direction, maxDistance, fluidCollisionMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double arg2, @NotNull FluidCollisionMode fluidCollisionMode,
|
public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction,
|
||||||
boolean ignorePassableBlocks) {
|
double arg2, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
|
||||||
return parent.rayTraceBlocks(start, direction, arg2, fluidCollisionMode, ignorePassableBlocks);
|
return parent
|
||||||
|
.rayTraceBlocks(start, direction, arg2, fluidCollisionMode, ignorePassableBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return parent.rayTraceEntities(start, direction, maxDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return parent.rayTraceEntities(arg0, arg1, arg2, arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
return parent.rayTraceEntities(arg0, arg1, arg2, arg3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayTraceResult rayTraceEntities(@NotNull Location arg0, @NotNull Vector arg1, double arg2, double arg3,
|
public RayTraceResult rayTraceEntities(@NotNull Location arg0, @NotNull Vector arg1,
|
||||||
Predicate<Entity> arg4) {
|
double arg2, double arg3, Predicate<Entity> arg4) {
|
||||||
return parent.rayTraceEntities(arg0, arg1, arg2, arg3, arg4);
|
return parent.rayTraceEntities(arg0, arg1, arg2, arg3, arg4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1170,7 +1215,9 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
return TaskManager.IMP.sync(() -> parent.getHighestBlockYAt(x, z, heightmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,7 +1252,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1241,8 +1289,10 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean createExplosion(Entity source, @NotNull Location loc, float power, boolean setFire, boolean breakBlocks) {
|
public boolean createExplosion(Entity source, @NotNull Location loc, float power,
|
||||||
return TaskManager.IMP.sync(() -> parent.createExplosion(source, loc, power, setFire, breakBlocks));
|
boolean setFire, boolean breakBlocks) {
|
||||||
|
return TaskManager.IMP
|
||||||
|
.sync(() -> parent.createExplosion(source, loc, power, setFire, breakBlocks));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1259,13 +1309,17 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void spawnParticle(
|
public <T> void spawnParticle(@NotNull Particle particle, List<Player> receivers,
|
||||||
@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) {
|
@NotNull Player source, double x, double y, double z, int count, double offsetX,
|
||||||
parent.spawnParticle(particle, receivers, source, x, y, z, count, offsetX, offsetY, offsetZ, extra, data);
|
double offsetY, double offsetZ, double extra, T data) {
|
||||||
|
parent.spawnParticle(particle, receivers, source, x, y, z, count, offsetX, offsetY, offsetZ,
|
||||||
|
extra, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
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,
|
public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count,
|
||||||
double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data,
|
double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data,
|
||||||
boolean force) {
|
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
|
@Override
|
||||||
|
@ -23,7 +23,8 @@ public class CommandInfo {
|
|||||||
|
|
||||||
private final String[] aliases;
|
private final String[] aliases;
|
||||||
private final Object registeredWith;
|
private final Object registeredWith;
|
||||||
private final String usage, desc;
|
private final String usage;
|
||||||
|
private final String desc;
|
||||||
private final String[] permissions;
|
private final String[] permissions;
|
||||||
|
|
||||||
public CommandInfo(String usage, String desc, String[] aliases, Object registeredWith) {
|
public CommandInfo(String usage, String desc, String[] aliases, Object registeredWith) {
|
||||||
|
@ -37,7 +37,8 @@ import java.util.Set;
|
|||||||
public class CommandRegistration {
|
public class CommandRegistration {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(DynamicPluginCommand.class, new DynamicPluginCommandHelpTopic.Factory());
|
Bukkit.getServer().getHelpMap().registerHelpTopicFactory(DynamicPluginCommand.class,
|
||||||
|
new DynamicPluginCommandHelpTopic.Factory());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Plugin plugin;
|
protected final Plugin plugin;
|
||||||
@ -55,7 +56,9 @@ public class CommandRegistration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Plugin getCommandOwner(String label) {
|
public Plugin getCommandOwner(String label) {
|
||||||
if (serverCommandMap == null) return null;
|
if (serverCommandMap == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Command command = serverCommandMap.getCommand(label);
|
Command command = serverCommandMap.getCommand(label);
|
||||||
if (command instanceof PluginIdentifiableCommand) {
|
if (command instanceof PluginIdentifiableCommand) {
|
||||||
return ((PluginIdentifiableCommand) command).getPlugin();
|
return ((PluginIdentifiableCommand) command).getPlugin();
|
||||||
@ -87,8 +90,8 @@ public class CommandRegistration {
|
|||||||
|
|
||||||
CommandMap commandMap = ReflectionUtil.getField(plugin.getServer().getPluginManager(), "commandMap");
|
CommandMap commandMap = ReflectionUtil.getField(plugin.getServer().getPluginManager(), "commandMap");
|
||||||
if (commandMap == null) {
|
if (commandMap == null) {
|
||||||
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName() +
|
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName()
|
||||||
": Could not retrieve server CommandMap, using fallback instead!");
|
+ ": Could not retrieve server CommandMap, using fallback instead!");
|
||||||
fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer());
|
fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer());
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin);
|
Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin);
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,8 +22,6 @@ package com.sk89q.bukkit.util;
|
|||||||
import com.sk89q.minecraft.util.commands.CommandsManager;
|
import com.sk89q.minecraft.util.commands.CommandsManager;
|
||||||
import com.sk89q.util.StringUtil;
|
import com.sk89q.util.StringUtil;
|
||||||
import com.sk89q.wepif.PermissionsResolverManager;
|
import com.sk89q.wepif.PermissionsResolverManager;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -31,8 +29,11 @@ import org.bukkit.command.PluginIdentifiableCommand;
|
|||||||
import org.bukkit.command.TabCompleter;
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.plugin.Plugin;
|
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")
|
@SuppressWarnings("deprecation")
|
||||||
public class DynamicPluginCommand extends org.bukkit.command.Command implements PluginIdentifiableCommand {
|
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;
|
return false;
|
||||||
} catch (Throwable ignore) {
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
} else if (PermissionsResolverManager.isInitialized() && sender instanceof OfflinePlayer) {
|
} else if (PermissionsResolverManager.isInitialized() && sender instanceof OfflinePlayer) {
|
||||||
for (String permission : permissions) {
|
for (String permission : permissions) {
|
||||||
|
@ -31,10 +31,10 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class ConfigurationPermissionsResolver implements PermissionsResolver {
|
public class ConfigurationPermissionsResolver implements PermissionsResolver {
|
||||||
private YAMLProcessor config;
|
private final YAMLProcessor config;
|
||||||
private Map<String, Set<String>> userPermissionsCache;
|
private final Map<String, Set<String>> userPermissionsCache = new HashMap<>();
|
||||||
private Set<String> defaultPermissionsCache;
|
private final Set<String> defaultPermissionsCache = new HashSet<>();
|
||||||
private Map<String, Set<String>> userGroups;
|
private final Map<String, Set<String>> userGroups = new HashMap<>();
|
||||||
|
|
||||||
public ConfigurationPermissionsResolver(YAMLProcessor config) {
|
public ConfigurationPermissionsResolver(YAMLProcessor config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
@ -44,7 +44,8 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
|
|||||||
section.setProperty("groups.default.permissions", new String[] {
|
section.setProperty("groups.default.permissions", new String[] {
|
||||||
"worldedit.reload",
|
"worldedit.reload",
|
||||||
"worldedit.selection",
|
"worldedit.selection",
|
||||||
"worlds.creative.worldedit.region"});
|
"worlds.creative.worldedit.region"
|
||||||
|
});
|
||||||
section.setProperty("groups.admins.permissions", new String[] { "*" });
|
section.setProperty("groups.admins.permissions", new String[] { "*" });
|
||||||
section.setProperty("users.sk89q.permissions", new String[] { "worldedit" });
|
section.setProperty("users.sk89q.permissions", new String[] { "worldedit" });
|
||||||
section.setProperty("users.sk89q.groups", new String[] { "admins" });
|
section.setProperty("users.sk89q.groups", new String[] { "admins" });
|
||||||
@ -53,9 +54,9 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
userGroups = new HashMap<>();
|
userGroups.clear();
|
||||||
userPermissionsCache = new HashMap<>();
|
userPermissionsCache.clear();
|
||||||
defaultPermissionsCache = new HashSet<>();
|
defaultPermissionsCache.clear();
|
||||||
|
|
||||||
Map<String, Set<String>> userGroupPermissions = new HashMap<>();
|
Map<String, Set<String>> userGroupPermissions = new HashMap<>();
|
||||||
|
|
||||||
|
@ -78,6 +78,8 @@ public class DinnerPermsResolver implements PermissionsResolver {
|
|||||||
return false;
|
return false;
|
||||||
case 1:
|
case 1:
|
||||||
return true;
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
int dotPos = permission.lastIndexOf(".");
|
int dotPos = permission.lastIndexOf(".");
|
||||||
while (dotPos > -1) {
|
while (dotPos > -1) {
|
||||||
@ -86,6 +88,8 @@ public class DinnerPermsResolver implements PermissionsResolver {
|
|||||||
return false;
|
return false;
|
||||||
case 1:
|
case 1:
|
||||||
return true;
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
dotPos = permission.lastIndexOf(".", dotPos - 1);
|
dotPos = permission.lastIndexOf(".", dotPos - 1);
|
||||||
}
|
}
|
||||||
@ -126,19 +130,23 @@ public class DinnerPermsResolver implements PermissionsResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Permissible getPermissible(OfflinePlayer offline) {
|
public Permissible getPermissible(OfflinePlayer offline) {
|
||||||
if (offline == null) return null;
|
if (offline == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Permissible perm = null;
|
Permissible perm = null;
|
||||||
if (offline instanceof Permissible) {
|
if (offline instanceof Permissible) {
|
||||||
perm = (Permissible) offline;
|
perm = (Permissible) offline;
|
||||||
} else {
|
} else {
|
||||||
Player player = offline.getPlayer();
|
Player player = offline.getPlayer();
|
||||||
if (player != null) perm = player;
|
if (player != null) {
|
||||||
|
perm = player;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return perm;
|
return perm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the permission from dinnerperms
|
* Checks the permission from dinnerperms.
|
||||||
*
|
*
|
||||||
* @param perms Permissible to check for
|
* @param perms Permissible to check for
|
||||||
* @param permission The permission to check
|
* @param permission The permission to check
|
||||||
|
@ -35,8 +35,8 @@ public class NijiPermissionsResolver implements PermissionsResolver {
|
|||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(NijiPermissionsResolver.class);
|
private static final Logger log = LoggerFactory.getLogger(NijiPermissionsResolver.class);
|
||||||
|
|
||||||
private Server server;
|
private final Server server;
|
||||||
private Permissions api;
|
private final Permissions api;
|
||||||
|
|
||||||
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
|
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
|
||||||
PluginManager pluginManager = server.getPluginManager();
|
PluginManager pluginManager = server.getPluginManager();
|
||||||
@ -76,7 +76,9 @@ public class NijiPermissionsResolver implements PermissionsResolver {
|
|||||||
public boolean hasPermission(String name, String permission) {
|
public boolean hasPermission(String name, String permission) {
|
||||||
try {
|
try {
|
||||||
Player player = server.getPlayerExact(name);
|
Player player = server.getPlayerExact(name);
|
||||||
if (player == null) return false;
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return api.getHandler().has(player, permission);
|
return api.getHandler().has(player, permission);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
@ -107,7 +109,9 @@ public class NijiPermissionsResolver implements PermissionsResolver {
|
|||||||
public boolean inGroup(String name, String group) {
|
public boolean inGroup(String name, String group) {
|
||||||
try {
|
try {
|
||||||
Player player = server.getPlayerExact(name);
|
Player player = server.getPlayerExact(name);
|
||||||
if (player == null) return false;
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return api.getHandler().inGroup(player.getWorld().getName(), name, group);
|
return api.getHandler().inGroup(player.getWorld().getName(), name, group);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
@ -124,13 +128,17 @@ public class NijiPermissionsResolver implements PermissionsResolver {
|
|||||||
public String[] getGroups(String name) {
|
public String[] getGroups(String name) {
|
||||||
try {
|
try {
|
||||||
Player player = server.getPlayerExact(name);
|
Player player = server.getPlayerExact(name);
|
||||||
if (player == null) return new String[0];
|
if (player == null) {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
String[] groups = null;
|
String[] groups = null;
|
||||||
try {
|
try {
|
||||||
groups = api.getHandler().getGroups(player.getWorld().getName(), player.getName());
|
groups = api.getHandler().getGroups(player.getWorld().getName(), player.getName());
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
String group = api.Security.getGroup(player.getWorld().getName(), player.getName());
|
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) {
|
if (groups == null) {
|
||||||
return new String[0];
|
return new String[0];
|
||||||
|
@ -40,24 +40,24 @@ import java.util.List;
|
|||||||
|
|
||||||
public class PermissionsResolverManager implements PermissionsResolver {
|
public class PermissionsResolverManager implements PermissionsResolver {
|
||||||
|
|
||||||
private static final String CONFIG_HEADER = "#\r\n" +
|
private static final String CONFIG_HEADER = "#\r\n"
|
||||||
"# WEPIF Configuration File\r\n" +
|
+ "# WEPIF Configuration File\r\n"
|
||||||
"#\r\n" +
|
+ "#\r\n"
|
||||||
"# This file handles permissions configuration for every plugin using WEPIF\r\n" +
|
+ "# This file handles permissions configuration for every plugin using WEPIF\r\n"
|
||||||
"#\r\n" +
|
+ "#\r\n"
|
||||||
"# About editing this file:\r\n" +
|
+ "# About editing this file:\r\n"
|
||||||
"# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If\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" +
|
+ "# 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" +
|
+ "# must configure it to \"replace tabs with spaces.\" In Notepad++, this can\r\n"
|
||||||
"# be changed in Settings > Preferences > Language Menu.\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" +
|
+ "# - 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" +
|
+ "# in categories (like \"enforce-single-session\" is in the \"protection\"\r\n"
|
||||||
"# category.\r\n" +
|
+ "# category.\r\n"
|
||||||
"# - If you want to check the format of this file before putting it\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" +
|
+ "# into WEPIF, paste it into https://yaml-online-parser.appspot.com/\r\n"
|
||||||
"# and see if it gives \"ERROR:\".\r\n" +
|
+ "# and see if it gives \"ERROR:\".\r\n"
|
||||||
"# - Lines starting with # are comments and so they are ignored.\r\n" +
|
+ "# - Lines starting with # are comments and so they are ignored.\r\n"
|
||||||
"\r\n";
|
+ "\r\n";
|
||||||
|
|
||||||
private static PermissionsResolverManager instance;
|
private static PermissionsResolverManager instance;
|
||||||
|
|
||||||
@ -78,11 +78,11 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Server server;
|
private final Server server;
|
||||||
private PermissionsResolver permissionResolver;
|
private PermissionsResolver permissionResolver;
|
||||||
private YAMLProcessor config;
|
private YAMLProcessor config;
|
||||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
private List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>();
|
private final List<Class<? extends PermissionsResolver>> enabledResolvers = new ArrayList<>();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected Class<? extends PermissionsResolver>[] availableResolvers = new Class[] {
|
protected Class<? extends PermissionsResolver>[] availableResolvers = new Class[] {
|
||||||
@ -225,7 +225,8 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
|||||||
Class<?> next = null;
|
Class<?> next = null;
|
||||||
try {
|
try {
|
||||||
next = Class.forName(getClass().getPackage().getName() + "." + nextName);
|
next = Class.forName(getClass().getPackage().getName() + "." + nextName);
|
||||||
} catch (ClassNotFoundException e) {}
|
} catch (ClassNotFoundException ignored) {
|
||||||
|
}
|
||||||
|
|
||||||
if (next == null || !PermissionsResolver.class.isAssignableFrom(next)) {
|
if (next == null || !PermissionsResolver.class.isAssignableFrom(next)) {
|
||||||
logger.warn("WEPIF: Invalid or unknown class found in enabled resolvers: "
|
logger.warn("WEPIF: Invalid or unknown class found in enabled resolvers: "
|
||||||
@ -239,12 +240,12 @@ public class PermissionsResolverManager implements PermissionsResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Class<?> clazz : availableResolvers) {
|
for (Class<?> clazz : availableResolvers) {
|
||||||
if (!stagedEnabled.contains(clazz.getSimpleName()) &&
|
if (!stagedEnabled.contains(clazz.getSimpleName())
|
||||||
!disabledResolvers.contains(clazz.getSimpleName())) {
|
&& !disabledResolvers.contains(clazz.getSimpleName())) {
|
||||||
disabledResolvers.add(clazz.getSimpleName());
|
disabledResolvers.add(clazz.getSimpleName());
|
||||||
logger.info("New permissions resolver: "
|
logger.info("New permissions resolver: "
|
||||||
+ clazz.getSimpleName() + " detected. " +
|
+ clazz.getSimpleName() + " detected. "
|
||||||
"Added to disabled resolvers list.");
|
+ "Added to disabled resolvers list.");
|
||||||
isUpdated = true;
|
isUpdated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import java.io.File;
|
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 {
|
public class BukkitConfiguration extends YAMLConfiguration {
|
||||||
|
|
||||||
@ -59,8 +59,8 @@ public class BukkitConfiguration extends YAMLConfiguration {
|
|||||||
File toDir = new File(getWorkingDirectory(), file);
|
File toDir = new File(getWorkingDirectory(), file);
|
||||||
if (fromDir.exists() & !toDir.exists()) {
|
if (fromDir.exists() & !toDir.exists()) {
|
||||||
if (fromDir.renameTo(toDir)) {
|
if (fromDir.renameTo(toDir)) {
|
||||||
plugin.getLogger().info("Migrated " + name + " folder '" + file +
|
plugin.getLogger().info("Migrated " + name + " folder '" + file
|
||||||
"' from server root to plugin data folder.");
|
+ "' from server root to plugin data folder.");
|
||||||
} else {
|
} else {
|
||||||
plugin.getLogger().warning("Error while migrating " + name + " folder!");
|
plugin.getLogger().warning("Error while migrating " + name + " folder!");
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
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.bukkit.adapter.BukkitImplAdapter;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
@ -35,9 +32,10 @@ import org.bukkit.entity.EntityType;
|
|||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An adapter to adapt a Bukkit entity into a WorldEdit one.
|
* An adapter to adapt a Bukkit entity into a WorldEdit one.
|
||||||
*/
|
*/
|
||||||
|
@ -406,10 +406,11 @@ public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements I
|
|||||||
SingleThreadQueueExtent extent = new SingleThreadQueueExtent();
|
SingleThreadQueueExtent extent = new SingleThreadQueueExtent();
|
||||||
extent.init(null, (x, z) -> new BukkitGetBlocks_1_14(freshWorld, x, z) {
|
extent.init(null, (x, z) -> new BukkitGetBlocks_1_14(freshWorld, x, z) {
|
||||||
@Override
|
@Override
|
||||||
public Chunk ensureLoaded(World nmsWorld, int X, int Z) {
|
public Chunk ensureLoaded(World nmsWorld, int chunkX, int chunkZ) {
|
||||||
Chunk cached = nmsWorld.getChunkIfLoaded(X, Z);
|
Chunk cached = nmsWorld.getChunkIfLoaded(chunkX, chunkZ);
|
||||||
if (cached != null) return cached;
|
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()) {
|
while (!future.isDone()) {
|
||||||
// this feels so dirty
|
// this feels so dirty
|
||||||
freshWorld.getChunkProvider().runTasks();
|
freshWorld.getChunkProvider().runTasks();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
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.DownloadTranslationsTask
|
||||||
import com.mendhak.gradlecrowdin.UploadSourceFileTask
|
import com.mendhak.gradlecrowdin.UploadSourceFileTask
|
||||||
|
import org.gradle.plugins.ide.idea.model.IdeaModel
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@ -94,8 +94,7 @@ plugins.withId("idea") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets.named("main") {
|
||||||
main {
|
|
||||||
java {
|
java {
|
||||||
srcDir("src/main/java")
|
srcDir("src/main/java")
|
||||||
srcDir("src/legacy/java")
|
srcDir("src/legacy/java")
|
||||||
@ -104,7 +103,6 @@ sourceSets {
|
|||||||
srcDir("src/main/resources")
|
srcDir("src/main/resources")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<Copy>("processResources") {
|
tasks.named<Copy>("processResources") {
|
||||||
filesMatching("fawe.properties") {
|
filesMatching("fawe.properties") {
|
||||||
@ -147,7 +145,7 @@ if (project.hasProperty(crowdinApiKey) && !gradle.startParameter.isOffline) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named("classes").configure {
|
tasks.named("classes") {
|
||||||
dependsOn("crowdinDownload")
|
dependsOn("crowdinDownload")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,11 @@ public class SkullBlock extends BaseBlock {
|
|||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
this.owner = "";
|
this.owner = "";
|
||||||
} else {
|
} else {
|
||||||
if (owner.length() > 16 || owner.isEmpty()) this.owner = "";
|
if (owner.length() > 16 || owner.isEmpty()) {
|
||||||
else this.owner = owner;
|
this.owner = "";
|
||||||
|
} else {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,9 @@ import com.sk89q.worldedit.extension.platform.Actor;
|
|||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -28,17 +31,12 @@ import java.lang.management.ManagementFactory;
|
|||||||
import java.lang.management.MemoryMXBean;
|
import java.lang.management.MemoryMXBean;
|
||||||
import java.lang.management.MemoryPoolMXBean;
|
import java.lang.management.MemoryPoolMXBean;
|
||||||
import java.lang.management.MemoryUsage;
|
import java.lang.management.MemoryUsage;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.management.InstanceAlreadyExistsException;
|
import javax.management.InstanceAlreadyExistsException;
|
||||||
import javax.management.NotificationEmitter;
|
import javax.management.NotificationEmitter;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [ WorldEdit action]
|
* [ WorldEdit action]
|
||||||
|
@ -29,18 +29,14 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
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.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -49,6 +45,7 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The FaweAPI class offers a few useful functions.<br>
|
* The FaweAPI class offers a few useful functions.<br>
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe;
|
package com.boydti.fawe;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
import com.boydti.fawe.beta.IChunkSet;
|
||||||
import com.boydti.fawe.beta.Trimable;
|
import com.boydti.fawe.beta.Trimable;
|
||||||
import com.boydti.fawe.beta.implementation.queue.Pool;
|
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.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -54,7 +54,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public enum FaweCache implements Trimable {
|
public enum FaweCache implements Trimable {
|
||||||
IMP
|
IMP
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.boydti.fawe;
|
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.cache.preloader.Preloader;
|
||||||
|
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||||
import com.boydti.fawe.regions.FaweMaskManager;
|
import com.boydti.fawe.regions.FaweMaskManager;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import com.boydti.fawe.util.image.ImageViewer;
|
import com.boydti.fawe.util.image.ImageViewer;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.world.World;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
package com.boydti.fawe.beta;
|
package com.boydti.fawe.beta;
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
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.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
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.BlockTypes;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.boydti.fawe.beta;
|
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.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import org.jetbrains.annotations.Range;
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A filter is an interface used for setting blocks.
|
* A filter is an interface used for setting blocks.
|
||||||
*/
|
*/
|
||||||
|
@ -6,6 +6,7 @@ import com.boydti.fawe.util.MathMan;
|
|||||||
import com.sk89q.worldedit.util.Direction;
|
import com.sk89q.worldedit.util.Direction;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
public class Flood {
|
public class Flood {
|
||||||
|
@ -7,10 +7,11 @@ import com.boydti.fawe.beta.implementation.processors.MultiBatchProcessor;
|
|||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public interface IBatchProcessor {
|
public interface IBatchProcessor {
|
||||||
/**
|
/**
|
||||||
|
@ -11,11 +11,12 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BlockID;
|
import com.sk89q.worldedit.world.block.BlockID;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||||
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
import org.jetbrains.annotations.Range;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A shared interface for IGetBlocks and ISetBlocks
|
* A shared interface for IGetBlocks and ISetBlocks
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.boydti.fawe.beta;
|
package com.boydti.fawe.beta;
|
||||||
|
|
||||||
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
|
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import org.jetbrains.annotations.Range;
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a chunk in the queue {@link IQueueExtent} Used for getting and setting blocks / biomes
|
* Represents a chunk in the queue {@link IQueueExtent} Used for getting and setting blocks / biomes
|
||||||
* / entities
|
* / entities
|
||||||
|
@ -2,13 +2,10 @@ package com.boydti.fawe.beta;
|
|||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.extent.InputExtent;
|
import com.sk89q.worldedit.extent.InputExtent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ import com.sk89q.worldedit.function.operation.Operation;
|
|||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for setting blocks
|
* Interface for setting blocks
|
||||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.beta;
|
|||||||
|
|
||||||
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public interface IDelegateFilter extends Filter {
|
public interface IDelegateFilter extends Filter {
|
||||||
|
@ -9,11 +9,12 @@ import com.sk89q.worldedit.function.operation.Operation;
|
|||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
import java.io.Flushable;
|
import java.io.Flushable;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.jetbrains.annotations.Range;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: implement Extent (need to refactor Extent first) Interface for a queue based extent which
|
* TODO: implement Extent (need to refactor Extent first) Interface for a queue based extent which
|
||||||
|
@ -8,6 +8,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -14,7 +14,12 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
|
||||||
import 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;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
public class FallbackChunkGet implements IChunkGet {
|
public class FallbackChunkGet implements IChunkGet {
|
||||||
|
@ -11,8 +11,7 @@ import com.sk89q.worldedit.world.biome.BiomeTypes
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock
|
import com.sk89q.worldedit.world.block.BaseBlock
|
||||||
import com.sk89q.worldedit.world.block.BlockState
|
import com.sk89q.worldedit.world.block.BlockState
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes
|
import com.sk89q.worldedit.world.block.BlockTypes
|
||||||
|
import java.util.*
|
||||||
import java.util.UUID
|
|
||||||
import java.util.concurrent.Future
|
import java.util.concurrent.Future
|
||||||
|
|
||||||
object NullChunkGet : IChunkGet {
|
object NullChunkGet : IChunkGet {
|
||||||
|
@ -19,11 +19,11 @@ import com.sk89q.worldedit.world.block.BlockState;
|
|||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import org.jetbrains.annotations.Range;
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract {@link IChunk} class that implements basic get/set blocks
|
* An abstract {@link IChunk} class that implements basic get/set blocks
|
||||||
|
@ -12,7 +12,7 @@ import com.sk89q.worldedit.world.block.BaseBlock
|
|||||||
import com.sk89q.worldedit.world.block.BlockState
|
import com.sk89q.worldedit.world.block.BlockState
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder
|
import com.sk89q.worldedit.world.block.BlockStateHolder
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes
|
import com.sk89q.worldedit.world.block.BlockTypes
|
||||||
import java.util.UUID
|
import java.util.*
|
||||||
import java.util.concurrent.Future
|
import java.util.concurrent.Future
|
||||||
|
|
||||||
object NullChunk : IQueueChunk<Nothing> {
|
object NullChunk : IQueueChunk<Nothing> {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.boydti.fawe.beta.implementation.filter;
|
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.FilterBlockMask;
|
||||||
|
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import com.sk89q.worldedit.util.Countable;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.boydti.fawe.beta.implementation.filter;
|
package com.boydti.fawe.beta.implementation.filter;
|
||||||
|
|
||||||
import com.boydti.fawe.beta.Filter;
|
import com.boydti.fawe.beta.Filter;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.boydti.fawe.beta.implementation.filter;
|
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.Filter;
|
||||||
|
import com.boydti.fawe.beta.implementation.filter.block.DelegateFilter;
|
||||||
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||||
import com.sk89q.worldedit.function.mask.Mask;
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package com.boydti.fawe.beta.implementation.filter.block;
|
|||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter block with an extent
|
* Filter block with an extent.
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractExtentFilterBlock extends FilterBlock {
|
public abstract class AbstractExtentFilterBlock extends FilterBlock {
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public abstract class AbstractFilterBlock extends FilterBlock {
|
public abstract class AbstractFilterBlock extends FilterBlock {
|
||||||
|
@ -8,6 +8,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ArrayFilterBlock extends AbstractExtentFilterBlock {
|
public class ArrayFilterBlock extends AbstractExtentFilterBlock {
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.beta.implementation.filter.block;
|
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.FaweCache;
|
||||||
import com.boydti.fawe.beta.Filter;
|
import com.boydti.fawe.beta.Filter;
|
||||||
import com.boydti.fawe.beta.FilterBlockMask;
|
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.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import static com.sk89q.worldedit.world.block.BlockTypesCache.states;
|
||||||
|
|
||||||
public class CharFilterBlock extends ChunkFilterBlock {
|
public class CharFilterBlock extends ChunkFilterBlock {
|
||||||
|
|
||||||
private static final SetDelegate FULL = (block, value) -> block.setArr[block.index] = value;
|
private static final SetDelegate FULL = (block, value) -> block.setArr[block.index] = value;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.boydti.fawe.beta.implementation.filter.block;
|
package com.boydti.fawe.beta.implementation.filter.block;
|
||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.StringTag;
|
|
||||||
import com.sk89q.jnbt.Tag;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
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.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,6 @@ import com.boydti.fawe.beta.IBlocks;
|
|||||||
import com.boydti.fawe.object.FaweOutputStream;
|
import com.boydti.fawe.object.FaweOutputStream;
|
||||||
import com.boydti.fawe.object.io.FastByteArrayOutputStream;
|
import com.boydti.fawe.object.io.FastByteArrayOutputStream;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
@ -30,12 +30,12 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class LimitExtent extends PassthroughExtent {
|
public class LimitExtent extends PassthroughExtent {
|
||||||
private final FaweLimit limit;
|
private final FaweLimit limit;
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package com.boydti.fawe.beta.implementation.processors;
|
package com.boydti.fawe.beta.implementation.processors;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
|
||||||
import com.boydti.fawe.beta.CombinedBlocks;
|
import com.boydti.fawe.beta.CombinedBlocks;
|
||||||
import com.boydti.fawe.beta.IBlocks;
|
import com.boydti.fawe.beta.IBlocks;
|
||||||
import com.boydti.fawe.beta.IChunk;
|
import com.boydti.fawe.beta.IChunk;
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
import com.boydti.fawe.beta.IChunkGet;
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
import com.boydti.fawe.beta.IChunkSet;
|
||||||
import com.boydti.fawe.beta.IQueueExtent;
|
|
||||||
import com.boydti.fawe.beta.implementation.IChunkExtent;
|
import com.boydti.fawe.beta.implementation.IChunkExtent;
|
||||||
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
||||||
import com.boydti.fawe.util.MathMan;
|
import com.boydti.fawe.util.MathMan;
|
||||||
@ -19,7 +17,6 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
public class PersistentChunkSendProcessor extends ChunkSendProcessor {
|
public class PersistentChunkSendProcessor extends ChunkSendProcessor {
|
||||||
private final Long2ObjectLinkedOpenHashMap<Character> current;
|
private final Long2ObjectLinkedOpenHashMap<Character> current;
|
||||||
|
@ -3,13 +3,13 @@ package com.boydti.fawe.beta.implementation.queue;
|
|||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.IBatchProcessor;
|
import com.boydti.fawe.beta.IBatchProcessor;
|
||||||
|
import com.boydti.fawe.beta.IChunkCache;
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
import com.boydti.fawe.beta.IChunkGet;
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
import com.boydti.fawe.beta.IChunkSet;
|
||||||
import com.boydti.fawe.beta.IQueueChunk;
|
import com.boydti.fawe.beta.IQueueChunk;
|
||||||
import com.boydti.fawe.beta.IQueueExtent;
|
import com.boydti.fawe.beta.IQueueExtent;
|
||||||
import com.boydti.fawe.beta.Trimable;
|
import com.boydti.fawe.beta.Trimable;
|
||||||
import com.boydti.fawe.beta.implementation.cache.ChunkCache;
|
import com.boydti.fawe.beta.implementation.cache.ChunkCache;
|
||||||
import com.boydti.fawe.beta.IChunkCache;
|
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.collection.CleanableThreadLocal;
|
import com.boydti.fawe.object.collection.CleanableThreadLocal;
|
||||||
import com.boydti.fawe.util.MemUtil;
|
import com.boydti.fawe.util.MemUtil;
|
||||||
@ -17,6 +17,7 @@ import com.boydti.fawe.util.TaskManager;
|
|||||||
import com.boydti.fawe.wrappers.WorldWrapper;
|
import com.boydti.fawe.wrappers.WorldWrapper;
|
||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -20,6 +20,7 @@ import com.boydti.fawe.util.MemUtil;
|
|||||||
import com.google.common.util.concurrent.Futures;
|
import com.google.common.util.concurrent.Futures;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.command;
|
package com.boydti.fawe.command;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
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.internal.annotation.Selection;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import java.io.IOException;
|
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
import org.enginehub.piston.annotation.param.Switch;
|
import org.enginehub.piston.annotation.param.Switch;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||||
public class AnvilCommands {
|
public class AnvilCommands {
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package com.boydti.fawe.command;
|
package com.boydti.fawe.command;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class SuggestInputParseException extends InputParseException {
|
public class SuggestInputParseException extends InputParseException {
|
||||||
|
|
||||||
private final InputParseException cause;
|
private final InputParseException cause;
|
||||||
|
@ -10,7 +10,6 @@ import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
|
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -19,6 +18,7 @@ import java.util.Locale;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class Caption {
|
public class Caption {
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.boydti.fawe.config;
|
package com.boydti.fawe.config;
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
|
||||||
import com.boydti.fawe.configuration.MemorySection;
|
import com.boydti.fawe.configuration.MemorySection;
|
||||||
import com.boydti.fawe.configuration.file.YamlConfiguration;
|
import com.boydti.fawe.configuration.file.YamlConfiguration;
|
||||||
import com.boydti.fawe.util.StringMan;
|
import com.boydti.fawe.util.StringMan;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@ -20,8 +22,6 @@ import java.util.Collection;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.config;
|
|||||||
|
|
||||||
import com.boydti.fawe.object.FaweLimit;
|
import com.boydti.fawe.object.FaweLimit;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.yaml.snakeyaml;
|
package org.yaml.snakeyaml;
|
||||||
|
|
||||||
|
import org.yaml.snakeyaml.nodes.Tag;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.yaml.snakeyaml.nodes.Tag;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides additional runtime information necessary to create a custom Java
|
* Provides additional runtime information necessary to create a custom Java
|
||||||
|
@ -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;
|
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.DumperOptions.FlowStyle;
|
||||||
import org.yaml.snakeyaml.composer.Composer;
|
import org.yaml.snakeyaml.composer.Composer;
|
||||||
import org.yaml.snakeyaml.constructor.BaseConstructor;
|
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.resolver.Resolver;
|
||||||
import org.yaml.snakeyaml.serializer.Serializer;
|
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.
|
* Public YAML interface. Each Thread must have its own instance.
|
||||||
*/
|
*/
|
||||||
@ -65,8 +51,7 @@ public class Yaml {
|
|||||||
/**
|
/**
|
||||||
* Create Yaml instance.
|
* Create Yaml instance.
|
||||||
*
|
*
|
||||||
* @param dumperOptions
|
* @param dumperOptions DumperOptions to configure outgoing objects
|
||||||
* DumperOptions to configure outgoing objects
|
|
||||||
*/
|
*/
|
||||||
public Yaml(DumperOptions dumperOptions) {
|
public Yaml(DumperOptions dumperOptions) {
|
||||||
this(new Constructor(), new Representer(), 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
|
* Create Yaml instance. It is safe to create a few instances and use them
|
||||||
* in different Threads.
|
* in different Threads.
|
||||||
*
|
*
|
||||||
* @param representer
|
* @param representer Representer to emit outgoing objects
|
||||||
* Representer to emit outgoing objects
|
|
||||||
*/
|
*/
|
||||||
public Yaml(Representer representer) {
|
public Yaml(Representer representer) {
|
||||||
this(new Constructor(), 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
|
* Create Yaml instance. It is safe to create a few instances and use them
|
||||||
* in different Threads.
|
* in different Threads.
|
||||||
*
|
*
|
||||||
* @param constructor
|
* @param constructor BaseConstructor to construct incoming documents
|
||||||
* BaseConstructor to construct incoming documents
|
|
||||||
*/
|
*/
|
||||||
public Yaml(BaseConstructor constructor) {
|
public Yaml(BaseConstructor constructor) {
|
||||||
this(constructor, new Representer());
|
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
|
* Create Yaml instance. It is safe to create a few instances and use them
|
||||||
* in different Threads.
|
* in different Threads.
|
||||||
*
|
*
|
||||||
* @param constructor
|
* @param constructor BaseConstructor to construct incoming documents
|
||||||
* BaseConstructor to construct incoming documents
|
* @param representer Representer to emit outgoing objects
|
||||||
* @param representer
|
|
||||||
* Representer to emit outgoing objects
|
|
||||||
*/
|
*/
|
||||||
public Yaml(BaseConstructor constructor, Representer representer) {
|
public Yaml(BaseConstructor constructor, Representer representer) {
|
||||||
this(constructor, representer, new DumperOptions());
|
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
|
* Create Yaml instance. It is safe to create a few instances and use them
|
||||||
* in different Threads.
|
* in different Threads.
|
||||||
*
|
*
|
||||||
* @param representer
|
* @param representer Representer to emit outgoing objects
|
||||||
* Representer to emit outgoing objects
|
* @param dumperOptions DumperOptions to configure outgoing objects
|
||||||
* @param dumperOptions
|
|
||||||
* DumperOptions to configure outgoing objects
|
|
||||||
*/
|
*/
|
||||||
public Yaml(Representer representer, DumperOptions dumperOptions) {
|
public Yaml(Representer representer, DumperOptions dumperOptions) {
|
||||||
this(new Constructor(), representer, dumperOptions, new Resolver());
|
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
|
* Create Yaml instance. It is safe to create a few instances and use them
|
||||||
* in different Threads.
|
* in different Threads.
|
||||||
*
|
*
|
||||||
* @param constructor
|
* @param constructor BaseConstructor to construct incoming documents
|
||||||
* BaseConstructor to construct incoming documents
|
* @param representer Representer to emit outgoing objects
|
||||||
* @param representer
|
* @param dumperOptions DumperOptions to configure outgoing objects
|
||||||
* Representer to emit outgoing objects
|
|
||||||
* @param dumperOptions
|
|
||||||
* DumperOptions to configure outgoing objects
|
|
||||||
*/
|
*/
|
||||||
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions) {
|
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions) {
|
||||||
this(constructor, representer, dumperOptions, new Resolver());
|
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
|
* Create Yaml instance. It is safe to create a few instances and use them
|
||||||
* in different Threads.
|
* in different Threads.
|
||||||
*
|
*
|
||||||
* @param constructor
|
* @param constructor BaseConstructor to construct incoming documents
|
||||||
* BaseConstructor to construct incoming documents
|
* @param representer Representer to emit outgoing objects
|
||||||
* @param representer
|
* @param dumperOptions DumperOptions to configure outgoing objects
|
||||||
* Representer to emit outgoing objects
|
* @param resolver Resolver to detect implicit type
|
||||||
* @param dumperOptions
|
|
||||||
* DumperOptions to configure outgoing objects
|
|
||||||
* @param resolver
|
|
||||||
* Resolver to detect implicit type
|
|
||||||
*/
|
*/
|
||||||
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions,
|
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions, Resolver resolver) {
|
||||||
Resolver resolver) {
|
|
||||||
if (!constructor.isExplicitPropertyUtils()) {
|
if (!constructor.isExplicitPropertyUtils()) {
|
||||||
constructor.setPropertyUtils(representer.getPropertyUtils());
|
constructor.setPropertyUtils(representer.getPropertyUtils());
|
||||||
} else if (!representer.isExplicitPropertyUtils()) {
|
} else if (!representer.isExplicitPropertyUtils()) {
|
||||||
@ -158,8 +129,7 @@ public class Yaml {
|
|||||||
this.constructor = constructor;
|
this.constructor = constructor;
|
||||||
representer.setDefaultFlowStyle(dumperOptions.getDefaultFlowStyle());
|
representer.setDefaultFlowStyle(dumperOptions.getDefaultFlowStyle());
|
||||||
representer.setDefaultScalarStyle(dumperOptions.getDefaultScalarStyle());
|
representer.setDefaultScalarStyle(dumperOptions.getDefaultScalarStyle());
|
||||||
representer.getPropertyUtils().setAllowReadOnlyProperties(
|
representer.getPropertyUtils().setAllowReadOnlyProperties(dumperOptions.isAllowReadOnlyProperties());
|
||||||
dumperOptions.isAllowReadOnlyProperties());
|
|
||||||
representer.setTimeZone(dumperOptions.getTimeZone());
|
representer.setTimeZone(dumperOptions.getTimeZone());
|
||||||
this.representer = representer;
|
this.representer = representer;
|
||||||
this.dumperOptions = dumperOptions;
|
this.dumperOptions = dumperOptions;
|
||||||
@ -170,8 +140,7 @@ public class Yaml {
|
|||||||
/**
|
/**
|
||||||
* Serialize a Java object into a YAML String.
|
* Serialize a Java object into a YAML String.
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data Java object to be Serialized to YAML
|
||||||
* Java object to be Serialized to YAML
|
|
||||||
* @return YAML String
|
* @return YAML String
|
||||||
*/
|
*/
|
||||||
public String dump(Object data) {
|
public String dump(Object data) {
|
||||||
@ -183,11 +152,10 @@ public class Yaml {
|
|||||||
/**
|
/**
|
||||||
* Produce the corresponding representation tree for a given Object.
|
* 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
|
* @see <a href="http://yaml.org/spec/1.1/#id859333">Figure 3.1. Processing
|
||||||
* Overview</a>
|
* Overview</a>
|
||||||
* @param data
|
|
||||||
* instance to build the representation tree for
|
|
||||||
* @return representation tree
|
|
||||||
*/
|
*/
|
||||||
public Node represent(Object data) {
|
public Node represent(Object data) {
|
||||||
return representer.represent(data);
|
return representer.represent(data);
|
||||||
@ -196,8 +164,7 @@ public class Yaml {
|
|||||||
/**
|
/**
|
||||||
* Serialize a sequence of Java objects into a YAML String.
|
* Serialize a sequence of Java objects into a YAML String.
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data Iterator with Objects
|
||||||
* Iterator with Objects
|
|
||||||
* @return YAML String with all the objects in proper sequence
|
* @return YAML String with all the objects in proper sequence
|
||||||
*/
|
*/
|
||||||
public String dumpAll(Iterator<? extends Object> data) {
|
public String dumpAll(Iterator<? extends Object> data) {
|
||||||
@ -209,10 +176,8 @@ public class Yaml {
|
|||||||
/**
|
/**
|
||||||
* Serialize a Java object into a YAML stream.
|
* Serialize a Java object into a YAML stream.
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data Java object to be serialized to YAML
|
||||||
* Java object to be serialized to YAML
|
* @param output stream to write to
|
||||||
* @param output
|
|
||||||
* stream to write to
|
|
||||||
*/
|
*/
|
||||||
public void dump(Object data, Writer output) {
|
public void dump(Object data, Writer output) {
|
||||||
List<Object> list = new ArrayList<>(1);
|
List<Object> list = new ArrayList<>(1);
|
||||||
@ -223,18 +188,15 @@ public class Yaml {
|
|||||||
/**
|
/**
|
||||||
* Serialize a sequence of Java objects into a YAML stream.
|
* Serialize a sequence of Java objects into a YAML stream.
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data Iterator with Objects
|
||||||
* Iterator with Objects
|
* @param output stream to write to
|
||||||
* @param output
|
|
||||||
* stream to write to
|
|
||||||
*/
|
*/
|
||||||
public void dumpAll(Iterator<? extends Object> data, Writer output) {
|
public void dumpAll(Iterator<? extends Object> data, Writer output) {
|
||||||
dumpAll(data, output, null);
|
dumpAll(data, output, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dumpAll(Iterator<? extends Object> data, Writer output, Tag rootTag) {
|
private void dumpAll(Iterator<? extends Object> data, Writer output, Tag rootTag) {
|
||||||
Serializer serializer = new Serializer(new Emitter(output, dumperOptions), resolver,
|
Serializer serializer = new Serializer(new Emitter(output, dumperOptions), resolver, dumperOptions, rootTag);
|
||||||
dumperOptions, rootTag);
|
|
||||||
try {
|
try {
|
||||||
serializer.open();
|
serializer.open();
|
||||||
while (data.hasNext()) {
|
while (data.hasNext()) {
|
||||||
@ -272,19 +234,15 @@ public class Yaml {
|
|||||||
* handled as an instance of YourClass when loaded.
|
* handled as an instance of YourClass when loaded.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data Java object to be serialized to YAML
|
||||||
* Java object to be serialized to YAML
|
* @param rootTag the tag for the whole YAML document. The tag should be Tag.MAP
|
||||||
* @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
|
* for a JavaBean to make the tag disappear (to use implicit tag
|
||||||
* !!map). If <code>null</code> is provided then the standard tag
|
* !!map). If <code>null</code> is provided then the standard tag
|
||||||
* with the full class name is used.
|
* with the full class name is used.
|
||||||
* @param flowStyle
|
* @param flowStyle flow style for the whole document. See Chapter 10. Collection
|
||||||
* flow style for the whole document. See Chapter 10. Collection
|
|
||||||
* Styles http://yaml.org/spec/1.1/#id930798. If
|
* Styles http://yaml.org/spec/1.1/#id930798. If
|
||||||
* <code>null</code> is provided then the flow style from
|
* <code>null</code> is provided then the flow style from
|
||||||
* DumperOptions is used.
|
* DumperOptions is used.
|
||||||
*
|
|
||||||
* @return YAML String
|
* @return YAML String
|
||||||
*/
|
*/
|
||||||
public String dumpAs(Object data, Tag rootTag, FlowStyle flowStyle) {
|
public String dumpAs(Object data, Tag rootTag, FlowStyle flowStyle) {
|
||||||
@ -315,8 +273,7 @@ public class Yaml {
|
|||||||
* (http://yaml.org/spec/1.1/#id934537)
|
* (http://yaml.org/spec/1.1/#id934537)
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param data
|
* @param data Java object to be serialized to YAML
|
||||||
* Java object to be serialized to YAML
|
|
||||||
* @return YAML String
|
* @return YAML String
|
||||||
*/
|
*/
|
||||||
public String dumpAsMap(Object data) {
|
public String dumpAsMap(Object data) {
|
||||||
@ -326,10 +283,9 @@ public class Yaml {
|
|||||||
/**
|
/**
|
||||||
* Serialize the representation tree into Events.
|
* 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
|
* @return Event list
|
||||||
|
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
|
||||||
*/
|
*/
|
||||||
public List<Event> serialize(Node data) {
|
public List<Event> serialize(Node data) {
|
||||||
SilentEmitter emitter = new SilentEmitter();
|
SilentEmitter emitter = new SilentEmitter();
|
||||||
@ -360,8 +316,7 @@ public class Yaml {
|
|||||||
* Parse the only YAML document in a String and produce the corresponding
|
* Parse the only YAML document in a String and produce the corresponding
|
||||||
* Java object. (Because the encoding in known BOM is not respected.)
|
* Java object. (Because the encoding in known BOM is not respected.)
|
||||||
*
|
*
|
||||||
* @param yaml
|
* @param yaml YAML data to load from (BOM must not be present)
|
||||||
* YAML data to load from (BOM must not be present)
|
|
||||||
* @return parsed object
|
* @return parsed object
|
||||||
*/
|
*/
|
||||||
public Object load(String yaml) {
|
public Object load(String yaml) {
|
||||||
@ -372,8 +327,7 @@ public class Yaml {
|
|||||||
* Parse the only YAML document in a stream and produce the corresponding
|
* Parse the only YAML document in a stream and produce the corresponding
|
||||||
* Java object.
|
* Java object.
|
||||||
*
|
*
|
||||||
* @param io
|
* @param io data to load from (BOM is respected and removed)
|
||||||
* data to load from (BOM is respected and removed)
|
|
||||||
* @return parsed object
|
* @return parsed object
|
||||||
*/
|
*/
|
||||||
public Object load(InputStream io) {
|
public Object load(InputStream io) {
|
||||||
@ -384,8 +338,7 @@ public class Yaml {
|
|||||||
* Parse the only YAML document in a stream and produce the corresponding
|
* Parse the only YAML document in a stream and produce the corresponding
|
||||||
* Java object.
|
* Java object.
|
||||||
*
|
*
|
||||||
* @param io
|
* @param io data to load from (BOM must not be present)
|
||||||
* data to load from (BOM must not be present)
|
|
||||||
* @return parsed object
|
* @return parsed object
|
||||||
*/
|
*/
|
||||||
public Object load(Reader io) {
|
public Object load(Reader io) {
|
||||||
@ -396,12 +349,9 @@ public class Yaml {
|
|||||||
* Parse the only YAML document in a stream and produce the corresponding
|
* Parse the only YAML document in a stream and produce the corresponding
|
||||||
* Java object.
|
* Java object.
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T> Class is defined by the second argument
|
||||||
* Class is defined by the second argument
|
* @param io data to load from (BOM must not be present)
|
||||||
* @param io
|
* @param type Class of the object to be created
|
||||||
* data to load from (BOM must not be present)
|
|
||||||
* @param type
|
|
||||||
* Class of the object to be created
|
|
||||||
* @return parsed object
|
* @return parsed object
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -413,12 +363,9 @@ public class Yaml {
|
|||||||
* Parse the only YAML document in a String and produce the corresponding
|
* Parse the only YAML document in a String and produce the corresponding
|
||||||
* Java object. (Because the encoding in known BOM is not respected.)
|
* Java object. (Because the encoding in known BOM is not respected.)
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T> Class is defined by the second argument
|
||||||
* Class is defined by the second argument
|
* @param yaml YAML data to load from (BOM must not be present)
|
||||||
* @param yaml
|
* @param type Class of the object to be created
|
||||||
* YAML data to load from (BOM must not be present)
|
|
||||||
* @param type
|
|
||||||
* Class of the object to be created
|
|
||||||
* @return parsed object
|
* @return parsed object
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -430,12 +377,9 @@ public class Yaml {
|
|||||||
* Parse the only YAML document in a stream and produce the corresponding
|
* Parse the only YAML document in a stream and produce the corresponding
|
||||||
* Java object.
|
* Java object.
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T> Class is defined by the second argument
|
||||||
* Class is defined by the second argument
|
* @param input data to load from (BOM is respected and removed)
|
||||||
* @param input
|
* @param type Class of the object to be created
|
||||||
* data to load from (BOM is respected and removed)
|
|
||||||
* @param type
|
|
||||||
* Class of the object to be created
|
|
||||||
* @return parsed object
|
* @return parsed object
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -453,8 +397,7 @@ public class Yaml {
|
|||||||
* Parse all YAML documents in a String and produce corresponding Java
|
* Parse all YAML documents in a String and produce corresponding Java
|
||||||
* objects. The documents are parsed only when the iterator is invoked.
|
* objects. The documents are parsed only when the iterator is invoked.
|
||||||
*
|
*
|
||||||
* @param yaml
|
* @param yaml YAML data to load from (BOM must not be present)
|
||||||
* YAML data to load from (BOM must not be present)
|
|
||||||
* @return an iterator over the parsed Java objects in this String in proper
|
* @return an iterator over the parsed Java objects in this String in proper
|
||||||
* sequence
|
* sequence
|
||||||
*/
|
*/
|
||||||
@ -494,8 +437,7 @@ public class Yaml {
|
|||||||
* objects. (Because the encoding in known BOM is not respected.) The
|
* objects. (Because the encoding in known BOM is not respected.) The
|
||||||
* documents are parsed only when the iterator is invoked.
|
* documents are parsed only when the iterator is invoked.
|
||||||
*
|
*
|
||||||
* @param yaml
|
* @param yaml YAML data to load from (BOM must not be present)
|
||||||
* YAML data to load from (BOM must not be present)
|
|
||||||
* @return an iterator over the parsed Java objects in this String in proper
|
* @return an iterator over the parsed Java objects in this String in proper
|
||||||
* sequence
|
* sequence
|
||||||
*/
|
*/
|
||||||
@ -507,8 +449,7 @@ public class Yaml {
|
|||||||
* Parse all YAML documents in a stream and produce corresponding Java
|
* Parse all YAML documents in a stream and produce corresponding Java
|
||||||
* objects. The documents are parsed only when the iterator is invoked.
|
* objects. The documents are parsed only when the iterator is invoked.
|
||||||
*
|
*
|
||||||
* @param yaml
|
* @param yaml YAML data to load from (BOM is respected and ignored)
|
||||||
* YAML data to load from (BOM is respected and ignored)
|
|
||||||
* @return an iterator over the parsed Java objects in this stream in proper
|
* @return an iterator over the parsed Java objects in this stream in proper
|
||||||
* sequence
|
* sequence
|
||||||
*/
|
*/
|
||||||
@ -520,11 +461,10 @@ public class Yaml {
|
|||||||
* Parse the first YAML document in a stream and produce the corresponding
|
* Parse the first YAML document in a stream and produce the corresponding
|
||||||
* representation tree. (This is the opposite of the represent() method)
|
* 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
|
* @see <a href="http://yaml.org/spec/1.1/#id859333">Figure 3.1. Processing
|
||||||
* Overview</a>
|
* Overview</a>
|
||||||
* @param yaml
|
|
||||||
* YAML document
|
|
||||||
* @return parsed root Node for the specified YAML document
|
|
||||||
*/
|
*/
|
||||||
public Node compose(Reader yaml) {
|
public Node compose(Reader yaml) {
|
||||||
Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
|
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
|
* Parse all YAML documents in a stream and produce corresponding
|
||||||
* representation trees.
|
* 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
|
* @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) {
|
public Iterable<Node> composeAll(Reader yaml) {
|
||||||
final Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
|
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
|
* Add an implicit scalar detector. If an implicit scalar value matches the
|
||||||
* given regexp, the corresponding tag is assigned to the scalar.
|
* given regexp, the corresponding tag is assigned to the scalar.
|
||||||
*
|
*
|
||||||
* @param tag
|
* @param tag tag to assign to the node
|
||||||
* tag to assign to the node
|
* @param regexp regular expression to match against
|
||||||
* @param regexp
|
* @param first a sequence of possible initial characters or null (which means
|
||||||
* regular expression to match against
|
|
||||||
* @param first
|
|
||||||
* a sequence of possible initial characters or null (which means
|
|
||||||
* any).
|
* any).
|
||||||
*/
|
*/
|
||||||
public void addImplicitResolver(Tag tag, Pattern regexp, String first) {
|
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()
|
* Set a meaningful name to be shown in toString()
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name human readable name
|
||||||
* human readable name
|
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -617,10 +552,9 @@ public class Yaml {
|
|||||||
/**
|
/**
|
||||||
* Parse a YAML stream and produce parsing events.
|
* 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
|
* @return parsed events
|
||||||
|
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
|
||||||
*/
|
*/
|
||||||
public Iterable<Event> parse(Reader yaml) {
|
public Iterable<Event> parse(Reader yaml) {
|
||||||
final Parser parser = new ParserImpl(new StreamReader(yaml));
|
final Parser parser = new ParserImpl(new StreamReader(yaml));
|
||||||
|
@ -3,6 +3,7 @@ package com.boydti.fawe.configuration.file;
|
|||||||
import com.boydti.fawe.configuration.Configuration;
|
import com.boydti.fawe.configuration.Configuration;
|
||||||
import com.boydti.fawe.configuration.InvalidConfigurationException;
|
import com.boydti.fawe.configuration.InvalidConfigurationException;
|
||||||
import com.boydti.fawe.configuration.MemoryConfiguration;
|
import com.boydti.fawe.configuration.MemoryConfiguration;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
@ -3,16 +3,20 @@ package com.boydti.fawe.configuration.file;
|
|||||||
import com.boydti.fawe.configuration.Configuration;
|
import com.boydti.fawe.configuration.Configuration;
|
||||||
import com.boydti.fawe.configuration.ConfigurationSection;
|
import com.boydti.fawe.configuration.ConfigurationSection;
|
||||||
import com.boydti.fawe.configuration.InvalidConfigurationException;
|
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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
import org.yaml.snakeyaml.error.YAMLException;
|
|
||||||
import org.yaml.snakeyaml.representer.Representer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of {@link com.boydti.fawe.configuration.Configuration} which saves all files in Yaml.
|
* 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.
|
* Creates a new {@link com.boydti.fawe.configuration.file.YamlConfiguration}, loading from the given file.
|
||||||
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Any errors loading the Configuration will be logged and then ignored.
|
* 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
|
* If the specified input is not a valid config, a blank config will be
|
||||||
* returned.
|
* returned.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* The encoding used may follow the system dependent default.
|
* The encoding used may follow the system dependent default.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param file Input file
|
* @param file Input file
|
||||||
* @return Resulting configuration
|
* @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.
|
* Creates a new {@link com.boydti.fawe.configuration.file.YamlConfiguration}, loading from the given reader.
|
||||||
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Any errors loading the Configuration will be logged and then ignored.
|
* 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
|
* If the specified input is not a valid config, a blank config will be
|
||||||
* returned.
|
* returned.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param reader input
|
* @param reader input
|
||||||
* @return resulting configuration
|
* @return resulting configuration
|
||||||
@ -90,8 +100,7 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
try {
|
try {
|
||||||
config.load(reader);
|
config.load(reader);
|
||||||
} catch (final IOException | InvalidConfigurationException ex) {
|
} catch (final IOException | InvalidConfigurationException ex) {
|
||||||
System.out.println("Cannot load configuration from stream");
|
getLogger(YAMLConfiguration.class).error("Cannot load configuration from stream", ex);
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package com.boydti.fawe.configuration.file;
|
package com.boydti.fawe.configuration.file;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Various settings for controlling the input and output of a {@link
|
* Various settings for controlling the input and output of a {@link YamlConfiguration}.
|
||||||
* com.boydti.fawe.configuration.file.YamlConfiguration}
|
|
||||||
*/
|
*/
|
||||||
public class YamlConfigurationOptions extends FileConfigurationOptions {
|
public class YamlConfigurationOptions extends FileConfigurationOptions {
|
||||||
private int indent = 2;
|
private int indent = 2;
|
||||||
@ -42,8 +41,10 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets how much spaces should be used to indent each line.
|
* Gets how much spaces should be used to indent each line.
|
||||||
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* The minimum value this may be is 2, and the maximum is 9.
|
* The minimum value this may be is 2, and the maximum is 9.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @return How much to indent by
|
* @return How much to indent by
|
||||||
*/
|
*/
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package com.boydti.fawe.configuration.file;
|
package com.boydti.fawe.configuration.file;
|
||||||
|
|
||||||
import com.boydti.fawe.configuration.serialization.ConfigurationSerialization;
|
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.constructor.SafeConstructor;
|
||||||
import org.yaml.snakeyaml.error.YAMLException;
|
import org.yaml.snakeyaml.error.YAMLException;
|
||||||
import org.yaml.snakeyaml.nodes.Node;
|
import org.yaml.snakeyaml.nodes.Node;
|
||||||
import org.yaml.snakeyaml.nodes.Tag;
|
import org.yaml.snakeyaml.nodes.Tag;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class YamlConstructor extends SafeConstructor {
|
public class YamlConstructor extends SafeConstructor {
|
||||||
|
|
||||||
public YamlConstructor() {
|
public YamlConstructor() {
|
||||||
|
@ -3,11 +3,12 @@ package com.boydti.fawe.configuration.file;
|
|||||||
import com.boydti.fawe.configuration.ConfigurationSection;
|
import com.boydti.fawe.configuration.ConfigurationSection;
|
||||||
import com.boydti.fawe.configuration.serialization.ConfigurationSerializable;
|
import com.boydti.fawe.configuration.serialization.ConfigurationSerializable;
|
||||||
import com.boydti.fawe.configuration.serialization.ConfigurationSerialization;
|
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.nodes.Node;
|
||||||
import org.yaml.snakeyaml.representer.Representer;
|
import org.yaml.snakeyaml.representer.Representer;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class YamlRepresenter extends Representer {
|
public class YamlRepresenter extends Representer {
|
||||||
|
|
||||||
public YamlRepresenter() {
|
public YamlRepresenter() {
|
||||||
|
@ -2,11 +2,12 @@ package com.boydti.fawe.database;
|
|||||||
|
|
||||||
import com.boydti.fawe.config.Config;
|
import com.boydti.fawe.config.Config;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class DBHandler {
|
public class DBHandler {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(Config.class);
|
private final Logger log = LoggerFactory.getLogger(Config.class);
|
||||||
|
@ -9,6 +9,11 @@ import com.boydti.fawe.util.MainUtil;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.World;
|
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.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
@ -24,10 +29,6 @@ import java.util.concurrent.Future;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.IntStream;
|
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 {
|
public class RollbackDatabase extends AsyncNotifyQueue {
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import com.sk89q.jnbt.LongTag;
|
|||||||
import com.sk89q.jnbt.ShortTag;
|
import com.sk89q.jnbt.ShortTag;
|
||||||
import com.sk89q.jnbt.StringTag;
|
import com.sk89q.jnbt.StringTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.boydti.fawe.jnbt.anvil;
|
package com.boydti.fawe.jnbt.anvil;
|
||||||
|
|
||||||
import com.boydti.fawe.object.io.PGZIPOutputStream;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
import com.sk89q.jnbt.NBTOutputStream;
|
import com.sk89q.jnbt.NBTOutputStream;
|
||||||
@ -9,7 +8,6 @@ import it.unimi.dsi.fastutil.io.FastBufferedOutputStream;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
@ -31,7 +31,6 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
|||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
|
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -42,6 +41,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class MCAChunk implements IChunk {
|
public class MCAChunk implements IChunk {
|
||||||
public final boolean[] hasSections = new boolean[16];
|
public final boolean[] hasSections = new boolean[16];
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.jnbt.anvil;
|
package com.boydti.fawe.jnbt.anvil;
|
||||||
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
|
||||||
|
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.Trimable;
|
import com.boydti.fawe.beta.Trimable;
|
||||||
import com.boydti.fawe.beta.implementation.IChunkExtent;
|
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.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
|
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -39,6 +38,8 @@ import java.util.zip.Deflater;
|
|||||||
import java.util.zip.Inflater;
|
import java.util.zip.Inflater;
|
||||||
import java.util.zip.InflaterInputStream;
|
import java.util.zip.InflaterInputStream;
|
||||||
|
|
||||||
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chunk format: http://minecraft.gamepedia.com/Chunk_format#Entity_format
|
* Chunk format: http://minecraft.gamepedia.com/Chunk_format#Entity_format
|
||||||
* e.g., `.Level.Entities.#` (Starts with a . as the root tag is unnamed)
|
* e.g., `.Level.Entities.#` (Starts with a . as the root tag is unnamed)
|
||||||
|
@ -2,14 +2,12 @@ package com.boydti.fawe.jnbt.anvil;
|
|||||||
|
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
import com.boydti.fawe.beta.IChunkGet;
|
||||||
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
@ -20,9 +18,9 @@ import com.sk89q.worldedit.world.AbstractWorld;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import com.boydti.fawe.object.changeset.SimpleChangeSetSummary;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -3,6 +3,7 @@ package com.boydti.fawe.object;
|
|||||||
import com.boydti.fawe.util.IOUtil;
|
import com.boydti.fawe.util.IOUtil;
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
import com.sk89q.jnbt.NamedTag;
|
import com.sk89q.jnbt.NamedTag;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.object;
|
|||||||
|
|
||||||
import com.sk89q.jnbt.NBTOutputStream;
|
import com.sk89q.jnbt.NBTOutputStream;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
|
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.object;
|
package com.boydti.fawe.object;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.boydti.fawe.object.changeset.AbstractChangeSet;
|
import com.boydti.fawe.object.changeset.AbstractChangeSet;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
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.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores changes to a {@link ChangeSet}.
|
* Stores changes to a {@link ChangeSet}.
|
||||||
*/
|
*/
|
||||||
|
@ -6,6 +6,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
|
|||||||
import com.sk89q.worldedit.history.change.Change;
|
import com.sk89q.worldedit.history.change.Change;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class BlendBall implements Brush {
|
public class BlendBall implements Brush {
|
||||||
|
@ -10,6 +10,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.math.MutableVector3;
|
import com.sk89q.worldedit.math.MutableVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class BlobBrush implements Brush {
|
public class BlobBrush implements Brush {
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package com.boydti.fawe.object.brush;
|
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.brush.scroll.Scroll;
|
||||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
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.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.internal.expression.EvaluationException;
|
import com.sk89q.worldedit.internal.expression.EvaluationException;
|
||||||
import com.sk89q.worldedit.internal.expression.Expression;
|
import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
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 class BrushSettings {
|
||||||
public enum SettingType {
|
public enum SettingType {
|
||||||
BRUSH,
|
BRUSH,
|
||||||
@ -29,6 +30,7 @@ public class BrushSettings {
|
|||||||
SCROLL_ACTION,
|
SCROLL_ACTION,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final Expression DEFAULT_SIZE = Expression.compile("1");
|
private static final Expression DEFAULT_SIZE = Expression.compile("1");
|
||||||
|
|
||||||
private final Map<SettingType, Object> constructor = new ConcurrentHashMap<>();
|
private final Map<SettingType, Object> constructor = new ConcurrentHashMap<>();
|
||||||
@ -148,25 +150,33 @@ public class BrushSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BrushSettings setMask(Mask mask) {
|
public BrushSettings setMask(Mask mask) {
|
||||||
if (mask == null) constructor.remove(SettingType.MASK);
|
if (mask == null) {
|
||||||
|
constructor.remove(SettingType.MASK);
|
||||||
|
}
|
||||||
this.mask = mask;
|
this.mask = mask;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BrushSettings setSourceMask(Mask mask) {
|
public BrushSettings setSourceMask(Mask mask) {
|
||||||
if (mask == null) constructor.remove(SettingType.SOURCE_MASK);
|
if (mask == null) {
|
||||||
|
constructor.remove(SettingType.SOURCE_MASK);
|
||||||
|
}
|
||||||
this.sourceMask = mask;
|
this.sourceMask = mask;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BrushSettings setTransform(ResettableExtent transform) {
|
public BrushSettings setTransform(ResettableExtent transform) {
|
||||||
if (transform == null) constructor.remove(SettingType.TRANSFORM);
|
if (transform == null) {
|
||||||
|
constructor.remove(SettingType.TRANSFORM);
|
||||||
|
}
|
||||||
this.transform = transform;
|
this.transform = transform;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BrushSettings setFill(Pattern pattern) {
|
public BrushSettings setFill(Pattern pattern) {
|
||||||
if (pattern == null) constructor.remove(SettingType.FILL);
|
if (pattern == null) {
|
||||||
|
constructor.remove(SettingType.FILL);
|
||||||
|
}
|
||||||
this.material = pattern;
|
this.material = pattern;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -187,7 +197,9 @@ public class BrushSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BrushSettings setScrollAction(Scroll scrollAction) {
|
public BrushSettings setScrollAction(Scroll scrollAction) {
|
||||||
if (scrollAction == null) constructor.remove(SettingType.SCROLL_ACTION);
|
if (scrollAction == null) {
|
||||||
|
constructor.remove(SettingType.SCROLL_ACTION);
|
||||||
|
}
|
||||||
this.scrollAction = scrollAction;
|
this.scrollAction = scrollAction;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -245,7 +257,9 @@ public class BrushSettings {
|
|||||||
public boolean canUse(Actor actor) {
|
public boolean canUse(Actor actor) {
|
||||||
Set<String> perms = getPermissions();
|
Set<String> perms = getPermissions();
|
||||||
for (String perm : perms) {
|
for (String perm : perms) {
|
||||||
if (actor.hasPermission(perm)) return true;
|
if (actor.hasPermission(perm)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return perms.isEmpty();
|
return perms.isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CommandBrush implements Brush {
|
public class CommandBrush implements Brush {
|
||||||
|
@ -25,6 +25,7 @@ import com.sk89q.worldedit.util.Location;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class CopyPastaBrush implements Brush, ResettableTool {
|
public class CopyPastaBrush implements Brush, ResettableTool {
|
||||||
|
@ -14,6 +14,7 @@ import com.sk89q.worldedit.util.Location;
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class ErodeBrush implements Brush {
|
public class ErodeBrush implements Brush {
|
||||||
|
@ -9,6 +9,7 @@ import com.sk89q.worldedit.function.mask.Mask;
|
|||||||
import com.sk89q.worldedit.function.mask.Masks;
|
import com.sk89q.worldedit.function.mask.Masks;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public class FlattenBrush extends HeightBrush {
|
public class FlattenBrush extends HeightBrush {
|
||||||
|
@ -17,6 +17,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
|||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
@ -20,6 +20,7 @@ import com.sk89q.worldedit.math.transform.AffineTransform;
|
|||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -24,6 +24,7 @@ import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -19,6 +19,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class LayerBrush implements Brush {
|
public class LayerBrush implements Brush {
|
||||||
|
@ -11,6 +11,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PopulateSchem implements Brush {
|
public class PopulateSchem implements Brush {
|
||||||
|
@ -7,6 +7,7 @@ import com.sk89q.worldedit.command.tool.brush.Brush;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class RockBrush implements Brush {
|
public class RockBrush implements Brush {
|
||||||
|
@ -10,6 +10,7 @@ import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ScatterCommand extends ScatterBrush {
|
public class ScatterCommand extends ScatterBrush {
|
||||||
|
@ -10,6 +10,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
|||||||
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class ShatterBrush extends ScatterBrush {
|
public class ShatterBrush extends ScatterBrush {
|
||||||
|
@ -11,6 +11,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
|||||||
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
import com.sk89q.worldedit.function.visitor.BreadthFirstSearch;
|
||||||
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import com.sk89q.worldedit.math.MutableVector3;
|
|||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.math.interpolation.Node;
|
import com.sk89q.worldedit.math.interpolation.Node;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren