Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-20 01:40:06 +01:00
Javadoc and Formatting fixes. (#619)
Javadoc and Formatting fixes. Also, extremely minor code changes which have been tested. This commit is only part one of two commits that aim to fix problems with formatting in our project. In part two I will modify the Google Java Style Guide (since it closely matches our code style) for our project so there is guidance on how to format and document. * Updated PlotSquared URL * Removed plugin acronyms * Fixed a typo * Fixed grammar * Use modern block id's * Update YouTube video URL
Dieser Commit ist enthalten in:
Ursprung
b06d943f7c
Commit
96dcb95b7c
98
README.md
98
README.md
@ -1,48 +1,50 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://i.imgur.com/Fog5fDB.png">
|
<img src="https://i.imgur.com/Fog5fDB.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
FAWE is a fork of WorldEdit that has huge speed and memory improvements and considerably more features
|
FAWE is a fork of WorldEdit that has huge speed and memory improvements and considerably more features
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* [Spigot Page](https://www.spigotmc.org/threads/fast-async-worldedit.100104/)
|
* [Spigot Page](https://www.spigotmc.org/threads/fast-async-worldedit.100104/)
|
||||||
* [Discord](https://discord.gg/KxkjDVg)
|
* [Discord](https://discord.gg/KxkjDVg)
|
||||||
* [Wiki](https://wiki.intellectualsites.com/FastAsyncWorldEdit/index)
|
* [Wiki](https://wiki.intellectualsites.com/FastAsyncWorldEdit/index)
|
||||||
* [Report Issue](https://github.com/IntellectualSites/FastAsyncWorldEdit/issues)
|
* [Report Issue](https://github.com/IntellectualSites/FastAsyncWorldEdit/issues)
|
||||||
* [Crowdin](https://intellectualsites.crowdin.com/fastasyncworldedit)
|
* [Crowdin](https://intellectualsites.crowdin.com/fastasyncworldedit)
|
||||||
* [JavaDocs](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/javadoc/)
|
* [JavaDocs](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/javadoc/)
|
||||||
|
|
||||||
## Downloads
|
## Downloads
|
||||||
### 1.15+
|
### 1.15+
|
||||||
* [Download](https://intellectualsites.github.io/download/fawe.html)
|
* [Download](https://www.spigotmc.org/resources/fast-async-worldedit.13932/)
|
||||||
* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/)
|
* [Jenkins](https://ci.athion.net/job/FastAsyncWorldEdit-1.16/)
|
||||||
|
|
||||||
|
Looking builds for older versions? Download them [here](https://intellectualsites.github.io/download/).
|
||||||
## Building
|
|
||||||
FAWE uses gradle to build
|
|
||||||
You can safely ignore `gradlew setupDecompWorkspace` if you are not planning to work on the forge side of FAWE.
|
## Building
|
||||||
|
FAWE uses gradle to build
|
||||||
```
|
You can safely ignore `gradlew setupDecompWorkspace` if you are not planning to work on the forge side of FAWE.
|
||||||
$ gradlew setupDecompWorkspace
|
|
||||||
$ gradlew build
|
```
|
||||||
```
|
$ gradlew setupDecompWorkspace
|
||||||
|
$ gradlew build
|
||||||
The jar is located in `worldedit-bukkit/build/libs/FastAsyncWorldEdit-1.16-###.jar`
|
```
|
||||||
|
|
||||||
## Contributing
|
The jar is located in `worldedit-bukkit/build/libs/FastAsyncWorldEdit-1.16-###.jar`
|
||||||
Have an idea for an optimization, or a cool feature?
|
|
||||||
- We will accept most PR's
|
## Contributing
|
||||||
- Let us know what you've tested / what may need further testing
|
Have an idea for an optimization, or a cool feature?
|
||||||
- If you need any help, create a ticket or discuss on [Discord](https://discord.gg/KxkjDVg)
|
- We will accept most PR's
|
||||||
|
- Let us know what you've tested / what may need further testing
|
||||||
## YourKit
|
- If you need any help, create a ticket or discuss on [Discord](https://discord.gg/KxkjDVg)
|
||||||
<a href="https://www.yourkit.com">
|
|
||||||
<img src="https://www.yourkit.com/images/yklogo.png">
|
## YourKit
|
||||||
</a>
|
<a href="https://www.yourkit.com">
|
||||||
</br>
|
<img src="https://www.yourkit.com/images/yklogo.png">
|
||||||
Thank you to YourKit for supporting our product by providing us with their innovative and intelligent tools
|
</a>
|
||||||
for monitoring and profiling Java and .NET applications.
|
</br>
|
||||||
YourKit is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>, <a href="https://www.yourkit.com/.net/profiler/">YourKit .NET Profiler</a>, and <a href="https://www.yourkit.com/youmonitor/">YourKit YouMonitor</a>
|
Thank you to YourKit for supporting our product by providing us with their innovative and intelligent tools
|
||||||
|
for monitoring and profiling Java and .NET applications.
|
||||||
|
YourKit is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>, <a href="https://www.yourkit.com/.net/profiler/">YourKit .NET Profiler</a>, and <a href="https://www.yourkit.com/youmonitor/">YourKit YouMonitor</a>
|
||||||
|
@ -19,6 +19,7 @@ import org.gradle.kotlin.dsl.withType
|
|||||||
fun Project.applyPlatformAndCoreConfiguration() {
|
fun Project.applyPlatformAndCoreConfiguration() {
|
||||||
applyCommonConfiguration()
|
applyCommonConfiguration()
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
|
apply(plugin = "eclipse")
|
||||||
apply(plugin = "idea")
|
apply(plugin = "idea")
|
||||||
apply(plugin = "maven")
|
apply(plugin = "maven")
|
||||||
// apply(plugin = "checkstyle")
|
// apply(plugin = "checkstyle")
|
||||||
|
@ -10,4 +10,13 @@
|
|||||||
<suppress files=".*[\\/]TracedEditSession.java" checks="NoFinalizer"/>
|
<suppress files=".*[\\/]TracedEditSession.java" checks="NoFinalizer"/>
|
||||||
<!-- None of the old command stuff really matters -->
|
<!-- None of the old command stuff really matters -->
|
||||||
<suppress files=".*[\\/]minecraft[\\/]util[\\/]commands[\\/].*\.java" checks=".*"/>
|
<suppress files=".*[\\/]minecraft[\\/]util[\\/]commands[\\/].*\.java" checks=".*"/>
|
||||||
|
<!-- FAWE ADDITIONS -->
|
||||||
|
<suppress files=".*[\\/]MathMan.java" checks="MethodName"/>
|
||||||
|
<suppress files=".*[\\/]net[\\/]jpountz[\\/]lz4[\\/].*\.java" checks=".*"/>
|
||||||
|
<suppress files=".*[\\/]BufferedRandomAccessFile.java" checks=".*"/>
|
||||||
|
<suppress files=".*[\\/]ByteBufferUtils.java" checks="NoWhitespaceBefore"/>
|
||||||
|
<suppress files=".*[\\/]Settings.java" checks="MemberName"/>
|
||||||
|
<suppress files=".*[\\/]FaweLimit.java" checks="MemberName"/>
|
||||||
|
<suppress files=".*[\\/]SimplexNoise.java" checks="MemberName"/>
|
||||||
|
<suppress files=".*[\\/]SparseBitSet.java" checks=".*"/>
|
||||||
</suppressions>
|
</suppressions>
|
||||||
|
@ -96,6 +96,7 @@ Checks based on Google Checks, modified for EngineHub.
|
|||||||
value="Member name ''{0}'' must match pattern ''{1}''."/>
|
value="Member name ''{0}'' must match pattern ''{1}''."/>
|
||||||
</module>
|
</module>
|
||||||
<module name="ParameterName">
|
<module name="ParameterName">
|
||||||
|
<property name="severity" value="warning"/>
|
||||||
<property name="format" value="^([a-z][a-z0-9][_a-zA-Z0-9]*|[a-z])$"/>
|
<property name="format" value="^([a-z][a-z0-9][_a-zA-Z0-9]*|[a-z])$"/>
|
||||||
<message key="name.invalidPattern"
|
<message key="name.invalidPattern"
|
||||||
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
|
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||||
@ -106,6 +107,7 @@ Checks based on Google Checks, modified for EngineHub.
|
|||||||
value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
</module>
|
</module>
|
||||||
<module name="MethodTypeParameterName">
|
<module name="MethodTypeParameterName">
|
||||||
|
<property name="severity" value="warning"/>
|
||||||
<property name="format" value="(^[A-Z][0-9]?)$|(^[A-Z][a-zA-Z0-9]*$)"/>
|
<property name="format" value="(^[A-Z][0-9]?)$|(^[A-Z][a-zA-Z0-9]*$)"/>
|
||||||
<message key="name.invalidPattern"
|
<message key="name.invalidPattern"
|
||||||
value="Method type name ''{0}'' must match pattern ''{1}''."/>
|
value="Method type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
@ -186,6 +188,7 @@ Checks based on Google Checks, modified for EngineHub.
|
|||||||
<module name="CommentsIndentation"/>
|
<module name="CommentsIndentation"/>
|
||||||
<!-- Validate String.to(Lower|Upper)Case() calls include Locale argument -->
|
<!-- Validate String.to(Lower|Upper)Case() calls include Locale argument -->
|
||||||
<module name="Regexp">
|
<module name="Regexp">
|
||||||
|
<property name="severity" value="warning"/>
|
||||||
<property name="message" value="Case-conversion calls must include an explicit Locale"/>
|
<property name="message" value="Case-conversion calls must include an explicit Locale"/>
|
||||||
<property name="format" value="(?!Character)\.to(Lower|Upper)Case\(\)"/>
|
<property name="format" value="(?!Character)\.to(Lower|Upper)Case\(\)"/>
|
||||||
<property name="illegalPattern" value="true"/>
|
<property name="illegalPattern" value="true"/>
|
||||||
|
@ -83,7 +83,7 @@ var clothColorsOpt = [
|
|||||||
];
|
];
|
||||||
var clothColorsOptHD = [
|
var clothColorsOptHD = [
|
||||||
makeColor(168, 168, 168), // White
|
makeColor(168, 168, 168), // White
|
||||||
makeColor(143, 59, 0), // Orange
|
makeColor(143, 59, 0), // Orange
|
||||||
makeColor(152, 0, 67), // Magenta
|
makeColor(152, 0, 67), // Magenta
|
||||||
makeColor(0, 153, 153), // Light blue
|
makeColor(0, 153, 153), // Light blue
|
||||||
makeColor(150, 150, 0), // Yellow
|
makeColor(150, 150, 0), // Yellow
|
||||||
@ -115,16 +115,16 @@ function colorDistance(c1, c2) {
|
|||||||
function findClosestWoolColor(col, clothColors) {
|
function findClosestWoolColor(col, clothColors) {
|
||||||
var closestId = 0;
|
var closestId = 0;
|
||||||
var closestDistance = colorDistance(col, clothColors[0]);
|
var closestDistance = colorDistance(col, clothColors[0]);
|
||||||
|
|
||||||
for(var i = 1; i < clothColors.length; i++) {
|
for (var i = 1; i < clothColors.length; i++) {
|
||||||
var dist = colorDistance(col, clothColors[i]);
|
var dist = colorDistance(col, clothColors[i]);
|
||||||
|
|
||||||
if(dist < closestDistance) {
|
if (dist < closestDistance) {
|
||||||
closestId = i;
|
closestId = i;
|
||||||
closestDistance = dist;
|
closestDistance = dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return closestId;
|
return closestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,10 +135,10 @@ var f = context.getSafeOpenFile("drawings", argv[1], "png", ["png", "jpg", "jpeg
|
|||||||
var sess = context.remember();
|
var sess = context.remember();
|
||||||
var upright = argv[2] == "v";
|
var upright = argv[2] == "v";
|
||||||
var colors = clothColors;
|
var colors = clothColors;
|
||||||
if(argv[3] == "opt") {
|
if (argv[3] == "opt") {
|
||||||
colors = clothColorsOpt;
|
colors = clothColorsOpt;
|
||||||
player.print("Using optimized palette");
|
player.print("Using optimized palette");
|
||||||
} else if(argv[3] == "optHD") {
|
} else if (argv[3] == "optHD") {
|
||||||
colors = clothColorsOptHD;
|
colors = clothColorsOptHD;
|
||||||
player.print("Using optimized HD palette");
|
player.print("Using optimized HD palette");
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ var blocktype = context.getBlock(argv[1]);
|
|||||||
|
|
||||||
var cycles = region.getLength();
|
var cycles = region.getLength();
|
||||||
|
|
||||||
if (region.getWidth() > cycles){
|
if (region.getWidth() > cycles) {
|
||||||
cycles = region.getWidth();
|
cycles = region.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,4 +50,4 @@ for (var c = 0; c < cycles; c++) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import com.boydti.fawe.bukkit.adapter.BukkitQueueHandler;
|
|||||||
import com.boydti.fawe.bukkit.listener.BrushListener;
|
import com.boydti.fawe.bukkit.listener.BrushListener;
|
||||||
import com.boydti.fawe.bukkit.listener.BukkitImageListener;
|
import com.boydti.fawe.bukkit.listener.BukkitImageListener;
|
||||||
import com.boydti.fawe.bukkit.listener.CFIPacketListener;
|
import com.boydti.fawe.bukkit.listener.CFIPacketListener;
|
||||||
import com.boydti.fawe.bukkit.listener.ChunkListener_9;
|
import com.boydti.fawe.bukkit.listener.ChunkListener9;
|
||||||
import com.boydti.fawe.bukkit.listener.RenderListener;
|
import com.boydti.fawe.bukkit.listener.RenderListener;
|
||||||
import com.boydti.fawe.bukkit.regions.FreeBuildRegion;
|
import com.boydti.fawe.bukkit.regions.FreeBuildRegion;
|
||||||
import com.boydti.fawe.bukkit.regions.GriefPreventionFeature;
|
import com.boydti.fawe.bukkit.regions.GriefPreventionFeature;
|
||||||
@ -95,7 +95,7 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
|
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
|
||||||
|
|
||||||
// The tick limiter
|
// The tick limiter
|
||||||
new ChunkListener_9();
|
new ChunkListener9();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ 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 ignored) {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -252,7 +252,8 @@ public class FaweBukkit implements IFawe, Listener {
|
|||||||
|
|
||||||
private volatile boolean keepUnloaded;
|
private volatile boolean keepUnloaded;
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR) public void onWorldLoad(WorldLoadEvent event) {
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
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);
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package com.boydti.fawe.bukkit.adapter;
|
package com.boydti.fawe.bukkit.adapter;
|
||||||
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
|
||||||
|
|
||||||
import co.aikar.timings.Timings;
|
import co.aikar.timings.Timings;
|
||||||
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
import com.boydti.fawe.beta.implementation.queue.QueueHandler;
|
||||||
import com.boydti.fawe.bukkit.listener.ChunkListener;
|
import com.boydti.fawe.bukkit.listener.ChunkListener;
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import org.spigotmc.AsyncCatcher;
|
import org.spigotmc.AsyncCatcher;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
public class BukkitQueueHandler extends QueueHandler {
|
public class BukkitQueueHandler extends QueueHandler {
|
||||||
private volatile boolean timingsEnabled;
|
private volatile boolean timingsEnabled;
|
||||||
private static boolean alertTimingsChange = true;
|
private static boolean alertTimingsChange = true;
|
||||||
@ -17,7 +18,8 @@ public class BukkitQueueHandler extends QueueHandler {
|
|||||||
try {
|
try {
|
||||||
methodCheck = Class.forName("co.aikar.timings.TimingsManager").getDeclaredMethod("recheckEnabled");
|
methodCheck = Class.forName("co.aikar.timings.TimingsManager").getDeclaredMethod("recheckEnabled");
|
||||||
methodCheck.setAccessible(true);
|
methodCheck.setAccessible(true);
|
||||||
} catch (Throwable ignore){}
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,7 +2,13 @@ package com.boydti.fawe.bukkit.adapter.mc1_15_2;
|
|||||||
|
|
||||||
import com.sk89q.util.ReflectionUtil;
|
import com.sk89q.util.ReflectionUtil;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import net.minecraft.server.v1_15_R1.*;
|
import net.minecraft.server.v1_15_R1.Block;
|
||||||
|
import net.minecraft.server.v1_15_R1.BlockAccessAir;
|
||||||
|
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_15_R1.EnumPistonReaction;
|
||||||
|
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_15_R1.ITileEntity;
|
||||||
|
import net.minecraft.server.v1_15_R1.Material;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
|
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
|
||||||
|
|
||||||
public class BlockMaterial_1_15_2 implements BlockMaterial {
|
public class BlockMaterial_1_15_2 implements BlockMaterial {
|
||||||
|
@ -52,22 +52,22 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
|||||||
/*
|
/*
|
||||||
NMS fields
|
NMS fields
|
||||||
*/
|
*/
|
||||||
public final static Field fieldBits;
|
public static final Field fieldBits;
|
||||||
public final static Field fieldPalette;
|
public static final Field fieldPalette;
|
||||||
public final static Field fieldSize;
|
public static final Field fieldSize;
|
||||||
|
|
||||||
public final static Field fieldFluidCount;
|
public static final Field fieldFluidCount;
|
||||||
public final static Field fieldTickingBlockCount;
|
public static final Field fieldTickingBlockCount;
|
||||||
public final static Field fieldNonEmptyBlockCount;
|
public static final Field fieldNonEmptyBlockCount;
|
||||||
|
|
||||||
private final static Field fieldDirtyCount;
|
private static final Field fieldDirtyCount;
|
||||||
private final static Field fieldDirtyBits;
|
private static final Field fieldDirtyBits;
|
||||||
|
|
||||||
private static final Field fieldBiomeArray;
|
private static final Field fieldBiomeArray;
|
||||||
|
|
||||||
private final static MethodHandle methodGetVisibleChunk;
|
private final static MethodHandle methodGetVisibleChunk;
|
||||||
|
|
||||||
public final static MethodHandle methodSetLightNibbleArray;
|
public static final MethodHandle methodSetLightNibbleArray;
|
||||||
|
|
||||||
private static final int CHUNKSECTION_BASE;
|
private static final int CHUNKSECTION_BASE;
|
||||||
private static final int CHUNKSECTION_SHIFT;
|
private static final int CHUNKSECTION_SHIFT;
|
||||||
@ -114,8 +114,9 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
|||||||
Unsafe unsafe = UnsafeUtils.getUNSAFE();
|
Unsafe unsafe = UnsafeUtils.getUNSAFE();
|
||||||
CHUNKSECTION_BASE = unsafe.arrayBaseOffset(ChunkSection[].class);
|
CHUNKSECTION_BASE = unsafe.arrayBaseOffset(ChunkSection[].class);
|
||||||
int scale = unsafe.arrayIndexScale(ChunkSection[].class);
|
int scale = unsafe.arrayIndexScale(ChunkSection[].class);
|
||||||
if ((scale & (scale - 1)) != 0)
|
if ((scale & (scale - 1)) != 0) {
|
||||||
throw new Error("data type scale not a power of two");
|
throw new Error("data type scale not a power of two");
|
||||||
|
}
|
||||||
CHUNKSECTION_SHIFT = 31 - Integer.numberOfLeadingZeros(scale);
|
CHUNKSECTION_SHIFT = 31 - Integer.numberOfLeadingZeros(scale);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw e;
|
throw e;
|
||||||
@ -152,17 +153,17 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Chunk ensureLoaded(World nmsWorld, int X, int Z) {
|
public static Chunk ensureLoaded(World nmsWorld, int chunkX, int chunkZ) {
|
||||||
Chunk nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
|
Chunk nmsChunk = nmsWorld.getChunkIfLoaded(chunkX, chunkZ);
|
||||||
if (nmsChunk != null) {
|
if (nmsChunk != null) {
|
||||||
return nmsChunk;
|
return nmsChunk;
|
||||||
}
|
}
|
||||||
if (Fawe.isMainThread()) {
|
if (Fawe.isMainThread()) {
|
||||||
return nmsWorld.getChunkAt(X, Z);
|
return nmsWorld.getChunkAt(chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
if (PaperLib.isPaper()) {
|
if (PaperLib.isPaper()) {
|
||||||
CraftWorld craftWorld = nmsWorld.getWorld();
|
CraftWorld craftWorld = nmsWorld.getWorld();
|
||||||
CompletableFuture<org.bukkit.Chunk> future = craftWorld.getChunkAtAsync(X, Z, true);
|
CompletableFuture<org.bukkit.Chunk> future = craftWorld.getChunkAtAsync(chunkX, chunkZ, true);
|
||||||
try {
|
try {
|
||||||
CraftChunk chunk = (CraftChunk) future.get();
|
CraftChunk chunk = (CraftChunk) future.get();
|
||||||
return chunk.getHandle();
|
return chunk.getHandle();
|
||||||
@ -171,20 +172,20 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO optimize
|
// TODO optimize
|
||||||
return TaskManager.IMP.sync(() -> nmsWorld.getChunkAt(X, Z));
|
return TaskManager.IMP.sync(() -> nmsWorld.getChunkAt(chunkX, chunkZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerChunk getPlayerChunk(WorldServer nmsWorld, final int cx, final int cz) {
|
public static PlayerChunk getPlayerChunk(WorldServer nmsWorld, final int cx, final int cz) {
|
||||||
PlayerChunkMap chunkMap = nmsWorld.getChunkProvider().playerChunkMap;
|
PlayerChunkMap chunkMap = nmsWorld.getChunkProvider().playerChunkMap;
|
||||||
try {
|
try {
|
||||||
return (PlayerChunk)methodGetVisibleChunk.invoke(chunkMap, ChunkCoordIntPair.pair(cx, cz));
|
return (PlayerChunk) methodGetVisibleChunk.invoke(chunkMap, ChunkCoordIntPair.pair(cx, cz));
|
||||||
} catch (Throwable thr) {
|
} catch (Throwable thr) {
|
||||||
throw new RuntimeException(thr);
|
throw new RuntimeException(thr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendChunk(WorldServer nmsWorld, int X, int Z, int mask, boolean lighting) {
|
public static void sendChunk(WorldServer nmsWorld, int chunkX, int chunkZ, int mask, boolean lighting) {
|
||||||
PlayerChunk playerChunk = getPlayerChunk(nmsWorld, X, Z);
|
PlayerChunk playerChunk = getPlayerChunk(nmsWorld, chunkX, chunkZ);
|
||||||
if (playerChunk == null) {
|
if (playerChunk == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -205,7 +206,7 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
|||||||
fieldDirtyCount.set(playerChunk, 64);
|
fieldDirtyCount.set(playerChunk, 64);
|
||||||
|
|
||||||
if (lighting) {
|
if (lighting) {
|
||||||
ChunkCoordIntPair chunkCoordIntPair = new ChunkCoordIntPair(X, Z);
|
ChunkCoordIntPair chunkCoordIntPair = new ChunkCoordIntPair(chunkX, chunkZ);
|
||||||
PacketPlayOutLightUpdate packet = new PacketPlayOutLightUpdate(chunkCoordIntPair, nmsWorld.getChunkProvider().getLightEngine());
|
PacketPlayOutLightUpdate packet = new PacketPlayOutLightUpdate(chunkCoordIntPair, nmsWorld.getChunkProvider().getLightEngine());
|
||||||
playerChunk.players.a(chunkCoordIntPair, false).forEach(p -> {
|
playerChunk.players.a(chunkCoordIntPair, false).forEach(p -> {
|
||||||
p.playerConnection.sendPacket(packet);
|
p.playerConnection.sendPacket(packet);
|
||||||
@ -259,7 +260,9 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
|||||||
|
|
||||||
final int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
final int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
||||||
if (num_palette == 1) {
|
if (num_palette == 1) {
|
||||||
for (int i = 0; i < blockBitArrayEnd; i++) blockStates[i] = 0;
|
for (int i = 0; i < blockBitArrayEnd; i++) {
|
||||||
|
blockStates[i] = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final BitArray bitArray = new BitArray(bitsPerEntry, 4096, blockStates);
|
final BitArray bitArray = new BitArray(bitsPerEntry, 4096, blockStates);
|
||||||
bitArray.fromRaw(blocksCopy);
|
bitArray.fromRaw(blocksCopy);
|
||||||
@ -273,7 +276,6 @@ public final class BukkitAdapter_1_15_2 extends NMSAdapter {
|
|||||||
final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd);
|
final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd);
|
||||||
final DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
final DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
||||||
final DataPalette<IBlockData> palette;
|
final DataPalette<IBlockData> palette;
|
||||||
// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
|
||||||
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d);
|
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d);
|
||||||
|
|
||||||
// set palette
|
// set palette
|
||||||
|
@ -58,7 +58,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.AbstractSet;
|
import java.util.AbstractSet;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -72,6 +71,7 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
@ -80,24 +80,29 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_15_2.class);
|
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_15_2.class);
|
||||||
|
|
||||||
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_15_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
private static final Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_15_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||||
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];
|
||||||
private boolean createCopy = false;
|
private boolean createCopy = false;
|
||||||
private BukkitGetBlocks_1_15_2_Copy copy = null;
|
private BukkitGetBlocks_1_15_2_Copy copy = null;
|
||||||
|
|
||||||
public BukkitGetBlocks_1_15_2(World world, int X, int Z) {
|
public BukkitGetBlocks_1_15_2(World world, int chunkX, int chunkZ) {
|
||||||
this(((CraftWorld) world).getHandle(), X, Z);
|
this(((CraftWorld) world).getHandle(), chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitGetBlocks_1_15_2(WorldServer world, int X, int Z) {
|
public BukkitGetBlocks_1_15_2(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 getChunkX() {
|
||||||
|
return chunkX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -115,12 +120,8 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getX() {
|
public int getChunkZ() {
|
||||||
return X;
|
return chunkZ;
|
||||||
}
|
|
||||||
|
|
||||||
public int getZ() {
|
|
||||||
return Z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -130,7 +131,9 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
if (y == -1) {
|
if (y == -1) {
|
||||||
for (y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
|
for (y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
|
||||||
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
||||||
if (base != null) break;
|
if (base != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
||||||
@ -140,7 +143,8 @@ public class BukkitGetBlocks_1_15_2 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;
|
||||||
}
|
}
|
||||||
@ -164,11 +168,11 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@ -227,7 +231,9 @@ public class BukkitGetBlocks_1_15_2 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();
|
||||||
@ -304,16 +310,16 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
entity.die();
|
entity.die();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk ensureLoaded(net.minecraft.server.v1_15_R1.World nmsWorld, int X, int Z) {
|
public Chunk ensureLoaded(net.minecraft.server.v1_15_R1.World nmsWorld, int chunkX, int chunkZ) {
|
||||||
return BukkitAdapter_1_15_2.ensureLoaded(nmsWorld, X, Z);
|
return BukkitAdapter_1_15_2.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) {
|
||||||
copy = createCopy ? new BukkitGetBlocks_1_15_2_Copy(world, getX(), getZ()) : null;
|
copy = createCopy ? new BukkitGetBlocks_1_15_2_Copy(world, getChunkX(), getChunkZ()) : null;
|
||||||
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
|
||||||
@ -348,7 +354,7 @@ public class BukkitGetBlocks_1_15_2 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)){
|
if (!set.hasSection(layer)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (createCopy) {
|
if (createCopy) {
|
||||||
@ -368,7 +374,8 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -395,7 +402,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
}
|
}
|
||||||
newSection = BukkitAdapter_1_15_2.newChunkSection(layer, this::load, setArr, fastmode);
|
newSection = BukkitAdapter_1_15_2.newChunkSection(layer, this::load, setArr, fastmode);
|
||||||
if (!BukkitAdapter_1_15_2.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
if (!BukkitAdapter_1_15_2.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
||||||
log.error("Failed to set chunk section:" + X + "," + Z + " layer: " + 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);
|
||||||
@ -458,12 +465,14 @@ public class BukkitGetBlocks_1_15_2 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();
|
||||||
@ -488,7 +497,9 @@ public class BukkitGetBlocks_1_15_2 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) {
|
||||||
@ -516,7 +527,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
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);
|
||||||
@ -530,7 +541,9 @@ public class BukkitGetBlocks_1_15_2 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()) {
|
||||||
@ -572,8 +585,10 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
|||||||
nmsChunk.mustNotSave = false;
|
nmsChunk.mustNotSave = false;
|
||||||
nmsChunk.markDirty();
|
nmsChunk.markDirty();
|
||||||
// send to player
|
// send to player
|
||||||
BukkitAdapter_1_15_2.sendChunk(nmsWorld, X, Z, finalMask, finalLightUpdate);
|
BukkitAdapter_1_15_2.sendChunk(nmsWorld, chunkX, chunkZ, finalMask, finalLightUpdate);
|
||||||
if (finalizer != null) finalizer.run();
|
if (finalizer != null) {
|
||||||
|
finalizer.run();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (syncTasks != null) {
|
if (syncTasks != null) {
|
||||||
@ -590,7 +605,9 @@ public class BukkitGetBlocks_1_15_2 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);
|
||||||
@ -603,7 +620,9 @@ public class BukkitGetBlocks_1_15_2 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();
|
||||||
}
|
}
|
||||||
@ -753,7 +772,7 @@ public class BukkitGetBlocks_1_15_2 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,12 +25,13 @@ import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
|||||||
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
|
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class FAWEWorldNativeAccess_1_15_2 implements WorldNativeAccess<Chunk, IBlockData, BlockPosition> {
|
public class FAWEWorldNativeAccess_1_15_2 implements WorldNativeAccess<Chunk, IBlockData, BlockPosition> {
|
||||||
private static final int UPDATE = 1, NOTIFY = 2;
|
private static final int UPDATE = 1;
|
||||||
|
private static final int NOTIFY = 2;
|
||||||
|
|
||||||
private final FAWE_Spigot_v1_15_R2 adapter;
|
private final FAWE_Spigot_v1_15_R2 adapter;
|
||||||
private final WeakReference<World> world;
|
private final WeakReference<World> world;
|
||||||
@ -170,4 +171,4 @@ public class FAWEWorldNativeAccess_1_15_2 implements WorldNativeAccess<Chunk, IB
|
|||||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException {
|
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException {
|
||||||
return this.adapter.setBlock(this.getChunk(position.getBlockX() >> 4, position.getBlockZ() >> 4).bukkitChunk, position.getBlockX(), position.getBlockY(), position.getBlockZ(), block, sideEffectSet.shouldApply(SideEffect.LIGHTING));
|
return this.adapter.setBlock(this.getChunk(position.getBlockX() >> 4, position.getBlockZ() >> 4).bukkitChunk, position.getBlockX(), position.getBlockY(), position.getBlockZ(), block, sideEffectSet.shouldApply(SideEffect.LIGHTING));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,14 @@ package com.boydti.fawe.bukkit.adapter.mc1_16_1;
|
|||||||
|
|
||||||
import com.sk89q.util.ReflectionUtil;
|
import com.sk89q.util.ReflectionUtil;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import net.minecraft.server.v1_16_R1.*;
|
import net.minecraft.server.v1_16_R1.Block;
|
||||||
|
import net.minecraft.server.v1_16_R1.BlockAccessAir;
|
||||||
|
import net.minecraft.server.v1_16_R1.BlockBase;
|
||||||
|
import net.minecraft.server.v1_16_R1.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_16_R1.EnumPistonReaction;
|
||||||
|
import net.minecraft.server.v1_16_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_16_R1.ITileEntity;
|
||||||
|
import net.minecraft.server.v1_16_R1.Material;
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.block.data.CraftBlockData;
|
import org.bukkit.craftbukkit.v1_16_R1.block.data.CraftBlockData;
|
||||||
|
|
||||||
public class BlockMaterial_1_16_1 implements BlockMaterial {
|
public class BlockMaterial_1_16_1 implements BlockMaterial {
|
||||||
|
@ -14,7 +14,23 @@ import com.sk89q.worldedit.world.block.BlockState;
|
|||||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import net.jpountz.util.UnsafeUtils;
|
import net.jpountz.util.UnsafeUtils;
|
||||||
import net.minecraft.server.v1_16_R1.*;
|
import net.minecraft.server.v1_16_R1.BiomeBase;
|
||||||
|
import net.minecraft.server.v1_16_R1.BiomeStorage;
|
||||||
|
import net.minecraft.server.v1_16_R1.Block;
|
||||||
|
import net.minecraft.server.v1_16_R1.Chunk;
|
||||||
|
import net.minecraft.server.v1_16_R1.ChunkCoordIntPair;
|
||||||
|
import net.minecraft.server.v1_16_R1.ChunkSection;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataBits;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataPalette;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataPaletteBlock;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataPaletteLinear;
|
||||||
|
import net.minecraft.server.v1_16_R1.GameProfileSerializer;
|
||||||
|
import net.minecraft.server.v1_16_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_16_R1.PacketPlayOutLightUpdate;
|
||||||
|
import net.minecraft.server.v1_16_R1.PlayerChunk;
|
||||||
|
import net.minecraft.server.v1_16_R1.PlayerChunkMap;
|
||||||
|
import net.minecraft.server.v1_16_R1.World;
|
||||||
|
import net.minecraft.server.v1_16_R1.WorldServer;
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.CraftChunk;
|
import org.bukkit.craftbukkit.v1_16_R1.CraftChunk;
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
|
||||||
import sun.misc.Unsafe;
|
import sun.misc.Unsafe;
|
||||||
@ -34,18 +50,18 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
|
|||||||
/*
|
/*
|
||||||
NMS fields
|
NMS fields
|
||||||
*/
|
*/
|
||||||
public final static Field fieldBits;
|
public static final Field fieldBits;
|
||||||
public final static Field fieldPalette;
|
public static final Field fieldPalette;
|
||||||
public final static Field fieldSize;
|
public static final Field fieldSize;
|
||||||
|
|
||||||
public final static Field fieldBitsPerEntry;
|
public static final Field fieldBitsPerEntry;
|
||||||
|
|
||||||
public final static Field fieldFluidCount;
|
public static final Field fieldFluidCount;
|
||||||
public final static Field fieldTickingBlockCount;
|
public static final Field fieldTickingBlockCount;
|
||||||
public final static Field fieldNonEmptyBlockCount;
|
public static final Field fieldNonEmptyBlockCount;
|
||||||
|
|
||||||
private final static Field fieldDirtyCount;
|
private static final Field fieldDirtyCount;
|
||||||
private final static Field fieldDirtyBits;
|
private static final Field fieldDirtyBits;
|
||||||
|
|
||||||
private static final Field fieldBiomeArray;
|
private static final Field fieldBiomeArray;
|
||||||
|
|
||||||
@ -95,8 +111,9 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
|
|||||||
Unsafe unsafe = UnsafeUtils.getUNSAFE();
|
Unsafe unsafe = UnsafeUtils.getUNSAFE();
|
||||||
CHUNKSECTION_BASE = unsafe.arrayBaseOffset(ChunkSection[].class);
|
CHUNKSECTION_BASE = unsafe.arrayBaseOffset(ChunkSection[].class);
|
||||||
int scale = unsafe.arrayIndexScale(ChunkSection[].class);
|
int scale = unsafe.arrayIndexScale(ChunkSection[].class);
|
||||||
if ((scale & (scale - 1)) != 0)
|
if ((scale & (scale - 1)) != 0) {
|
||||||
throw new Error("data type scale not a power of two");
|
throw new Error("data type scale not a power of two");
|
||||||
|
}
|
||||||
CHUNKSECTION_SHIFT = 31 - Integer.numberOfLeadingZeros(scale);
|
CHUNKSECTION_SHIFT = 31 - Integer.numberOfLeadingZeros(scale);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw e;
|
throw e;
|
||||||
@ -133,17 +150,17 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Chunk ensureLoaded(World nmsWorld, int X, int Z) {
|
public static Chunk ensureLoaded(World nmsWorld, int chunkX, int chunkZ) {
|
||||||
Chunk nmsChunk = nmsWorld.getChunkProvider().getChunkAt(X, Z, false);
|
Chunk nmsChunk = nmsWorld.getChunkProvider().getChunkAt(chunkX, chunkZ, false);
|
||||||
if (nmsChunk != null) {
|
if (nmsChunk != null) {
|
||||||
return nmsChunk;
|
return nmsChunk;
|
||||||
}
|
}
|
||||||
if (Fawe.isMainThread()) {
|
if (Fawe.isMainThread()) {
|
||||||
return nmsWorld.getChunkAt(X, Z);
|
return nmsWorld.getChunkAt(chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
if (PaperLib.isPaper()) {
|
if (PaperLib.isPaper()) {
|
||||||
CraftWorld craftWorld = nmsWorld.getWorld();
|
CraftWorld craftWorld = nmsWorld.getWorld();
|
||||||
CompletableFuture<org.bukkit.Chunk> future = craftWorld.getChunkAtAsync(X, Z, true);
|
CompletableFuture<org.bukkit.Chunk> future = craftWorld.getChunkAtAsync(chunkX, chunkZ, true);
|
||||||
try {
|
try {
|
||||||
CraftChunk chunk = (CraftChunk) future.get();
|
CraftChunk chunk = (CraftChunk) future.get();
|
||||||
return chunk.getHandle();
|
return chunk.getHandle();
|
||||||
@ -152,20 +169,20 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO optimize
|
// TODO optimize
|
||||||
return TaskManager.IMP.sync(() -> nmsWorld.getChunkAt(X, Z));
|
return TaskManager.IMP.sync(() -> nmsWorld.getChunkAt(chunkX, chunkZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerChunk getPlayerChunk(WorldServer nmsWorld, final int cx, final int cz) {
|
public static PlayerChunk getPlayerChunk(WorldServer nmsWorld, final int cx, final int cz) {
|
||||||
PlayerChunkMap chunkMap = nmsWorld.getChunkProvider().playerChunkMap;
|
PlayerChunkMap chunkMap = nmsWorld.getChunkProvider().playerChunkMap;
|
||||||
try {
|
try {
|
||||||
return (PlayerChunk)methodGetVisibleChunk.invoke(chunkMap, ChunkCoordIntPair.pair(cx, cz));
|
return (PlayerChunk) methodGetVisibleChunk.invoke(chunkMap, ChunkCoordIntPair.pair(cx, cz));
|
||||||
} catch (Throwable thr) {
|
} catch (Throwable thr) {
|
||||||
throw new RuntimeException(thr);
|
throw new RuntimeException(thr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendChunk(WorldServer nmsWorld, int X, int Z, int mask, boolean lighting) {
|
public static void sendChunk(WorldServer nmsWorld, int chunkX, int chunkZ, int mask, boolean lighting) {
|
||||||
PlayerChunk playerChunk = getPlayerChunk(nmsWorld, X, Z);
|
PlayerChunk playerChunk = getPlayerChunk(nmsWorld, chunkX, chunkZ);
|
||||||
if (playerChunk == null) {
|
if (playerChunk == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -186,7 +203,7 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
|
|||||||
fieldDirtyCount.set(playerChunk, 64);
|
fieldDirtyCount.set(playerChunk, 64);
|
||||||
|
|
||||||
if (lighting) {
|
if (lighting) {
|
||||||
ChunkCoordIntPair chunkCoordIntPair = new ChunkCoordIntPair(X, Z);
|
ChunkCoordIntPair chunkCoordIntPair = new ChunkCoordIntPair(chunkX, chunkZ);
|
||||||
boolean trustEdges = false; //Added in 1.16.1 Not sure what it does.
|
boolean trustEdges = false; //Added in 1.16.1 Not sure what it does.
|
||||||
PacketPlayOutLightUpdate packet = new PacketPlayOutLightUpdate(chunkCoordIntPair, nmsWorld.getChunkProvider().getLightEngine(), trustEdges);
|
PacketPlayOutLightUpdate packet = new PacketPlayOutLightUpdate(chunkCoordIntPair, nmsWorld.getChunkProvider().getLightEngine(), trustEdges);
|
||||||
playerChunk.players.a(chunkCoordIntPair, false).forEach(p -> {
|
playerChunk.players.a(chunkCoordIntPair, false).forEach(p -> {
|
||||||
@ -241,7 +258,9 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
|
|||||||
final int blockBitArrayEnd = MathMan.ceilZero((float) 4096 / blocksPerLong);
|
final int blockBitArrayEnd = MathMan.ceilZero((float) 4096 / blocksPerLong);
|
||||||
|
|
||||||
if (num_palette == 1) {
|
if (num_palette == 1) {
|
||||||
for (int i = 0; i < blockBitArrayEnd; i++) blockStates[i] = 0;
|
for (int i = 0; i < blockBitArrayEnd; i++) {
|
||||||
|
blockStates[i] = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final BitArrayUnstretched bitArray = new BitArrayUnstretched(bitsPerEntry, 4096, blockStates);
|
final BitArrayUnstretched bitArray = new BitArrayUnstretched(bitsPerEntry, 4096, blockStates);
|
||||||
bitArray.fromRaw(blocksCopy);
|
bitArray.fromRaw(blocksCopy);
|
||||||
@ -255,7 +274,6 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
|
|||||||
final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd);
|
final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd);
|
||||||
final DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
final DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
||||||
final DataPalette<IBlockData> palette;
|
final DataPalette<IBlockData> palette;
|
||||||
// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
|
||||||
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::c);
|
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::c);
|
||||||
|
|
||||||
// set palette
|
// set palette
|
||||||
|
@ -15,8 +15,10 @@ import com.boydti.fawe.object.collection.AdaptedMap;
|
|||||||
import com.boydti.fawe.object.collection.BitArrayUnstretched;
|
import com.boydti.fawe.object.collection.BitArrayUnstretched;
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.jnbt.ListTag;
|
||||||
|
import com.sk89q.jnbt.StringTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.jnbt.*;
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||||
@ -25,7 +27,28 @@ 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 net.minecraft.server.v1_16_R1.*;
|
import net.minecraft.server.v1_16_R1.BiomeBase;
|
||||||
|
import net.minecraft.server.v1_16_R1.BiomeStorage;
|
||||||
|
import net.minecraft.server.v1_16_R1.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_16_R1.Chunk;
|
||||||
|
import net.minecraft.server.v1_16_R1.ChunkSection;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataBits;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataPalette;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataPaletteBlock;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataPaletteHash;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataPaletteLinear;
|
||||||
|
import net.minecraft.server.v1_16_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_16_R1.EntityTypes;
|
||||||
|
import net.minecraft.server.v1_16_R1.EnumSkyBlock;
|
||||||
|
import net.minecraft.server.v1_16_R1.HeightMap;
|
||||||
|
import net.minecraft.server.v1_16_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_16_R1.LightEngine;
|
||||||
|
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
||||||
|
import net.minecraft.server.v1_16_R1.NBTTagInt;
|
||||||
|
import net.minecraft.server.v1_16_R1.NibbleArray;
|
||||||
|
import net.minecraft.server.v1_16_R1.SectionPosition;
|
||||||
|
import net.minecraft.server.v1_16_R1.TileEntity;
|
||||||
|
import net.minecraft.server.v1_16_R1.WorldServer;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
|
||||||
@ -35,11 +58,20 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import java.util.AbstractSet;
|
||||||
import java.util.*;
|
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.Callable;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
@ -48,24 +80,30 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
|||||||
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_16_1.class);
|
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_16_1.class);
|
||||||
|
|
||||||
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_16_1(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
private static final Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_16_1(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||||
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];
|
||||||
private boolean createCopy = false;
|
private boolean createCopy = false;
|
||||||
private BukkitGetBlocks_1_16_1_Copy copy = null;
|
private BukkitGetBlocks_1_16_1_Copy copy = null;
|
||||||
|
|
||||||
public BukkitGetBlocks_1_16_1(World world, int X, int Z) {
|
public BukkitGetBlocks_1_16_1(World world, int chunkX, int chunkZ) {
|
||||||
this(((CraftWorld) world).getHandle(), X, Z);
|
this(((CraftWorld) world).getHandle(), chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitGetBlocks_1_16_1(WorldServer world, int X, int Z) {
|
public BukkitGetBlocks_1_16_1(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 getChunkX() {
|
||||||
|
return chunkX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -83,12 +121,8 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getX() {
|
public int getChunkZ() {
|
||||||
return X;
|
return chunkZ;
|
||||||
}
|
|
||||||
|
|
||||||
public int getZ() {
|
|
||||||
return Z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,7 +132,9 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
|||||||
if (y == -1) {
|
if (y == -1) {
|
||||||
for (y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
|
for (y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
|
||||||
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
||||||
if (base != null) break;
|
if (base != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
||||||
@ -108,7 +144,9 @@ public class BukkitGetBlocks_1_16_1 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;
|
||||||
}
|
}
|
||||||
@ -193,7 +231,9 @@ public class BukkitGetBlocks_1_16_1 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();
|
||||||
@ -270,16 +310,16 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
|||||||
entity.die();
|
entity.die();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk ensureLoaded(net.minecraft.server.v1_16_R1.World nmsWorld, int X, int Z) {
|
public Chunk ensureLoaded(net.minecraft.server.v1_16_R1.World nmsWorld, int chunkX, int chunkZ) {
|
||||||
return BukkitAdapter_1_16_1.ensureLoaded(nmsWorld, X, Z);
|
return BukkitAdapter_1_16_1.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) {
|
||||||
copy = createCopy ? new BukkitGetBlocks_1_16_1_Copy(world, getX(), getZ()) : null;
|
copy = createCopy ? new BukkitGetBlocks_1_16_1_Copy(world, getChunkX(), getChunkZ()) : null;
|
||||||
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
|
||||||
@ -314,7 +354,7 @@ public class BukkitGetBlocks_1_16_1 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)){
|
if (!set.hasSection(layer)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (createCopy) {
|
if (createCopy) {
|
||||||
@ -334,7 +374,8 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
|||||||
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,7 +404,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
|||||||
.newChunkSection(layer, this::load, setArr, fastmode);
|
.newChunkSection(layer, this::load, setArr, fastmode);
|
||||||
if (!BukkitAdapter_1_16_1
|
if (!BukkitAdapter_1_16_1
|
||||||
.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
||||||
log.error("Failed to set chunk section:" + X + "," + Z + " layer: " + 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);
|
||||||
@ -426,12 +467,14 @@ public class BukkitGetBlocks_1_16_1 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();
|
||||||
@ -456,7 +499,9 @@ public class BukkitGetBlocks_1_16_1 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) {
|
||||||
@ -498,7 +543,9 @@ public class BukkitGetBlocks_1_16_1 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()) {
|
||||||
@ -540,8 +587,10 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
|||||||
nmsChunk.mustNotSave = false;
|
nmsChunk.mustNotSave = false;
|
||||||
nmsChunk.markDirty();
|
nmsChunk.markDirty();
|
||||||
// send to player
|
// send to player
|
||||||
BukkitAdapter_1_16_1.sendChunk(nmsWorld, X, Z, finalMask, finalLightUpdate);
|
BukkitAdapter_1_16_1.sendChunk(nmsWorld, chunkX, chunkZ, finalMask, finalLightUpdate);
|
||||||
if (finalizer != null) finalizer.run();
|
if (finalizer != null) {
|
||||||
|
finalizer.run();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (syncTasks != null) {
|
if (syncTasks != null) {
|
||||||
@ -558,7 +607,9 @@ public class BukkitGetBlocks_1_16_1 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);
|
||||||
@ -571,7 +622,9 @@ public class BukkitGetBlocks_1_16_1 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();
|
||||||
}
|
}
|
||||||
@ -721,7 +774,7 @@ public class BukkitGetBlocks_1_16_1 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,13 @@ import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
|
|||||||
import org.bukkit.craftbukkit.v1_16_R1.block.data.CraftBlockData;
|
import org.bukkit.craftbukkit.v1_16_R1.block.data.CraftBlockData;
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class FAWEWorldNativeAccess_1_16 implements WorldNativeAccess<Chunk, IBlockData, BlockPosition> {
|
public class FAWEWorldNativeAccess_1_16 implements WorldNativeAccess<Chunk, IBlockData, BlockPosition> {
|
||||||
private static final int UPDATE = 1, NOTIFY = 2;
|
private static final int UPDATE = 1;
|
||||||
|
private static final int NOTIFY = 2;
|
||||||
|
|
||||||
private final FAWE_Spigot_v1_16_R1 adapter;
|
private final FAWE_Spigot_v1_16_R1 adapter;
|
||||||
private final WeakReference<World> world;
|
private final WeakReference<World> world;
|
||||||
@ -171,4 +172,4 @@ public class FAWEWorldNativeAccess_1_16 implements WorldNativeAccess<Chunk, IBlo
|
|||||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException {
|
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException {
|
||||||
return this.adapter.setBlock(this.getChunk(position.getBlockX() >> 4, position.getBlockZ() >> 4).bukkitChunk, position.getBlockX(), position.getBlockY(), position.getBlockZ(), block, sideEffectSet.shouldApply(SideEffect.LIGHTING));
|
return this.adapter.setBlock(this.getChunk(position.getBlockX() >> 4, position.getBlockZ() >> 4).bukkitChunk, position.getBlockX(), position.getBlockY(), position.getBlockZ(), block, sideEffectSet.shouldApply(SideEffect.LIGHTING));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,14 @@ package com.boydti.fawe.bukkit.adapter.mc1_16_2;
|
|||||||
|
|
||||||
import com.sk89q.util.ReflectionUtil;
|
import com.sk89q.util.ReflectionUtil;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import net.minecraft.server.v1_16_R2.*;
|
import net.minecraft.server.v1_16_R2.Block;
|
||||||
|
import net.minecraft.server.v1_16_R2.BlockAccessAir;
|
||||||
|
import net.minecraft.server.v1_16_R2.BlockBase;
|
||||||
|
import net.minecraft.server.v1_16_R2.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_16_R2.EnumPistonReaction;
|
||||||
|
import net.minecraft.server.v1_16_R2.IBlockData;
|
||||||
|
import net.minecraft.server.v1_16_R2.ITileEntity;
|
||||||
|
import net.minecraft.server.v1_16_R2.Material;
|
||||||
import org.bukkit.craftbukkit.v1_16_R2.block.data.CraftBlockData;
|
import org.bukkit.craftbukkit.v1_16_R2.block.data.CraftBlockData;
|
||||||
|
|
||||||
public class BlockMaterial_1_16_2 implements BlockMaterial {
|
public class BlockMaterial_1_16_2 implements BlockMaterial {
|
||||||
|
@ -114,14 +114,15 @@ public final class BukkitAdapter_1_16_2 extends NMSAdapter {
|
|||||||
Unsafe unsafe = UnsafeUtils.getUNSAFE();
|
Unsafe unsafe = UnsafeUtils.getUNSAFE();
|
||||||
CHUNKSECTION_BASE = unsafe.arrayBaseOffset(ChunkSection[].class);
|
CHUNKSECTION_BASE = unsafe.arrayBaseOffset(ChunkSection[].class);
|
||||||
int scale = unsafe.arrayIndexScale(ChunkSection[].class);
|
int scale = unsafe.arrayIndexScale(ChunkSection[].class);
|
||||||
if ((scale & (scale - 1)) != 0)
|
if ((scale & (scale - 1)) != 0) {
|
||||||
throw new Error("data type scale not a power of two");
|
throw new Error("data type scale not a power of two");
|
||||||
|
}
|
||||||
CHUNKSECTION_SHIFT = 31 - Integer.numberOfLeadingZeros(scale);
|
CHUNKSECTION_SHIFT = 31 - Integer.numberOfLeadingZeros(scale);
|
||||||
|
|
||||||
Class clsShortArraySet;
|
Class<?> clsShortArraySet;
|
||||||
try { //paper
|
try { //paper
|
||||||
clsShortArraySet = Class.forName(new String(new char[]{'i', 't', '.', 'u', 'n', 'i', 'm', 'i', '.', 'd', 's', 'i', '.', 'f', 'a', 's', 't', 'u', 't', 'i', 'l', '.', 's', 'h', 'o', 'r', 't', 's', '.', 'S', 'h', 'o', 'r', 't', 'A', 'r', 'r', 'a', 'y', 'S', 'e', 't'}));
|
clsShortArraySet = Class.forName(new String(new char[]{'i', 't', '.', 'u', 'n', 'i', 'm', 'i', '.', 'd', 's', 'i', '.', 'f', 'a', 's', 't', 'u', 't', 'i', 'l', '.', 's', 'h', 'o', 'r', 't', 's', '.', 'S', 'h', 'o', 'r', 't', 'A', 'r', 'r', 'a', 'y', 'S', 'e', 't'}));
|
||||||
} catch (Throwable t) {// still using spigot boooo
|
} catch (Throwable t) { // still using spigot boo
|
||||||
clsShortArraySet = Class.forName(new String(new char[]{'o', 'r', 'g', '.', 'b', 'u', 'k', 'k', 'i', 't', '.', 'c', 'r', 'a', 'f', 't', 'b', 'u', 'k', 'k', 'i', 't', '.', 'l', 'i', 'b', 's', '.', 'i', 't', '.', 'u', 'n', 'i', 'm', 'i', '.', 'd', 's', 'i', '.', 'f', 'a', 's', 't', 'u', 't', 'i', 'l', '.', 's', 'h', 'o', 'r', 't', 's', '.', 'S', 'h', 'o', 'r', 't', 'A', 'r', 'r', 'a', 'y', 'S', 'e', 't'}));
|
clsShortArraySet = Class.forName(new String(new char[]{'o', 'r', 'g', '.', 'b', 'u', 'k', 'k', 'i', 't', '.', 'c', 'r', 'a', 'f', 't', 'b', 'u', 'k', 'k', 'i', 't', '.', 'l', 'i', 'b', 's', '.', 'i', 't', '.', 'u', 'n', 'i', 'm', 'i', '.', 'd', 's', 'i', '.', 'f', 'a', 's', 't', 'u', 't', 'i', 'l', '.', 's', 'h', 'o', 'r', 't', 's', '.', 'S', 'h', 'o', 'r', 't', 'A', 'r', 'r', 'a', 'y', 'S', 'e', 't'}));
|
||||||
}
|
}
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
@ -184,7 +185,7 @@ public final class BukkitAdapter_1_16_2 extends NMSAdapter {
|
|||||||
public static PlayerChunk getPlayerChunk(WorldServer nmsWorld, final int chunkX, final int chunkZ) {
|
public static PlayerChunk getPlayerChunk(WorldServer nmsWorld, final int chunkX, final int chunkZ) {
|
||||||
PlayerChunkMap chunkMap = nmsWorld.getChunkProvider().playerChunkMap;
|
PlayerChunkMap chunkMap = nmsWorld.getChunkProvider().playerChunkMap;
|
||||||
try {
|
try {
|
||||||
return (PlayerChunk)methodGetVisibleChunk.invoke(chunkMap, ChunkCoordIntPair.pair(chunkX, chunkZ));
|
return (PlayerChunk) methodGetVisibleChunk.invoke(chunkMap, ChunkCoordIntPair.pair(chunkX, chunkZ));
|
||||||
} catch (Throwable thr) {
|
} catch (Throwable thr) {
|
||||||
throw new RuntimeException(thr);
|
throw new RuntimeException(thr);
|
||||||
}
|
}
|
||||||
@ -207,7 +208,6 @@ public final class BukkitAdapter_1_16_2 extends NMSAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lighting) {
|
if (lighting) {
|
||||||
// ChunkCoordIntPair chunkCoordIntPair = new ChunkCoordIntPair(chunkX, chunkZ);
|
|
||||||
boolean trustEdges = true; //This needs to be true otherwise Minecraft will update lighting from/at the chunk edges (bad)
|
boolean trustEdges = true; //This needs to be true otherwise Minecraft will update lighting from/at the chunk edges (bad)
|
||||||
PacketPlayOutLightUpdate packet = new PacketPlayOutLightUpdate(chunkCoordIntPair, nmsWorld.getChunkProvider().getLightEngine(), trustEdges);
|
PacketPlayOutLightUpdate packet = new PacketPlayOutLightUpdate(chunkCoordIntPair, nmsWorld.getChunkProvider().getLightEngine(), trustEdges);
|
||||||
playerChunk.players.a(chunkCoordIntPair, false).forEach(p -> {
|
playerChunk.players.a(chunkCoordIntPair, false).forEach(p -> {
|
||||||
@ -258,7 +258,9 @@ public final class BukkitAdapter_1_16_2 extends NMSAdapter {
|
|||||||
final int blockBitArrayEnd = MathMan.ceilZero((float) 4096 / blocksPerLong);
|
final int blockBitArrayEnd = MathMan.ceilZero((float) 4096 / blocksPerLong);
|
||||||
|
|
||||||
if (num_palette == 1) {
|
if (num_palette == 1) {
|
||||||
for (int i = 0; i < blockBitArrayEnd; i++) blockStates[i] = 0;
|
for (int i = 0; i < blockBitArrayEnd; i++) {
|
||||||
|
blockStates[i] = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final BitArrayUnstretched bitArray = new BitArrayUnstretched(bitsPerEntry, 4096, blockStates);
|
final BitArrayUnstretched bitArray = new BitArrayUnstretched(bitsPerEntry, 4096, blockStates);
|
||||||
bitArray.fromRaw(blocksCopy);
|
bitArray.fromRaw(blocksCopy);
|
||||||
@ -272,7 +274,6 @@ public final class BukkitAdapter_1_16_2 extends NMSAdapter {
|
|||||||
final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd);
|
final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd);
|
||||||
final DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
final DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
||||||
final DataPalette<IBlockData> palette;
|
final DataPalette<IBlockData> palette;
|
||||||
// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
|
||||||
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::c);
|
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::c);
|
||||||
|
|
||||||
// set palette
|
// set palette
|
||||||
|
@ -15,8 +15,10 @@ import com.boydti.fawe.object.collection.AdaptedMap;
|
|||||||
import com.boydti.fawe.object.collection.BitArrayUnstretched;
|
import com.boydti.fawe.object.collection.BitArrayUnstretched;
|
||||||
import com.google.common.base.Suppliers;
|
import com.google.common.base.Suppliers;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.jnbt.ListTag;
|
||||||
|
import com.sk89q.jnbt.StringTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.jnbt.*;
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||||
@ -25,7 +27,29 @@ 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 net.minecraft.server.v1_16_R2.*;
|
import net.minecraft.server.v1_16_R2.BiomeBase;
|
||||||
|
import net.minecraft.server.v1_16_R2.BiomeStorage;
|
||||||
|
import net.minecraft.server.v1_16_R2.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_16_R2.Chunk;
|
||||||
|
import net.minecraft.server.v1_16_R2.ChunkSection;
|
||||||
|
import net.minecraft.server.v1_16_R2.DataBits;
|
||||||
|
import net.minecraft.server.v1_16_R2.DataPalette;
|
||||||
|
import net.minecraft.server.v1_16_R2.DataPaletteBlock;
|
||||||
|
import net.minecraft.server.v1_16_R2.DataPaletteHash;
|
||||||
|
import net.minecraft.server.v1_16_R2.DataPaletteLinear;
|
||||||
|
import net.minecraft.server.v1_16_R2.Entity;
|
||||||
|
import net.minecraft.server.v1_16_R2.EntityTypes;
|
||||||
|
import net.minecraft.server.v1_16_R2.EnumSkyBlock;
|
||||||
|
import net.minecraft.server.v1_16_R2.HeightMap;
|
||||||
|
import net.minecraft.server.v1_16_R2.IBlockData;
|
||||||
|
import net.minecraft.server.v1_16_R2.IRegistry;
|
||||||
|
import net.minecraft.server.v1_16_R2.LightEngine;
|
||||||
|
import net.minecraft.server.v1_16_R2.NBTTagCompound;
|
||||||
|
import net.minecraft.server.v1_16_R2.NBTTagInt;
|
||||||
|
import net.minecraft.server.v1_16_R2.NibbleArray;
|
||||||
|
import net.minecraft.server.v1_16_R2.SectionPosition;
|
||||||
|
import net.minecraft.server.v1_16_R2.TileEntity;
|
||||||
|
import net.minecraft.server.v1_16_R2.WorldServer;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
||||||
@ -35,11 +59,20 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import java.util.AbstractSet;
|
||||||
import java.util.*;
|
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.Callable;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
@ -48,24 +81,29 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
|||||||
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_16_2.class);
|
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_16_2.class);
|
||||||
|
|
||||||
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_16_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
private static final Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_16_2(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
|
||||||
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];
|
||||||
private boolean createCopy = false;
|
private boolean createCopy = false;
|
||||||
private BukkitGetBlocks_1_16_2_Copy copy = null;
|
private BukkitGetBlocks_1_16_2_Copy copy = null;
|
||||||
|
|
||||||
public BukkitGetBlocks_1_16_2(World world, int X, int Z) {
|
public BukkitGetBlocks_1_16_2(World world, int chunkX, int chunkZ) {
|
||||||
this(((CraftWorld) world).getHandle(), X, Z);
|
this(((CraftWorld) world).getHandle(), chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BukkitGetBlocks_1_16_2(WorldServer world, int X, int Z) {
|
public BukkitGetBlocks_1_16_2(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 getChunkX() {
|
||||||
|
return chunkX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -83,12 +121,8 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getX() {
|
public int getChunkZ() {
|
||||||
return X;
|
return chunkZ;
|
||||||
}
|
|
||||||
|
|
||||||
public int getZ() {
|
|
||||||
return Z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,7 +132,9 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
|||||||
if (y == -1) {
|
if (y == -1) {
|
||||||
for (y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
|
for (y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) {
|
||||||
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
||||||
if (base != null) break;
|
if (base != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
base = index.getBiome(x >> 2, y >> 2, z >> 2);
|
||||||
@ -108,7 +144,9 @@ public class BukkitGetBlocks_1_16_2 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;
|
||||||
}
|
}
|
||||||
@ -196,7 +234,9 @@ public class BukkitGetBlocks_1_16_2 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();
|
||||||
@ -273,16 +313,16 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
|||||||
entity.die();
|
entity.die();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk ensureLoaded(net.minecraft.server.v1_16_R2.World nmsWorld, int X, int Z) {
|
public Chunk ensureLoaded(net.minecraft.server.v1_16_R2.World nmsWorld, int chunkX, int chunkZ) {
|
||||||
return BukkitAdapter_1_16_2.ensureLoaded(nmsWorld, X, Z);
|
return BukkitAdapter_1_16_2.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) {
|
||||||
copy = createCopy ? new BukkitGetBlocks_1_16_2_Copy(world, getX(), getZ()) : null;
|
copy = createCopy ? new BukkitGetBlocks_1_16_2_Copy(world, getChunkX(), getChunkZ()) : null;
|
||||||
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
|
||||||
@ -317,7 +357,7 @@ public class BukkitGetBlocks_1_16_2 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)){
|
if (!set.hasSection(layer)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (createCopy) {
|
if (createCopy) {
|
||||||
@ -337,7 +377,8 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
|||||||
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -366,7 +407,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
|||||||
.newChunkSection(layer, this::load, setArr, fastmode);
|
.newChunkSection(layer, this::load, setArr, fastmode);
|
||||||
if (!BukkitAdapter_1_16_2
|
if (!BukkitAdapter_1_16_2
|
||||||
.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
||||||
log.error("Failed to set chunk section:" + X + "," + Z + " layer: " + 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);
|
||||||
@ -429,12 +470,14 @@ public class BukkitGetBlocks_1_16_2 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();
|
||||||
@ -459,7 +502,9 @@ public class BukkitGetBlocks_1_16_2 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) {
|
||||||
@ -501,7 +546,9 @@ public class BukkitGetBlocks_1_16_2 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()) {
|
||||||
@ -543,8 +590,10 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
|||||||
nmsChunk.mustNotSave = false;
|
nmsChunk.mustNotSave = false;
|
||||||
nmsChunk.markDirty();
|
nmsChunk.markDirty();
|
||||||
// send to player
|
// send to player
|
||||||
BukkitAdapter_1_16_2.sendChunk(nmsWorld, X, Z, finalMask, finalLightUpdate);
|
BukkitAdapter_1_16_2.sendChunk(nmsWorld, chunkX, chunkZ, finalMask, finalLightUpdate);
|
||||||
if (finalizer != null) finalizer.run();
|
if (finalizer != null) {
|
||||||
|
finalizer.run();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (syncTasks != null) {
|
if (syncTasks != null) {
|
||||||
@ -561,7 +610,9 @@ public class BukkitGetBlocks_1_16_2 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);
|
||||||
@ -574,7 +625,9 @@ public class BukkitGetBlocks_1_16_2 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();
|
||||||
}
|
}
|
||||||
@ -724,7 +777,7 @@ public class BukkitGetBlocks_1_16_2 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,13 @@ import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
|||||||
import org.bukkit.craftbukkit.v1_16_R2.block.data.CraftBlockData;
|
import org.bukkit.craftbukkit.v1_16_R2.block.data.CraftBlockData;
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class FAWEWorldNativeAccess_1_16 implements WorldNativeAccess<Chunk, IBlockData, BlockPosition> {
|
public class FAWEWorldNativeAccess_1_16 implements WorldNativeAccess<Chunk, IBlockData, BlockPosition> {
|
||||||
private static final int UPDATE = 1, NOTIFY = 2;
|
private static final int UPDATE = 1;
|
||||||
|
private static final int NOTIFY = 2;
|
||||||
|
|
||||||
private final FAWE_Spigot_v1_16_R2 adapter;
|
private final FAWE_Spigot_v1_16_R2 adapter;
|
||||||
private final WeakReference<World> world;
|
private final WeakReference<World> world;
|
||||||
@ -171,4 +172,4 @@ public class FAWEWorldNativeAccess_1_16 implements WorldNativeAccess<Chunk, IBlo
|
|||||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException {
|
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException {
|
||||||
return this.adapter.setBlock(this.getChunk(position.getBlockX() >> 4, position.getBlockZ() >> 4).bukkitChunk, position.getBlockX(), position.getBlockY(), position.getBlockZ(), block, sideEffectSet.shouldApply(SideEffect.LIGHTING));
|
return this.adapter.setBlock(this.getChunk(position.getBlockX() >> 4, position.getBlockZ() >> 4).bukkitChunk, position.getBlockX(), position.getBlockY(), position.getBlockZ(), block, sideEffectSet.shouldApply(SideEffect.LIGHTING));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package com.boydti.fawe.bukkit.filter;
|
package com.boydti.fawe.bukkit.filter;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
@ -14,6 +11,9 @@ import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
|||||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
public class WorldGuardFilter extends CuboidRegionFilter {
|
public class WorldGuardFilter extends CuboidRegionFilter {
|
||||||
private final World world;
|
private final World world;
|
||||||
private boolean large;
|
private boolean large;
|
||||||
@ -23,6 +23,7 @@ public class WorldGuardFilter extends CuboidRegionFilter {
|
|||||||
checkNotNull(world);
|
checkNotNull(world);
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calculateRegions() {
|
public void calculateRegions() {
|
||||||
Fawe.get().getQueueHandler().sync(() -> {
|
Fawe.get().getQueueHandler().sync(() -> {
|
||||||
@ -43,7 +44,9 @@ public class WorldGuardFilter extends CuboidRegionFilter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsChunk(int chunkX, int chunkZ) {
|
public boolean containsChunk(int chunkX, int chunkZ) {
|
||||||
if (!large) return super.containsChunk(chunkX, chunkZ);
|
if (!large) {
|
||||||
|
return super.containsChunk(chunkX, chunkZ);
|
||||||
|
}
|
||||||
BlockVector3 pos1 = BlockVector3.at(chunkX << 4, 0, chunkZ << 4);
|
BlockVector3 pos1 = BlockVector3.at(chunkX << 4, 0, chunkZ << 4);
|
||||||
BlockVector3 pos2 = BlockVector3.at(pos1.getBlockX() + 15, 255, pos1.getBlockZ() + 15);
|
BlockVector3 pos2 = BlockVector3.at(pos1.getBlockX() + 15, 255, pos1.getBlockZ() + 15);
|
||||||
ProtectedCuboidRegion chunkRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
|
ProtectedCuboidRegion chunkRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
|
||||||
@ -53,7 +56,9 @@ public class WorldGuardFilter extends CuboidRegionFilter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean containsRegion(int mcaX, int mcaZ) {
|
public boolean containsRegion(int mcaX, int mcaZ) {
|
||||||
if (!large) return super.containsRegion(mcaX, mcaZ);
|
if (!large) {
|
||||||
|
return super.containsRegion(mcaX, mcaZ);
|
||||||
|
}
|
||||||
BlockVector3 pos1 = BlockVector3.at(mcaX << 9, 0, mcaZ << 9);
|
BlockVector3 pos1 = BlockVector3.at(mcaX << 9, 0, mcaZ << 9);
|
||||||
BlockVector3 pos2 = BlockVector3.at(pos1.getBlockX() + 511, 255, pos1.getBlockZ() + 511);
|
BlockVector3 pos2 = BlockVector3.at(pos1.getBlockX() + 511, 255, pos1.getBlockZ() + 511);
|
||||||
ProtectedCuboidRegion regionRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
|
ProtectedCuboidRegion regionRegion = new ProtectedCuboidRegion("unimportant", pos1, pos2);
|
||||||
|
@ -1,39 +1,17 @@
|
|||||||
package com.boydti.fawe.bukkit.listener;
|
package com.boydti.fawe.bukkit.listener;
|
||||||
|
|
||||||
import com.boydti.fawe.beta.IQueueExtent;
|
|
||||||
import com.boydti.fawe.bukkit.util.image.BukkitImageViewer;
|
import com.boydti.fawe.bukkit.util.image.BukkitImageViewer;
|
||||||
import com.boydti.fawe.object.brush.BrushSettings;
|
|
||||||
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
|
import com.boydti.fawe.object.brush.visualization.cfi.HeightMapMCAGenerator;
|
||||||
import com.boydti.fawe.util.EditSessionBuilder;
|
|
||||||
import com.boydti.fawe.util.ExtentTraverser;
|
|
||||||
import com.boydti.fawe.util.TaskManager;
|
|
||||||
import com.boydti.fawe.util.image.ImageViewer;
|
import com.boydti.fawe.util.image.ImageViewer;
|
||||||
import com.sk89q.worldedit.EditSession;
|
|
||||||
import com.sk89q.worldedit.LocalSession;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
|
||||||
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 com.sk89q.worldedit.command.tool.BrushTool;
|
|
||||||
import com.sk89q.worldedit.command.tool.InvalidToolBindException;
|
|
||||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import java.util.ArrayDeque;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Rotation;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -41,13 +19,15 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BukkitImageListener implements Listener {
|
public class BukkitImageListener implements Listener {
|
||||||
|
|
||||||
private Location mutable = new Location(Bukkit.getWorlds().get(0), 0, 0, 0);
|
private Location mutable = new Location(Bukkit.getWorlds().get(0), 0, 0, 0);
|
||||||
@ -57,31 +37,32 @@ public class BukkitImageListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO Fix along with CFI code 2020-02-04
|
//TODO Fix along with CFI code 2020-02-04
|
||||||
// @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
/*
|
||||||
// public void onPlayerInteractEntity(AsyncPlayerChatEvent event) {
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
// Set<Player> recipients = event.getRecipients();
|
public void onPlayerInteractEntity(AsyncPlayerChatEvent event) {
|
||||||
// Iterator<Player> iter = recipients.iterator();
|
Set<Player> recipients = event.getRecipients();
|
||||||
// while (iter.hasNext()) {
|
Iterator<Player> iter = recipients.iterator();
|
||||||
// Player player = iter.next();
|
while (iter.hasNext()) {
|
||||||
// BukkitPlayer bukkitPlayer = BukkitAdapter.adapt(player);
|
Player player = iter.next();
|
||||||
// CFICommands.CFISettings settings = bukkitPlayer.getMeta("CFISettings");
|
BukkitPlayer bukkitPlayer = BukkitAdapter.adapt(player);
|
||||||
// if (player.equals(event.getPlayer()) || !bukkitPlayer.hasMeta() || settings == null || !settings.hasGenerator()) {
|
CFICommands.CFISettings settings = bukkitPlayer.getMeta("CFISettings");
|
||||||
// continue;
|
if (player.equals(event.getPlayer()) || !bukkitPlayer.hasMeta() || settings == null || !settings.hasGenerator()) {
|
||||||
// }
|
continue;
|
||||||
//
|
}
|
||||||
// String name = player.getName().toLowerCase();
|
|
||||||
// if (!event.getMessage().toLowerCase().contains(name)) {
|
String name = player.getName().toLowerCase(Locale.ROOT);
|
||||||
// ArrayDeque<String> buffered = bukkitPlayer.getMeta("CFIBufferedMessages");
|
if (!event.getMessage().toLowerCase(Locale.ROOT).contains(name)) {
|
||||||
// if (buffered == null) {
|
ArrayDeque<String> buffered = bukkitPlayer.getMeta("CFIBufferedMessages");
|
||||||
// bukkitPlayer.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<>());
|
if (buffered == null) {
|
||||||
// }
|
bukkitPlayer.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<>());
|
||||||
// String full = String.format(event.getFormat(), event.getPlayer().getDisplayName(),
|
}
|
||||||
// event.getMessage());
|
String full = String.format(event.getFormat(), event.getPlayer().getDisplayName(),
|
||||||
// buffered.add(full);
|
event.getMessage());
|
||||||
// iter.remove();
|
buffered.add(full);
|
||||||
// }
|
iter.remove();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
|
public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
|
||||||
@ -185,126 +166,127 @@ public class BukkitImageListener implements Listener {
|
|||||||
|
|
||||||
private void handleInteract(Event event, Player player, Entity entity, boolean primary) {
|
private void handleInteract(Event event, Player player, Entity entity, boolean primary) {
|
||||||
//todo fix with cfi code 2020-02-04
|
//todo fix with cfi code 2020-02-04
|
||||||
// if (!(entity instanceof ItemFrame)) {
|
/*
|
||||||
// return;
|
if (!(entity instanceof ItemFrame)) {
|
||||||
// }
|
return;
|
||||||
// ItemFrame itemFrame = (ItemFrame) entity;
|
}
|
||||||
//
|
ItemFrame itemFrame = (ItemFrame) entity;
|
||||||
// BukkitPlayer bukkitPlayer = BukkitAdapter.adapt(player);
|
|
||||||
// CFICommands.CFISettings settings = bukkitPlayer.getMeta("CFISettings");
|
BukkitPlayer bukkitPlayer = BukkitAdapter.adapt(player);
|
||||||
// HeightMapMCAGenerator generator = settings == null ? null : settings.getGenerator();
|
CFICommands.CFISettings settings = bukkitPlayer.getMeta("CFISettings");
|
||||||
// BukkitImageViewer viewer = get(generator);
|
HeightMapMCAGenerator generator = settings == null ? null : settings.getGenerator();
|
||||||
// if (viewer == null) {
|
BukkitImageViewer viewer = get(generator);
|
||||||
// return;
|
if (viewer == null) {
|
||||||
// }
|
return;
|
||||||
//
|
}
|
||||||
// if (itemFrame.getRotation() != Rotation.NONE) {
|
|
||||||
// itemFrame.setRotation(Rotation.NONE);
|
if (itemFrame.getRotation() != Rotation.NONE) {
|
||||||
// }
|
itemFrame.setRotation(Rotation.NONE);
|
||||||
//
|
}
|
||||||
// LocalSession session = bukkitPlayer.getSession();
|
|
||||||
// BrushTool tool;
|
LocalSession session = bukkitPlayer.getSession();
|
||||||
// try {
|
BrushTool tool;
|
||||||
// tool = session.getBrushTool(bukkitPlayer, false);
|
try {
|
||||||
// } catch (InvalidToolBindException e) {
|
tool = session.getBrushTool(bukkitPlayer, false);
|
||||||
// return;
|
} catch (InvalidToolBindException e) {
|
||||||
// }
|
return;
|
||||||
//
|
}
|
||||||
// ItemFrame[][] frames = viewer.getItemFrames();
|
|
||||||
// if (frames == null || tool == null) {
|
ItemFrame[][] frames = viewer.getItemFrames();
|
||||||
// viewer.selectFrame(itemFrame);
|
if (frames == null || tool == null) {
|
||||||
// player.updateInventory();
|
viewer.selectFrame(itemFrame);
|
||||||
// TaskManager.IMP.laterAsync(() -> viewer.view(generator), 1);
|
player.updateInventory();
|
||||||
// return;
|
TaskManager.IMP.laterAsync(() -> viewer.view(generator), 1);
|
||||||
// }
|
return;
|
||||||
//
|
}
|
||||||
// BrushSettings context = primary ? tool.getPrimary() : tool.getSecondary();
|
|
||||||
// Brush brush = context.getBrush();
|
BrushSettings context = primary ? tool.getPrimary() : tool.getSecondary();
|
||||||
// if (brush == null) {
|
Brush brush = context.getBrush();
|
||||||
// return;
|
if (brush == null) {
|
||||||
// }
|
return;
|
||||||
// tool.setContext(context);
|
}
|
||||||
//
|
tool.setContext(context);
|
||||||
// if (event instanceof Cancellable) {
|
|
||||||
// ((Cancellable) event).setCancelled(true);
|
if (event instanceof Cancellable) {
|
||||||
// }
|
((Cancellable) event).setCancelled(true);
|
||||||
//
|
}
|
||||||
// Location target = itemFrame.getLocation();
|
|
||||||
// Location source = player.getLocation();
|
Location target = itemFrame.getLocation();
|
||||||
//
|
Location source = player.getLocation();
|
||||||
// double yawRad = Math.toRadians(source.getYaw() + 90d);
|
|
||||||
// double pitchRad = Math.toRadians(-source.getPitch());
|
double yawRad = Math.toRadians(source.getYaw() + 90d);
|
||||||
//
|
double pitchRad = Math.toRadians(-source.getPitch());
|
||||||
// double a = Math.cos(pitchRad);
|
|
||||||
// double xRat = Math.cos(yawRad) * a;
|
double a = Math.cos(pitchRad);
|
||||||
// double zRat = Math.sin(yawRad) * a;
|
double xRat = Math.cos(yawRad) * a;
|
||||||
//
|
double zRat = Math.sin(yawRad) * a;
|
||||||
// BlockFace facing = itemFrame.getFacing();
|
|
||||||
// double thickness = 1 / 32D + 1 / 128D;
|
BlockFace facing = itemFrame.getFacing();
|
||||||
// double modX = facing.getModX();
|
double thickness = 1 / 32D + 1 / 128D;
|
||||||
// double modZ = facing.getModZ();
|
double modX = facing.getModX();
|
||||||
// double dx = source.getX() - target.getX() - modX * thickness;
|
double modZ = facing.getModZ();
|
||||||
// double dy = source.getY() + player.getEyeHeight() - target.getY();
|
double dx = source.getX() - target.getX() - modX * thickness;
|
||||||
// double dz = source.getZ() - target.getZ() - modZ * thickness;
|
double dy = source.getY() + player.getEyeHeight() - target.getY();
|
||||||
//
|
double dz = source.getZ() - target.getZ() - modZ * thickness;
|
||||||
// double offset;
|
|
||||||
// double localX;
|
double offset;
|
||||||
// if (modX != 0) {
|
double localX;
|
||||||
// offset = dx / xRat;
|
if (modX != 0) {
|
||||||
// localX = (-modX) * (dz - offset * zRat);
|
offset = dx / xRat;
|
||||||
// } else {
|
localX = (-modX) * (dz - offset * zRat);
|
||||||
// offset = dz / zRat;
|
} else {
|
||||||
// localX = (modZ) * (dx - offset * xRat);
|
offset = dz / zRat;
|
||||||
// }
|
localX = (modZ) * (dx - offset * xRat);
|
||||||
// double localY = dy - offset * Math.sin(pitchRad);
|
}
|
||||||
// int localPixelX = (int) ((localX + 0.5) * 128);
|
double localY = dy - offset * Math.sin(pitchRad);
|
||||||
// int localPixelY = (int) ((localY + 0.5) * 128);
|
int localPixelX = (int) ((localX + 0.5) * 128);
|
||||||
//
|
int localPixelY = (int) ((localY + 0.5) * 128);
|
||||||
// UUID uuid = itemFrame.getUniqueId();
|
|
||||||
// for (int blockX = 0; blockX < frames.length; blockX++) {
|
UUID uuid = itemFrame.getUniqueId();
|
||||||
// for (int blockY = 0; blockY < frames[0].length; blockY++) {
|
for (int blockX = 0; blockX < frames.length; blockX++) {
|
||||||
// if (uuid.equals(frames[blockX][blockY].getUniqueId())) {
|
for (int blockY = 0; blockY < frames[0].length; blockY++) {
|
||||||
// int pixelX = localPixelX + blockX * 128;
|
if (uuid.equals(frames[blockX][blockY].getUniqueId())) {
|
||||||
// int pixelY = (128 * frames[0].length) - (localPixelY + blockY * 128 + 1);
|
int pixelX = localPixelX + blockX * 128;
|
||||||
//
|
int pixelY = (128 * frames[0].length) - (localPixelY + blockY * 128 + 1);
|
||||||
// int width = generator.getWidth();
|
|
||||||
// int length = generator.getLength();
|
int width = generator.getWidth();
|
||||||
// int worldX = (int) (pixelX * width / (frames.length * 128d));
|
int length = generator.getLength();
|
||||||
// int worldZ = (int) (pixelY * length / (frames[0].length * 128d));
|
int worldX = (int) (pixelX * width / (frames.length * 128d));
|
||||||
//
|
int worldZ = (int) (pixelY * length / (frames[0].length * 128d));
|
||||||
// if (worldX < 0 || worldX > width || worldZ < 0 || worldZ > length) {
|
|
||||||
// return;
|
if (worldX < 0 || worldX > width || worldZ < 0 || worldZ > length) {
|
||||||
// }
|
return;
|
||||||
//
|
}
|
||||||
// bukkitPlayer.runAction(() -> {
|
|
||||||
// BlockVector3 wPos = BlockVector3.at(worldX, 0, worldZ);
|
bukkitPlayer.runAction(() -> {
|
||||||
// viewer.refresh();
|
BlockVector3 wPos = BlockVector3.at(worldX, 0, worldZ);
|
||||||
// int topY = generator
|
viewer.refresh();
|
||||||
// .getNearestSurfaceTerrainBlock(wPos.getBlockX(), wPos.getBlockZ(), 255,
|
int topY = generator
|
||||||
// 0, 255);
|
.getNearestSurfaceTerrainBlock(wPos.getBlockX(), wPos.getBlockZ(), 255,
|
||||||
// wPos = wPos.withY(topY);
|
0, 255);
|
||||||
//
|
wPos = wPos.withY(topY);
|
||||||
// EditSession es = new EditSessionBuilder(bukkitPlayer.getWorld()).player(bukkitPlayer)
|
|
||||||
// .combineStages(false).autoQueue(false).blockBag(null).limitUnlimited()
|
EditSession es = new EditSessionBuilder(bukkitPlayer.getWorld()).player(bukkitPlayer)
|
||||||
// .build();
|
.combineStages(false).autoQueue(false).blockBag(null).limitUnlimited()
|
||||||
// ExtentTraverser last = new ExtentTraverser(es.getExtent()).last();
|
.build();
|
||||||
// Extent extent = last.get();
|
ExtentTraverser last = new ExtentTraverser(es.getExtent()).last();
|
||||||
// if (extent instanceof IQueueExtent) {
|
Extent extent = last.get();
|
||||||
// last = last.previous();
|
if (extent instanceof IQueueExtent) {
|
||||||
// }
|
last = last.previous();
|
||||||
// last.setNext(generator);
|
}
|
||||||
// try {
|
last.setNext(generator);
|
||||||
// brush.build(es, wPos, context.getMaterial(), context.getSize());
|
try {
|
||||||
// } catch (WorldEditException e) {
|
brush.build(es, wPos, context.getMaterial(), context.getSize());
|
||||||
// e.printStackTrace();
|
} catch (WorldEditException e) {
|
||||||
// }
|
e.printStackTrace();
|
||||||
// es.flushQueue();
|
}
|
||||||
// viewer.view(generator);
|
es.flushQueue();
|
||||||
// }, true, true);
|
viewer.view(generator);
|
||||||
//
|
}, true, true);
|
||||||
// return;
|
|
||||||
// }
|
return;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,17 +22,10 @@ import com.sk89q.worldedit.event.platform.BlockInteractEvent;
|
|||||||
import com.sk89q.worldedit.event.platform.Interaction;
|
import com.sk89q.worldedit.event.platform.Interaction;
|
||||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.Vector3;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -40,13 +33,17 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CFIPacketListener handles packets for editing the VirtualWorld
|
* The CFIPacketListener handles packets for editing the {@link VirtualWorld}.
|
||||||
* The generator is a virtual world which only the creator can see
|
*
|
||||||
* - The virtual world is displayed inside the current world
|
* <p>
|
||||||
* - Block/Chunk/Movement packets need to be handled properly
|
* The virtual world will be displayed inside the current world. Block/Chunk/Movement packets
|
||||||
|
* need to be handled properly.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
public class CFIPacketListener implements Listener {
|
public class CFIPacketListener implements Listener {
|
||||||
|
|
||||||
@ -122,7 +119,9 @@ public class CFIPacketListener implements Listener {
|
|||||||
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.MAP_CHUNK) {
|
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.MAP_CHUNK) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
if (!event.isServerPacket() || FaweCache.IMP.CHUNK_FLAG.get().get()) return;
|
if (!event.isServerPacket() || FaweCache.IMP.CHUNK_FLAG.get().get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
VirtualWorld gen = getGenerator(event);
|
VirtualWorld gen = getGenerator(event);
|
||||||
if (gen != null) {
|
if (gen != null) {
|
||||||
BlockVector3 origin = gen.getOrigin().toBlockPoint();
|
BlockVector3 origin = gen.getOrigin().toBlockPoint();
|
||||||
@ -147,7 +146,9 @@ public class CFIPacketListener implements Listener {
|
|||||||
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.ENTITY_VELOCITY) {
|
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.ENTITY_VELOCITY) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
if (!event.isServerPacket()) return;
|
if (!event.isServerPacket()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Location pos = player.getLocation();
|
Location pos = player.getLocation();
|
||||||
@ -172,7 +173,9 @@ public class CFIPacketListener implements Listener {
|
|||||||
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.POSITION) {
|
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.POSITION) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
if (!event.isServerPacket()) return;
|
if (!event.isServerPacket()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Location pos = player.getLocation();
|
Location pos = player.getLocation();
|
||||||
@ -202,7 +205,9 @@ public class CFIPacketListener implements Listener {
|
|||||||
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.MULTI_BLOCK_CHANGE) {
|
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.MULTI_BLOCK_CHANGE) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
if (!event.isServerPacket()) return;
|
if (!event.isServerPacket()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VirtualWorld gen = getGenerator(event);
|
VirtualWorld gen = getGenerator(event);
|
||||||
if (gen != null) {
|
if (gen != null) {
|
||||||
@ -260,11 +265,13 @@ public class CFIPacketListener implements Listener {
|
|||||||
private VirtualWorld getGenerator(Player player) {
|
private VirtualWorld getGenerator(Player player) {
|
||||||
BukkitPlayer bukkitPlayer = BukkitAdapter.adapt(player);
|
BukkitPlayer bukkitPlayer = BukkitAdapter.adapt(player);
|
||||||
VirtualWorld vw = bukkitPlayer.getSession().getVirtualWorld();
|
VirtualWorld vw = bukkitPlayer.getSession().getVirtualWorld();
|
||||||
if (vw != null) return vw;
|
if (vw != null) {
|
||||||
|
return vw;
|
||||||
|
}
|
||||||
// CFICommands.CFISettings settings = bukkitPlayer.getMeta("CFISettings");
|
// CFICommands.CFISettings settings = bukkitPlayer.getMeta("CFISettings");
|
||||||
// if (settings != null && settings.hasGenerator() && settings.getGenerator().hasPacketViewer()) {
|
// if (settings != null && settings.hasGenerator() && settings.getGenerator().hasPacketViewer()) {
|
||||||
// return settings.getGenerator();
|
// return settings.getGenerator();
|
||||||
// }
|
// }
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +279,9 @@ public class CFIPacketListener implements Listener {
|
|||||||
PacketContainer packet = event.getPacket();
|
PacketContainer packet = event.getPacket();
|
||||||
StructureModifier<BlockPosition> position = packet.getBlockPositionModifier();
|
StructureModifier<BlockPosition> position = packet.getBlockPositionModifier();
|
||||||
BlockPosition loc = position.readSafely(0);
|
BlockPosition loc = position.readSafely(0);
|
||||||
if (loc == null) return null;
|
if (loc == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
BlockVector3 origin = generator.getOrigin().toBlockPoint();
|
BlockVector3 origin = generator.getOrigin().toBlockPoint();
|
||||||
return BlockVector3.at(loc.getX() - origin.getBlockX(), loc.getY() - origin.getBlockY(), loc.getZ() - origin.getBlockZ());
|
return BlockVector3.at(loc.getX() - origin.getBlockX(), loc.getY() - origin.getBlockY(), loc.getZ() - origin.getBlockZ());
|
||||||
}
|
}
|
||||||
@ -282,7 +291,9 @@ public class CFIPacketListener implements Listener {
|
|||||||
if (gen != null) {
|
if (gen != null) {
|
||||||
BlockVector3 pt = getRelPos(event, gen);
|
BlockVector3 pt = getRelPos(event, gen);
|
||||||
if (pt != null) {
|
if (pt != null) {
|
||||||
if (relative) pt = getRelative(event, pt);
|
if (relative) {
|
||||||
|
pt = getRelative(event, pt);
|
||||||
|
}
|
||||||
if (gen.contains(pt)) {
|
if (gen.contains(pt)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
task.run(event, gen, pt);
|
task.run(event, gen, pt);
|
||||||
@ -295,7 +306,9 @@ public class CFIPacketListener implements Listener {
|
|||||||
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, type) {
|
protocolmanager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, type) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketReceiving(final PacketEvent event) {
|
public void onPacketReceiving(final PacketEvent event) {
|
||||||
if (type.isClient() || event.isServerPacket()) handleBlockEvent(event, relative, task);
|
if (type.isClient() || event.isServerPacket()) {
|
||||||
|
handleBlockEvent(event, relative, task);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -309,7 +322,9 @@ public class CFIPacketListener implements Listener {
|
|||||||
PacketContainer packet = container.getPacket();
|
PacketContainer packet = container.getPacket();
|
||||||
StructureModifier<EnumWrappers.Direction> dirs = packet.getDirections();
|
StructureModifier<EnumWrappers.Direction> dirs = packet.getDirections();
|
||||||
EnumWrappers.Direction dir = dirs.readSafely(0);
|
EnumWrappers.Direction dir = dirs.readSafely(0);
|
||||||
if (dir == null) return pt;
|
if (dir == null) {
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
switch (dir.ordinal()) {
|
switch (dir.ordinal()) {
|
||||||
case 0: return pt.add(0, -1, 0);
|
case 0: return pt.add(0, -1, 0);
|
||||||
case 1: return pt.add(0, 1, 0);
|
case 1: return pt.add(0, 1, 0);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.bukkit.listener;
|
package com.boydti.fawe.bukkit.listener;
|
||||||
|
|
||||||
import static org.slf4j.LoggerFactory.getLogger;
|
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.bukkit.FaweBukkit;
|
import com.boydti.fawe.bukkit.FaweBukkit;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
@ -25,6 +23,7 @@ import org.bukkit.event.block.BlockCanBuildEvent;
|
|||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.block.BlockDispenseEvent;
|
import org.bukkit.event.block.BlockDispenseEvent;
|
||||||
import org.bukkit.event.block.BlockExpEvent;
|
import org.bukkit.event.block.BlockExpEvent;
|
||||||
|
import org.bukkit.event.block.BlockExplodeEvent;
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
import org.bukkit.event.block.BlockGrowEvent;
|
import org.bukkit.event.block.BlockGrowEvent;
|
||||||
@ -45,6 +44,8 @@ import org.bukkit.plugin.PluginManager;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
import static org.slf4j.LoggerFactory.getLogger;
|
||||||
|
|
||||||
public abstract class ChunkListener implements Listener {
|
public abstract class ChunkListener implements Listener {
|
||||||
|
|
||||||
private final Logger logger = getLogger(ChunkListener.class);
|
private final Logger logger = getLogger(ChunkListener.class);
|
||||||
@ -58,10 +59,6 @@ public abstract class ChunkListener implements Listener {
|
|||||||
PluginManager plm = Bukkit.getPluginManager();
|
PluginManager plm = Bukkit.getPluginManager();
|
||||||
Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin();
|
Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin();
|
||||||
plm.registerEvents(this, plugin);
|
plm.registerEvents(this, plugin);
|
||||||
try {
|
|
||||||
plm.registerEvents(new ChunkListener_8Plus(this), plugin);
|
|
||||||
} catch (Throwable ignore) {
|
|
||||||
}
|
|
||||||
TaskManager.IMP.repeat(() -> {
|
TaskManager.IMP.repeat(() -> {
|
||||||
Location tmpLoc = lastCancelPos;
|
Location tmpLoc = lastCancelPos;
|
||||||
if (tmpLoc != null) {
|
if (tmpLoc != null) {
|
||||||
@ -98,7 +95,8 @@ public abstract class ChunkListener implements Listener {
|
|||||||
|
|
||||||
protected final Long2ObjectOpenHashMap<Boolean> badChunks = new Long2ObjectOpenHashMap<>();
|
protected final Long2ObjectOpenHashMap<Boolean> badChunks = new Long2ObjectOpenHashMap<>();
|
||||||
private Long2ObjectOpenHashMap<int[]> counter = new Long2ObjectOpenHashMap<>();
|
private Long2ObjectOpenHashMap<int[]> counter = new Long2ObjectOpenHashMap<>();
|
||||||
private int lastX = Integer.MIN_VALUE, lastZ = Integer.MIN_VALUE;
|
private int lastX = Integer.MIN_VALUE;
|
||||||
|
private int lastZ = Integer.MIN_VALUE;
|
||||||
private int[] lastCount;
|
private int[] lastCount;
|
||||||
|
|
||||||
public int[] getCount(int cx, int cz) {
|
public int[] getCount(int cx, int cz) {
|
||||||
@ -138,6 +136,11 @@ public abstract class ChunkListener implements Listener {
|
|||||||
physCancel = false;
|
physCancel = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void event(BlockExplodeEvent event) {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void event(BlockBurnEvent event) {
|
public void event(BlockBurnEvent event) {
|
||||||
reset();
|
reset();
|
||||||
@ -250,14 +253,6 @@ public abstract class ChunkListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// switch (event.getChangedType()) {
|
|
||||||
// case AIR:
|
|
||||||
// case CAVE_AIR:
|
|
||||||
// case VOID_AIR:
|
|
||||||
// break;
|
|
||||||
// case REDSTONE_WIRE::
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
Exception e = new Exception();
|
Exception e = new Exception();
|
||||||
int depth = getDepth(e);
|
int depth = getDepth(e);
|
||||||
if (depth >= 256) {
|
if (depth >= 256) {
|
||||||
@ -354,9 +349,7 @@ public abstract class ChunkListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent FireWorks from loading chunks
|
* Prevent firework from loading chunks.
|
||||||
*
|
|
||||||
* @param event
|
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onChunkLoad(ChunkLoadEvent event) {
|
public void onChunkLoad(ChunkLoadEvent event) {
|
||||||
|
@ -9,12 +9,12 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
|
||||||
public class ChunkListener_9 extends ChunkListener {
|
public class ChunkListener9 extends ChunkListener {
|
||||||
|
|
||||||
private Exception exception;
|
private Exception exception;
|
||||||
private StackTraceElement[] elements;
|
private StackTraceElement[] elements;
|
||||||
|
|
||||||
public ChunkListener_9() {
|
public ChunkListener9() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,6 @@ public class ChunkListener_9 extends ChunkListener {
|
|||||||
cancelNearby(cx, cz);
|
cancelNearby(cx, cz);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
physCancel = true;
|
physCancel = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,4 +86,4 @@ public class ChunkListener_9 extends ChunkListener {
|
|||||||
StackTraceElement[] elems = getElements(ex);
|
StackTraceElement[] elems = getElements(ex);
|
||||||
return elems.length > i ? elems[i] : null;
|
return elems.length > i ? elems[i] : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,18 +0,0 @@
|
|||||||
package com.boydti.fawe.bukkit.listener;
|
|
||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockExplodeEvent;
|
|
||||||
|
|
||||||
public class ChunkListener_8Plus implements Listener{
|
|
||||||
private final ChunkListener listener;
|
|
||||||
|
|
||||||
public ChunkListener_8Plus(ChunkListener listener) {
|
|
||||||
this.listener = listener;
|
|
||||||
}
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
public void event(BlockExplodeEvent event) {
|
|
||||||
listener.reset();
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,10 +3,6 @@ package com.boydti.fawe.bukkit.listener;
|
|||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -19,6 +15,11 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class RenderListener implements Listener {
|
public class RenderListener implements Listener {
|
||||||
|
|
||||||
private final Map<UUID, int[]> views = new ConcurrentHashMap<>();
|
private final Map<UUID, int[]> views = new ConcurrentHashMap<>();
|
||||||
@ -32,7 +33,9 @@ public class RenderListener implements Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (views.isEmpty()) return;
|
if (views.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
int tps32 = (int) (Math.round(Fawe.get().getTimer().getTPS()) * 32);
|
int tps32 = (int) (Math.round(Fawe.get().getTimer().getTPS()) * 32);
|
||||||
@ -64,8 +67,9 @@ public class RenderListener implements Listener {
|
|||||||
setViewDistance(player, Math.max(4, value[0] + 1));
|
setViewDistance(player, Math.max(4, value[0] + 1));
|
||||||
long spent = System.currentTimeMillis() - now;
|
long spent = System.currentTimeMillis() - now;
|
||||||
if (spent > 5) {
|
if (spent > 5) {
|
||||||
if (spent > 10)
|
if (spent > 10) {
|
||||||
value[1] = nowTick + 20;
|
value[1] = nowTick + 20;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,9 @@ public class PluginPreloader extends PluginBase {
|
|||||||
loaded = region.getChunks();
|
loaded = region.getChunks();
|
||||||
Iterator<BlockVector2> iter = loaded.iterator();
|
Iterator<BlockVector2> iter = loaded.iterator();
|
||||||
|
|
||||||
if (!invalidator.get()) return;
|
if (!invalidator.get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Fawe.get().getQueueHandler().syncWhenFree(() -> {
|
Fawe.get().getQueueHandler().syncWhenFree(() -> {
|
||||||
for (; iter.hasNext() && invalidator.get();index++) {
|
for (; iter.hasNext() && invalidator.get();index++) {
|
||||||
BlockVector2 chunk = iter.next();
|
BlockVector2 chunk = iter.next();
|
||||||
@ -95,22 +97,26 @@ public class PluginPreloader extends PluginBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull File getDataFolder() {
|
@NotNull
|
||||||
|
public File getDataFolder() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull PluginDescriptionFile getDescription() {
|
@NotNull
|
||||||
|
public PluginDescriptionFile getDescription() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull FileConfiguration getConfig() {
|
@NotNull
|
||||||
|
public FileConfiguration getConfig() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable InputStream getResource(@NotNull String filename) {
|
@Nullable
|
||||||
|
public InputStream getResource(@NotNull String filename) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,12 +141,14 @@ public class PluginPreloader extends PluginBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull PluginLoader getPluginLoader() {
|
@NotNull
|
||||||
|
public PluginLoader getPluginLoader() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Server getServer() {
|
@NotNull
|
||||||
|
public Server getServer() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,12 +183,14 @@ public class PluginPreloader extends PluginBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, @Nullable String id) {
|
@Nullable
|
||||||
|
public ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, @Nullable String id) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Logger getLogger() {
|
@NotNull
|
||||||
|
public Logger getLogger() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +200,8 @@ public class PluginPreloader extends PluginBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
@Nullable
|
||||||
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import com.sk89q.worldedit.entity.Player;
|
|||||||
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.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import java.util.ArrayList;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.event.EventException;
|
import org.bukkit.event.EventException;
|
||||||
@ -17,6 +16,9 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.plugin.RegisteredListener;
|
import org.bukkit.plugin.RegisteredListener;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class FreeBuildRegion extends BukkitMaskManager {
|
public class FreeBuildRegion extends BukkitMaskManager {
|
||||||
private final ArrayList<RegisteredListener> listeners;
|
private final ArrayList<RegisteredListener> listeners;
|
||||||
|
|
||||||
@ -25,8 +27,12 @@ public class FreeBuildRegion extends BukkitMaskManager {
|
|||||||
this.listeners = new ArrayList<>();
|
this.listeners = new ArrayList<>();
|
||||||
RegisteredListener[] listeners = BlockBreakEvent.getHandlerList().getRegisteredListeners();
|
RegisteredListener[] listeners = BlockBreakEvent.getHandlerList().getRegisteredListeners();
|
||||||
for (RegisteredListener listener : listeners) {
|
for (RegisteredListener listener : listeners) {
|
||||||
if (listener.getPriority() == EventPriority.MONITOR) continue;
|
if (listener.getPriority() == EventPriority.MONITOR) {
|
||||||
if (!listener.isIgnoringCancelled()) continue;
|
continue;
|
||||||
|
}
|
||||||
|
if (!listener.isIgnoringCancelled()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.listeners.add(listener);
|
this.listeners.add(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,14 +44,20 @@ public class FreeBuildRegion extends BukkitMaskManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FaweMask getMask(Player player, MaskType type) {
|
public FaweMask getMask(Player player, MaskType type) {
|
||||||
if (type != MaskType.MEMBER) return null;
|
if (type != MaskType.MEMBER) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
ArrayList<RegisteredListener> currRegList = new ArrayList<>();
|
ArrayList<RegisteredListener> currRegList = new ArrayList<>();
|
||||||
for (RegisteredListener listener : this.listeners) {
|
for (RegisteredListener listener : this.listeners) {
|
||||||
String name = listener.getPlugin().getName();
|
String name = listener.getPlugin().getName();
|
||||||
if (!player.hasPermission("fawe.freebuild." + name.toLowerCase())) continue;
|
if (!player.hasPermission("fawe.freebuild." + name.toLowerCase(Locale.ROOT))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
currRegList.add(listener);
|
currRegList.add(listener);
|
||||||
}
|
}
|
||||||
if (currRegList.isEmpty()) return null;
|
if (currRegList.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
RegisteredListener[] listeners = currRegList.toArray(new RegisteredListener[0]);
|
RegisteredListener[] listeners = currRegList.toArray(new RegisteredListener[0]);
|
||||||
|
|
||||||
World bukkitWorld = BukkitAdapter.adapt(player.getWorld());
|
World bukkitWorld = BukkitAdapter.adapt(player.getWorld());
|
||||||
@ -73,12 +85,15 @@ public class FreeBuildRegion extends BukkitMaskManager {
|
|||||||
return contains(x, 127, z);
|
return contains(x, 127, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int lastX = Integer.MIN_VALUE, lastZ = Integer.MIN_VALUE;
|
private int lastX = Integer.MIN_VALUE;
|
||||||
|
private int lastZ = Integer.MIN_VALUE;
|
||||||
private boolean lastResult;
|
private boolean lastResult;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(int x, int y, int z) {
|
public boolean contains(int x, int y, int z) {
|
||||||
if (x == lastX && z == lastZ) return lastResult;
|
if (x == lastX && z == lastZ) {
|
||||||
|
return lastResult;
|
||||||
|
}
|
||||||
lastX = x;
|
lastX = x;
|
||||||
lastZ = z;
|
lastZ = z;
|
||||||
event.setCancelled(false);
|
event.setCancelled(false);
|
||||||
|
@ -43,7 +43,7 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
|
|||||||
final Location pos2 = area.getHighLoc();
|
final Location pos2 = area.getHighLoc();
|
||||||
final ClaimedResidence finalResidence = residence;
|
final ClaimedResidence finalResidence = residence;
|
||||||
return new FaweMask(new CuboidRegion(BukkitAdapter.asBlockVector(pos1), BukkitAdapter.asBlockVector(pos2))) {
|
return new FaweMask(new CuboidRegion(BukkitAdapter.asBlockVector(pos1), BukkitAdapter.asBlockVector(pos2))) {
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
|
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
|
||||||
return isAllowed(BukkitAdapter.adapt(player), finalResidence, type);
|
return isAllowed(BukkitAdapter.adapt(player), finalResidence, type);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
|||||||
if (block.getResident().equals(resident)) {
|
if (block.getResident().equals(resident)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (NotRegisteredException ignore) {}
|
} catch (NotRegisteredException ignored) {
|
||||||
|
}
|
||||||
Town town = block.getTown();
|
Town town = block.getTown();
|
||||||
if (town.isMayor(resident)) {
|
if (town.isMayor(resident)) {
|
||||||
return true;
|
return true;
|
||||||
@ -54,7 +55,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (NotRegisteredException ignore) {}
|
} catch (NotRegisteredException ignored) {
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +89,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class Worldguard extends BukkitMaskManager implements Listener {
|
public class Worldguard extends BukkitMaskManager implements Listener {
|
||||||
private final WorldGuardPlugin worldguard;
|
private final WorldGuardPlugin worldguard;
|
||||||
|
|
||||||
@ -63,7 +65,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
|||||||
}
|
}
|
||||||
final ApplicableRegionSet regions = manager.getApplicableRegions(BlockVector3.at(location.getX(), location.getY(), location.getZ()));
|
final ApplicableRegionSet regions = manager.getApplicableRegions(BlockVector3.at(location.getX(), location.getY(), location.getZ()));
|
||||||
//Merge WorldGuardFlag
|
//Merge WorldGuardFlag
|
||||||
if(player.hasPermission("fawe.worldguardflag") && !regions.testState(player, Flags.BUILD, Flags.BLOCK_PLACE, Flags.BLOCK_BREAK)){
|
if (player.hasPermission("fawe.worldguardflag") && !regions.testState(player, Flags.BUILD, Flags.BLOCK_PLACE, Flags.BLOCK_BREAK)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (ProtectedRegion region : regions) {
|
for (ProtectedRegion region : regions) {
|
||||||
@ -78,9 +80,9 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
|||||||
//Check if player is the owner of the region, the region's ID contains the player's name (why?), or if the region's owners contains "*".
|
//Check if player is the owner of the region, the region's ID contains the player's name (why?), or if the region's owners contains "*".
|
||||||
if (region.isOwner(localplayer) || region.isOwner(localplayer.getName())) {
|
if (region.isOwner(localplayer) || region.isOwner(localplayer.getName())) {
|
||||||
return true;
|
return true;
|
||||||
} else if (region.getId().toLowerCase().equals(localplayer.getName().toLowerCase())) {
|
} else if (region.getId().toLowerCase(Locale.ROOT).equals(localplayer.getName().toLowerCase(Locale.ROOT))) {
|
||||||
return true;
|
return true;
|
||||||
} else if (region.getId().toLowerCase().contains(localplayer.getName().toLowerCase() + "//")) {
|
} else if (region.getId().toLowerCase(Locale.ROOT).contains(localplayer.getName().toLowerCase(Locale.ROOT) + "//")) {
|
||||||
return true;
|
return true;
|
||||||
} else if (region.isOwner("*")) {
|
} else if (region.isOwner("*")) {
|
||||||
return true;
|
return true;
|
||||||
@ -90,8 +92,9 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
|||||||
if (localplayer.hasPermission("fawe.worldguard.member")) {
|
if (localplayer.hasPermission("fawe.worldguard.member")) {
|
||||||
if (region.isMember(localplayer) || region.isMember(localplayer.getName())) {
|
if (region.isMember(localplayer) || region.isMember(localplayer.getName())) {
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else {
|
||||||
return region.isMember("*");
|
return region.isMember("*");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -122,8 +125,7 @@ public class Worldguard extends BukkitMaskManager implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
return new FaweMask(new CuboidRegion(pos1, pos2)) {
|
||||||
|
@Override
|
||||||
@Override
|
|
||||||
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
|
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
|
||||||
return isAllowed(worldguard.wrapPlayer(BukkitAdapter.adapt(player)), myregion);
|
return isAllowed(worldguard.wrapPlayer(BukkitAdapter.adapt(player)), myregion);
|
||||||
}
|
}
|
||||||
|
@ -136,8 +136,8 @@ public class FaweRegionManager extends RegionManager {
|
|||||||
clipboard.setBlocks(fillingRegion, filling);
|
clipboard.setBlocks(fillingRegion, filling);
|
||||||
clipboard.setBlocks(floorRegion, plotfloor);
|
clipboard.setBlocks(floorRegion, plotfloor);
|
||||||
clipboard.setBlocks(airRegion, air);
|
clipboard.setBlocks(airRegion, air);
|
||||||
for (int x = pos1.getX(); x <= pos2.getX(); x ++) {
|
for (int x = pos1.getX(); x <= pos2.getX(); x++) {
|
||||||
for (int z = pos1.getZ(); z <= pos2.getZ(); z ++) {
|
for (int z = pos1.getZ(); z <= pos2.getZ(); z++) {
|
||||||
clipboard.setBiome(BlockVector2.at(x, z), biome);
|
clipboard.setBiome(BlockVector2.at(x, z), biome);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ public class FaweRegionManager extends RegionManager {
|
|||||||
//todo because of the following code this should proably be in the Bukkit module
|
//todo because of the following code this should proably be in the Bukkit module
|
||||||
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
|
World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorld()));
|
||||||
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
|
World pos3World = BukkitAdapter.adapt(getWorld(pos3.getWorld()));
|
||||||
WorldEdit.getInstance().getEditSessionFactory().getEditSession(pos1World,-1);
|
WorldEdit.getInstance().getEditSessionFactory().getEditSession(pos1World, -1);
|
||||||
EditSession sessionA = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
EditSession sessionA = new EditSessionBuilder(pos1World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
||||||
EditSession sessionB = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
EditSession sessionB = new EditSessionBuilder(pos3World).checkMemory(false).fastmode(true).limitUnlimited().changeSetNull().autoQueue(false).build();
|
||||||
CuboidRegion regionA = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
|
CuboidRegion regionA = new CuboidRegion(BlockVector3.at(pos1.getX(), pos1.getY(), pos1.getZ()), BlockVector3.at(pos2.getX(), pos2.getY(), pos2.getZ()));
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.bukkit.regions.plotsquared;
|
package com.boydti.fawe.bukkit.regions.plotsquared;
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getWorld;
|
|
||||||
|
|
||||||
import com.boydti.fawe.FaweAPI;
|
import com.boydti.fawe.FaweAPI;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
||||||
@ -29,6 +27,8 @@ import com.sk89q.worldedit.extent.clipboard.io.FastSchematicWriter;
|
|||||||
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 net.jpountz.lz4.LZ4BlockInputStream;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -39,7 +39,8 @@ import java.net.URL;
|
|||||||
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 net.jpountz.lz4.LZ4BlockInputStream;
|
|
||||||
|
import static org.bukkit.Bukkit.getWorld;
|
||||||
|
|
||||||
public class FaweSchematicHandler extends SchematicHandler {
|
public class FaweSchematicHandler extends SchematicHandler {
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,7 +62,7 @@ public class MoveTo512 /*extends Command*/ {
|
|||||||
// if (yMax != 15) {
|
// if (yMax != 15) {
|
||||||
// Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
|
// Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
|
||||||
// }
|
// }
|
||||||
// } else if (layer == 0){
|
// } else if (layer == 0) {
|
||||||
// Arrays.fill(ids, 256, 4096, (byte) 3);
|
// Arrays.fill(ids, 256, 4096, (byte) 3);
|
||||||
// Arrays.fill(ids, 0, 256, (byte) 7);
|
// Arrays.fill(ids, 0, 256, (byte) 7);
|
||||||
// } else {
|
// } else {
|
||||||
@ -113,7 +113,7 @@ public class MoveTo512 /*extends Command*/ {
|
|||||||
// int yMax158 = yMax15 << 8;
|
// int yMax158 = yMax15 << 8;
|
||||||
// Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
|
// Arrays.fill(ids, yMax158 + 256, 4096, (byte) 0);
|
||||||
// }
|
// }
|
||||||
// } else if (layer == 0){
|
// } else if (layer == 0) {
|
||||||
// Arrays.fill(ids, 256, 4096, (byte) hpw.ROAD_BLOCK.id);
|
// Arrays.fill(ids, 256, 4096, (byte) hpw.ROAD_BLOCK.id);
|
||||||
// Arrays.fill(ids, 0, 256, (byte) 7);
|
// Arrays.fill(ids, 0, 256, (byte) 7);
|
||||||
// } else {
|
// } else {
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
package com.boydti.fawe.bukkit.regions.plotsquared;
|
package com.boydti.fawe.bukkit.regions.plotsquared;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class PlotRegionFilter extends CuboidRegionFilter {
|
public class PlotRegionFilter extends CuboidRegionFilter {
|
||||||
private final PlotArea area;
|
private final PlotArea area;
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ public class PlotRegionFilter extends CuboidRegionFilter {
|
|||||||
checkNotNull(area);
|
checkNotNull(area);
|
||||||
this.area = area;
|
this.area = area;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calculateRegions() {
|
public void calculateRegions() {
|
||||||
ArrayList<Plot> plots = new ArrayList<>(area.getPlots());
|
ArrayList<Plot> plots = new ArrayList<>(area.getPlots());
|
||||||
|
@ -24,11 +24,12 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||||
import com.sk89q.worldedit.world.biome.Biomes;
|
import com.sk89q.worldedit.world.biome.Biomes;
|
||||||
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "generatebiome",
|
command = "generatebiome",
|
||||||
|
@ -23,13 +23,15 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionIntersection;
|
import com.sk89q.worldedit.regions.RegionIntersection;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class PlotSquaredFeature extends FaweMaskManager {
|
public class PlotSquaredFeature extends FaweMaskManager {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(PlotSquaredFeature.class);
|
private static final Logger log = LoggerFactory.getLogger(PlotSquaredFeature.class);
|
||||||
@ -46,15 +48,15 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
log.debug("Please update PlotSquared: https://www.spigotmc.org/resources/plotsquared-v5.77506/");
|
log.debug("Please update PlotSquared: https://www.spigotmc.org/resources/plotsquared-v5.77506/");
|
||||||
}
|
}
|
||||||
if (Settings.PLATFORM.toLowerCase().startsWith("bukkit")) {
|
if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) {
|
||||||
new FaweTrim();
|
new FaweTrim();
|
||||||
}
|
}
|
||||||
if (MainCommand.getInstance().getCommand("generatebiome") == null) {
|
if (MainCommand.getInstance().getCommand("generatebiome") == null) {
|
||||||
new PlotSetBiome();
|
new PlotSetBiome();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: revisit this later on
|
// TODO: revisit this later on
|
||||||
/*
|
/*
|
||||||
try {
|
try {
|
||||||
if (Settings.Enabled_Components.WORLDS) {
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
new ReplaceAll();
|
new ReplaceAll();
|
||||||
@ -62,7 +64,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.debug("You need to update PlotSquared to access the CFI and REPLACEALL commands");
|
log.debug("You need to update PlotSquared to access the CFI and REPLACEALL commands");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getName(UUID uuid) {
|
public static String getName(UUID uuid) {
|
||||||
@ -93,12 +95,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
UUID uid = player.getUniqueId();
|
UUID uid = player.getUniqueId();
|
||||||
return !plot.getFlag(NoWorldeditFlag.class) && (plot.isOwner(uid)
|
return !plot.getFlag(NoWorldeditFlag.class) && (plot.isOwner(uid) || type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot
|
||||||
|| type == MaskType.MEMBER && (plot.getTrusted().contains(uid) || plot.getTrusted()
|
.getTrusted().contains(DBFunc.EVERYONE) || (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) && player
|
||||||
.contains(DBFunc.EVERYONE)
|
.hasPermission("fawe.plotsquared.member")) || player.hasPermission("fawe.plotsquared.admin"));
|
||||||
|| (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE))
|
|
||||||
&& player.hasPermission("fawe.plotsquared.member")) || player
|
|
||||||
.hasPermission("fawe.plotsquared.admin"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -111,7 +110,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
Plot plot = pp.getCurrentPlot();
|
Plot plot = pp.getCurrentPlot();
|
||||||
if (isAllowed(player, plot, type)) {
|
if (isAllowed(player, plot, type)) {
|
||||||
regions = plot.getRegions();
|
regions = plot.getRegions();
|
||||||
} else {
|
} else {
|
||||||
plot = null;
|
plot = null;
|
||||||
regions = WEManager.getMask(pp);
|
regions = WEManager.getMask(pp);
|
||||||
if (regions.size() == 1) {
|
if (regions.size() == 1) {
|
||||||
@ -141,7 +140,10 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
maskedRegion = new CuboidRegion(pos1, pos2);
|
maskedRegion = new CuboidRegion(pos1, pos2);
|
||||||
} else {
|
} else {
|
||||||
World world = FaweAPI.getWorld(area.getWorldName());
|
World world = FaweAPI.getWorld(area.getWorldName());
|
||||||
maskedRegion = new RegionIntersection(world, new ArrayList<>(regions));
|
List<Region> weRegions = regions.stream().map(
|
||||||
|
r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()),
|
||||||
|
BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ()))).collect(Collectors.toList());
|
||||||
|
maskedRegion = new RegionIntersection(world, weRegions);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new FaweMask(maskedRegion) {
|
return new FaweMask(maskedRegion) {
|
||||||
@ -158,7 +160,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
@Override
|
@Override
|
||||||
public RegionFilter getFilter(String world) {
|
public RegionFilter getFilter(String world) {
|
||||||
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
||||||
if (area != null) return new PlotRegionFilter(area);
|
if (area != null) {
|
||||||
|
return new PlotRegionFilter(area);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.bukkit.regions.plotsquaredv4;
|
package com.boydti.fawe.bukkit.regions.plotsquaredv4;
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getWorld;
|
|
||||||
|
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.util.EditSessionBuilder;
|
import com.boydti.fawe.util.EditSessionBuilder;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
@ -18,8 +16,11 @@ import com.sk89q.worldedit.math.BlockVector2;
|
|||||||
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.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.getWorld;
|
||||||
|
|
||||||
public class FaweChunkManager extends ChunkManager {
|
public class FaweChunkManager extends ChunkManager {
|
||||||
|
|
||||||
private ChunkManager parent;
|
private ChunkManager parent;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.boydti.fawe.bukkit.regions.plotsquaredv4;
|
package com.boydti.fawe.bukkit.regions.plotsquaredv4;
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getWorld;
|
|
||||||
|
|
||||||
import com.boydti.fawe.FaweAPI;
|
import com.boydti.fawe.FaweAPI;
|
||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
import com.boydti.fawe.object.clipboard.ReadOnlyClipboard;
|
||||||
@ -29,6 +27,8 @@ import com.sk89q.worldedit.extent.clipboard.io.FastSchematicWriter;
|
|||||||
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 net.jpountz.lz4.LZ4BlockInputStream;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -39,7 +39,8 @@ import java.net.URL;
|
|||||||
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 net.jpountz.lz4.LZ4BlockInputStream;
|
|
||||||
|
import static org.bukkit.Bukkit.getWorld;
|
||||||
|
|
||||||
public class FaweSchematicHandler extends SchematicHandler {
|
public class FaweSchematicHandler extends SchematicHandler {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
package com.boydti.fawe.bukkit.regions.plotsquaredv4;
|
package com.boydti.fawe.bukkit.regions.plotsquaredv4;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
import com.boydti.fawe.regions.general.CuboidRegionFilter;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class PlotRegionFilter extends CuboidRegionFilter {
|
public class PlotRegionFilter extends CuboidRegionFilter {
|
||||||
private final PlotArea area;
|
private final PlotArea area;
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ public class PlotRegionFilter extends CuboidRegionFilter {
|
|||||||
checkNotNull(area);
|
checkNotNull(area);
|
||||||
this.area = area;
|
this.area = area;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calculateRegions() {
|
public void calculateRegions() {
|
||||||
ArrayList<Plot> plots = new ArrayList<>(area.getPlots());
|
ArrayList<Plot> plots = new ArrayList<>(area.getPlots());
|
||||||
|
@ -10,7 +10,6 @@ import com.github.intellectualsites.plotsquared.plot.commands.MainCommand;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
||||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridPlotManager;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.listener.WEManager;
|
import com.github.intellectualsites.plotsquared.plot.listener.WEManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
@ -18,21 +17,21 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.GlobalBlockQueue;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
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.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionIntersection;
|
import com.sk89q.worldedit.regions.RegionIntersection;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class PlotSquaredFeature extends FaweMaskManager {
|
public class PlotSquaredFeature extends FaweMaskManager {
|
||||||
|
|
||||||
@ -48,17 +47,17 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
setupSchematicHandler();
|
setupSchematicHandler();
|
||||||
setupChunkManager();
|
setupChunkManager();
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
log.debug("Please update PlotSquared: http://ci.athion.net/job/PlotSquared/");
|
log.debug("Please update PlotSquared: https://www.spigotmc.org/resources/77506/");
|
||||||
}
|
}
|
||||||
if (Settings.PLATFORM.toLowerCase().startsWith("bukkit")) {
|
if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) {
|
||||||
new FaweTrim();
|
new FaweTrim();
|
||||||
}
|
}
|
||||||
if (MainCommand.getInstance().getCommand("generatebiome") == null) {
|
if (MainCommand.getInstance().getCommand("generatebiome") == null) {
|
||||||
new PlotSetBiome();
|
new PlotSetBiome();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: revisit this later on
|
// TODO: revisit this later on
|
||||||
/*
|
/*
|
||||||
try {
|
try {
|
||||||
if (Settings.Enabled_Components.WORLDS) {
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
new ReplaceAll();
|
new ReplaceAll();
|
||||||
@ -66,7 +65,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.debug("You need to update PlotSquared to access the CFI and REPLACEALL commands");
|
log.debug("You need to update PlotSquared to access the CFI and REPLACEALL commands");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getName(UUID uuid) {
|
public static String getName(UUID uuid) {
|
||||||
@ -115,7 +114,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
Plot plot = pp.getCurrentPlot();
|
Plot plot = pp.getCurrentPlot();
|
||||||
if (isAllowed(player, plot, type)) {
|
if (isAllowed(player, plot, type)) {
|
||||||
regions = plot.getRegions();
|
regions = plot.getRegions();
|
||||||
} else {
|
} else {
|
||||||
plot = null;
|
plot = null;
|
||||||
regions = WEManager.getMask(pp);
|
regions = WEManager.getMask(pp);
|
||||||
if (regions.size() == 1) {
|
if (regions.size() == 1) {
|
||||||
@ -149,8 +148,8 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
} else {
|
} else {
|
||||||
World world = FaweAPI.getWorld(area.worldname);
|
World world = FaweAPI.getWorld(area.worldname);
|
||||||
List<Region> weRegions = regions.stream()
|
List<Region> weRegions = regions.stream()
|
||||||
.map(r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()), BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ())))
|
.map(r -> new CuboidRegion(world, BlockVector3.at(r.getMinimumX(), r.getMinimumY(), r.getMinimumZ()), BlockVector3.at(r.getMaximumX(), r.getMaximumY(), r.getMaximumZ())))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
maskedRegion = new RegionIntersection(world, weRegions);
|
maskedRegion = new RegionIntersection(world, weRegions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +167,9 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
@Override
|
@Override
|
||||||
public RegionFilter getFilter(String world) {
|
public RegionFilter getFilter(String world) {
|
||||||
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
||||||
if (area != null) return new PlotRegionFilter(area);
|
if (area != null) {
|
||||||
|
return new PlotRegionFilter(area);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,9 @@ public class ItemUtil {
|
|||||||
public Object getNMSItem(ItemStack item) {
|
public Object getNMSItem(ItemStack item) {
|
||||||
try {
|
try {
|
||||||
Object nmsItem = fieldHandle.get(item);
|
Object nmsItem = fieldHandle.get(item);
|
||||||
if (nmsItem == null) nmsItem = methodAsNMSCopy.invoke(null, item);
|
if (nmsItem == null) {
|
||||||
|
nmsItem = methodAsNMSCopy.invoke(null, item);
|
||||||
|
}
|
||||||
return nmsItem;
|
return nmsItem;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -57,12 +59,18 @@ public class ItemUtil {
|
|||||||
|
|
||||||
public CompoundTag getNBT(ItemStack item) {
|
public CompoundTag getNBT(ItemStack item) {
|
||||||
try {
|
try {
|
||||||
if (!item.hasItemMeta()) return null;
|
if (!item.hasItemMeta()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Object nmsItem = fieldHandle.get(item);
|
Object nmsItem = fieldHandle.get(item);
|
||||||
if (nmsItem == null) nmsItem = methodAsNMSCopy.invoke(null, item);
|
if (nmsItem == null) {
|
||||||
|
nmsItem = methodAsNMSCopy.invoke(null, item);
|
||||||
|
}
|
||||||
if (methodHasTag.invoke(nmsItem).equals(true)) {
|
if (methodHasTag.invoke(nmsItem).equals(true)) {
|
||||||
Object nmsTag = methodGetTag.invoke(nmsItem);
|
Object nmsTag = methodGetTag.invoke(nmsItem);
|
||||||
if (nmsTag == null) return null;
|
if (nmsTag == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Int2ObjectOpenHashMap<WeakReference<Tag>> map = hashToNMSTag.get();
|
Int2ObjectOpenHashMap<WeakReference<Tag>> map = hashToNMSTag.get();
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
@ -72,7 +80,9 @@ public class ItemUtil {
|
|||||||
WeakReference<Tag> nativeTagRef = map.get(nmsTag.hashCode());
|
WeakReference<Tag> nativeTagRef = map.get(nmsTag.hashCode());
|
||||||
if (nativeTagRef != null) {
|
if (nativeTagRef != null) {
|
||||||
Tag nativeTag = nativeTagRef.get();
|
Tag nativeTag = nativeTagRef.get();
|
||||||
if (nativeTag != null) return (CompoundTag) nativeTag;
|
if (nativeTag != null) {
|
||||||
|
return (CompoundTag) nativeTag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Tag nativeTag = adapter.toNative(nmsTag);
|
Tag nativeTag = adapter.toNative(nmsTag);
|
||||||
map.put(nmsTag.hashCode(), new WeakReference<>(nativeTag));
|
map.put(nmsTag.hashCode(), new WeakReference<>(nativeTag));
|
||||||
@ -94,7 +104,9 @@ public class ItemUtil {
|
|||||||
}
|
}
|
||||||
Object nmsTag = adapter.fromNative(tag);
|
Object nmsTag = adapter.fromNative(tag);
|
||||||
methodSetTag.invoke(nmsItem, nmsTag);
|
methodSetTag.invoke(nmsItem, nmsTag);
|
||||||
if (copy) return (ItemStack) methodAsBukkitCopy.invoke(null, nmsItem);
|
if (copy) {
|
||||||
|
return (ItemStack) methodAsBukkitCopy.invoke(null, nmsItem);
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -3,11 +3,6 @@ package com.boydti.fawe.bukkit.util.image;
|
|||||||
import com.boydti.fawe.util.image.Drawable;
|
import com.boydti.fawe.util.image.Drawable;
|
||||||
import com.boydti.fawe.util.image.ImageUtil;
|
import com.boydti.fawe.util.image.ImageUtil;
|
||||||
import com.boydti.fawe.util.image.ImageViewer;
|
import com.boydti.fawe.util.image.ImageViewer;
|
||||||
import java.awt.RenderingHints;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collection;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -25,6 +20,12 @@ import org.inventivetalent.mapmanager.controller.MultiMapController;
|
|||||||
import org.inventivetalent.mapmanager.manager.MapManager;
|
import org.inventivetalent.mapmanager.manager.MapManager;
|
||||||
import org.inventivetalent.mapmanager.wrapper.MapWrapper;
|
import org.inventivetalent.mapmanager.wrapper.MapWrapper;
|
||||||
|
|
||||||
|
import java.awt.RenderingHints;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collection;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class BukkitImageViewer implements ImageViewer {
|
public class BukkitImageViewer implements ImageViewer {
|
||||||
private final MapManager mapManager;
|
private final MapManager mapManager;
|
||||||
private final Player player;
|
private final Player player;
|
||||||
@ -116,7 +117,9 @@ public class BukkitImageViewer implements ImageViewer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!contains) return null;
|
if (!contains) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,11 +136,15 @@ public class BukkitImageViewer implements ImageViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void view(@Nullable BufferedImage image, @Nullable Drawable drawable) {
|
private void view(@Nullable BufferedImage image, @Nullable Drawable drawable) {
|
||||||
if (image == null && drawable == null) throw new IllegalArgumentException("An image or drawable must be provided. Both cannot be null");
|
if (image == null && drawable == null) {
|
||||||
|
throw new IllegalArgumentException("An image or drawable must be provided. Both cannot be null");
|
||||||
|
}
|
||||||
boolean initializing = last == null;
|
boolean initializing = last == null;
|
||||||
|
|
||||||
if (this.frames != null) {
|
if (this.frames != null) {
|
||||||
if (image == null && drawable != null) image = drawable.draw();
|
if (image == null && drawable != null) {
|
||||||
|
image = drawable.draw();
|
||||||
|
}
|
||||||
last = image;
|
last = image;
|
||||||
int width = frames.length;
|
int width = frames.length;
|
||||||
int height = frames[0].length;
|
int height = frames[0].length;
|
||||||
@ -158,7 +165,9 @@ public class BukkitImageViewer implements ImageViewer {
|
|||||||
} else if (player.getInventory().getHeldItemSlot() != slot) {
|
} else if (player.getInventory().getHeldItemSlot() != slot) {
|
||||||
player.getInventory().setHeldItemSlot(slot);
|
player.getInventory().setHeldItemSlot(slot);
|
||||||
}
|
}
|
||||||
if (image == null && drawable != null) image = drawable.draw();
|
if (image == null && drawable != null) {
|
||||||
|
image = drawable.draw();
|
||||||
|
}
|
||||||
last = image;
|
last = image;
|
||||||
BufferedImage scaled = ImageUtil.getScaledInstance(image, 128, 128, RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
|
BufferedImage scaled = ImageUtil.getScaledInstance(image, 128, 128, RenderingHints.VALUE_INTERPOLATION_BILINEAR, false);
|
||||||
MapWrapper mapWrapper = mapManager.wrapImage(scaled);
|
MapWrapper mapWrapper = mapManager.wrapImage(scaled);
|
||||||
@ -181,7 +190,9 @@ public class BukkitImageViewer implements ImageViewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
if (last != null) view(last, null);
|
if (last != null) {
|
||||||
|
view(last, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,13 +107,13 @@ public class AsyncBlock implements Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean setCombinedId(int combinedId) {
|
public boolean setTypeIdAndPropertyId(int id, int propertyId) {
|
||||||
return world.setBlock(x, y, z, BlockState.getFromInternalId(combinedId));
|
return setCombinedId(id + (propertyId << BlockTypesCache.BIT_OFFSET));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean setTypeIdAndPropertyId(int id, int propertyId) {
|
public boolean setCombinedId(int combinedId) {
|
||||||
return setCombinedId(id + (propertyId << BlockTypesCache.BIT_OFFSET));
|
return world.setBlock(x, y, z, BlockState.getFromInternalId(combinedId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -361,6 +361,10 @@ public class AsyncBlock implements Block {
|
|||||||
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops(tool));
|
return TaskManager.IMP.sync(() -> getUnsafeBlock().getDrops(tool));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<ItemStack> getDrops(ItemStack tool, Entity entity) {
|
||||||
|
return Collections.emptyList(); //todo
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) {
|
public void setMetadata(@NotNull String metadataKey, @NotNull MetadataValue newMetadataValue) {
|
||||||
this.getUnsafeBlock().setMetadata(metadataKey, newMetadataValue);
|
this.getUnsafeBlock().setMetadata(metadataKey, newMetadataValue);
|
||||||
@ -409,12 +413,9 @@ public class AsyncBlock implements Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull BlockSoundGroup getSoundGroup() {
|
@NotNull
|
||||||
|
public BlockSoundGroup getSoundGroup() {
|
||||||
return TaskManager.IMP.sync(() -> getUnsafeBlock().getSoundGroup());
|
return TaskManager.IMP.sync(() -> getUnsafeBlock().getSoundGroup());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ItemStack> getDrops(ItemStack tool, Entity entity) {
|
|
||||||
return Collections.emptyList(); //todo
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,8 @@ public class AsyncChunk implements Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull BlockState[] getTileEntities(boolean useSnapshot) {
|
@NotNull
|
||||||
|
public BlockState[] getTileEntities(boolean useSnapshot) {
|
||||||
if (!isLoaded()) {
|
if (!isLoaded()) {
|
||||||
return new BlockState[0];
|
return new BlockState[0];
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.boydti.fawe.object.RunnableVal;
|
|||||||
import com.boydti.fawe.util.StringMan;
|
import com.boydti.fawe.util.StringMan;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import com.destroystokyo.paper.HeightmapType;
|
import com.destroystokyo.paper.HeightmapType;
|
||||||
|
import com.google.common.annotations.Beta;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||||
@ -13,6 +14,7 @@ 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 io.papermc.paper.world.MoonPhase;
|
||||||
import org.bukkit.BlockChangeDelegate;
|
import org.bukkit.BlockChangeDelegate;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -60,7 +62,6 @@ import org.bukkit.util.RayTraceResult;
|
|||||||
import org.bukkit.util.Vector;
|
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 io.papermc.paper.world.MoonPhase;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -81,6 +82,7 @@ import java.util.function.Predicate;
|
|||||||
* @see #wrap(World)
|
* @see #wrap(World)
|
||||||
* @see #create(WorldCreator)
|
* @see #create(WorldCreator)
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class AsyncWorld extends PassthroughExtent implements World {
|
public class AsyncWorld extends PassthroughExtent implements World {
|
||||||
|
|
||||||
private World parent;
|
private World parent;
|
||||||
@ -93,9 +95,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parent Parent world
|
* An internal constructor for using a world asynchronously in FAWE. Do not use!
|
||||||
* @param autoQueue
|
|
||||||
* @deprecated use {@link #wrap(World)} instead
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public AsyncWorld(World parent, boolean autoQueue) {
|
public AsyncWorld(World parent, boolean autoQueue) {
|
||||||
@ -107,9 +107,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parent
|
* An internal constructor for using a world asynchronously in FAWE. Do not use!
|
||||||
* @param extent
|
|
||||||
* @deprecated use {@link #wrap(World)} instead
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public AsyncWorld(World parent, Extent extent) {
|
public AsyncWorld(World parent, Extent extent) {
|
||||||
@ -120,9 +118,6 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap a world for async usage.
|
* Wrap a world for async usage.
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static AsyncWorld wrap(World world) {
|
public static AsyncWorld wrap(World world) {
|
||||||
if (world instanceof AsyncWorld) {
|
if (world instanceof AsyncWorld) {
|
||||||
@ -141,13 +136,11 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a world async (untested)
|
* Create a world async. This is not tested and may be removed in the future due to
|
||||||
* - Only optimized for 1.10
|
* synchronization problems.
|
||||||
*
|
|
||||||
* @param creator
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public synchronized static AsyncWorld create(final WorldCreator creator) {
|
@Beta
|
||||||
|
public static synchronized AsyncWorld create(final WorldCreator creator) {
|
||||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||||
@Nullable World world = adapter.createWorld(creator);
|
@Nullable World world = adapter.createWorld(creator);
|
||||||
return wrap(world);
|
return wrap(world);
|
||||||
@ -164,7 +157,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull WorldBorder getWorldBorder() {
|
@NotNull
|
||||||
|
public WorldBorder getWorldBorder() {
|
||||||
return TaskManager.IMP.sync(() -> parent.getWorldBorder());
|
return TaskManager.IMP.sync(() -> parent.getWorldBorder());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,12 +232,14 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull AsyncBlock getBlockAt(final int x, final int y, final int z) {
|
@NotNull
|
||||||
|
public AsyncBlock getBlockAt(final int x, final int y, final int z) {
|
||||||
return new AsyncBlock(this, x, y, z);
|
return new AsyncBlock(this, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull AsyncBlock getBlockAt(Location loc) {
|
@NotNull
|
||||||
|
public AsyncBlock getBlockAt(Location loc) {
|
||||||
return getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
return getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,13 +260,15 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull AsyncBlock getHighestBlockAt(int x, int z) {
|
@NotNull
|
||||||
|
public AsyncBlock getHighestBlockAt(int x, int z) {
|
||||||
int y = getHighestBlockYAt(x, z);
|
int y = getHighestBlockYAt(x, z);
|
||||||
return getBlockAt(x, y, z);
|
return getBlockAt(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull AsyncBlock getHighestBlockAt(Location loc) {
|
@NotNull
|
||||||
|
public AsyncBlock getHighestBlockAt(Location loc) {
|
||||||
return getHighestBlockAt(loc.getBlockX(), loc.getBlockZ());
|
return getHighestBlockAt(loc.getBlockX(), loc.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,28 +283,33 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Block getHighestBlockAt(int i, int i1, @NotNull HeightMap heightMap) {
|
@NotNull
|
||||||
|
public Block getHighestBlockAt(int i, int i1, @NotNull HeightMap heightMap) {
|
||||||
return parent.getHighestBlockAt(i, i1, heightMap);
|
return parent.getHighestBlockAt(i, i1, heightMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Block getHighestBlockAt(@NotNull Location location,
|
@NotNull
|
||||||
@NotNull HeightMap heightMap) {
|
public Block getHighestBlockAt(@NotNull Location location,
|
||||||
|
@NotNull HeightMap heightMap) {
|
||||||
return parent.getHighestBlockAt(location, heightMap);
|
return parent.getHighestBlockAt(location, heightMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull AsyncChunk getChunkAt(int x, int z) {
|
@NotNull
|
||||||
|
public AsyncChunk getChunkAt(int x, int z) {
|
||||||
return new AsyncChunk(this, x, z);
|
return new AsyncChunk(this, x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull AsyncChunk getChunkAt(Location location) {
|
@NotNull
|
||||||
|
public AsyncChunk getChunkAt(Location location) {
|
||||||
return getChunkAt(location.getBlockX(), location.getBlockZ());
|
return getChunkAt(location.getBlockX(), location.getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull AsyncChunk getChunkAt(Block block) {
|
@NotNull
|
||||||
|
public AsyncChunk getChunkAt(Block block) {
|
||||||
return getChunkAt(block.getX(), block.getZ());
|
return getChunkAt(block.getX(), block.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,6 +323,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
return chunk.isLoaded();
|
return chunk.isLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Chunk[] getLoadedChunks() {
|
public Chunk[] getLoadedChunks() {
|
||||||
return parent.getLoadedChunks();
|
return parent.getLoadedChunks();
|
||||||
@ -357,6 +361,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public boolean isChunkInUse(int x, int z) {
|
public boolean isChunkInUse(int x, int z) {
|
||||||
return parent.isChunkInUse(x, z);
|
return parent.isChunkInUse(x, z);
|
||||||
}
|
}
|
||||||
@ -411,6 +416,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public boolean regenerateChunk(final int x, final int z) {
|
public boolean regenerateChunk(final int x, final int z) {
|
||||||
return TaskManager.IMP.sync(() -> parent.regenerateChunk(x, z));
|
return TaskManager.IMP.sync(() -> parent.regenerateChunk(x, z));
|
||||||
}
|
}
|
||||||
@ -422,104 +428,148 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Item dropItem(final @NotNull Location location, final @NotNull ItemStack item) {
|
@NotNull
|
||||||
|
public Item dropItem(
|
||||||
|
@NotNull
|
||||||
|
final Location location, @NotNull
|
||||||
|
final ItemStack item) {
|
||||||
return TaskManager.IMP.sync(() -> parent.dropItem(location, item));
|
return TaskManager.IMP.sync(() -> parent.dropItem(location, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Item dropItemNaturally(final @NotNull Location location,
|
@NotNull
|
||||||
final @NotNull ItemStack item) {
|
public Item dropItemNaturally(
|
||||||
|
@NotNull
|
||||||
|
final Location location,
|
||||||
|
@NotNull
|
||||||
|
final 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,
|
@NotNull
|
||||||
final @NotNull Vector direction, final float speed, final float spread) {
|
public Arrow spawnArrow(
|
||||||
|
@NotNull
|
||||||
|
final Location location,
|
||||||
|
@NotNull
|
||||||
|
final 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public <T extends AbstractArrow> @NotNull T spawnArrow(@NotNull Location location,
|
public <T extends AbstractArrow> T spawnArrow(@NotNull Location location,
|
||||||
@NotNull Vector direction, float speed, float spread, @NotNull Class<T> clazz) {
|
@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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean generateTree(final @NotNull Location location, final @NotNull TreeType type) {
|
public boolean generateTree(
|
||||||
|
@NotNull
|
||||||
|
final Location location, @NotNull
|
||||||
|
final TreeType type) {
|
||||||
return TaskManager.IMP.sync(() -> parent.generateTree(location, type));
|
return TaskManager.IMP.sync(() -> parent.generateTree(location, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean generateTree(final @NotNull Location loc, final @NotNull TreeType type,
|
public boolean generateTree(
|
||||||
final @NotNull BlockChangeDelegate delegate) {
|
@NotNull
|
||||||
|
final Location loc, @NotNull
|
||||||
|
final TreeType type,
|
||||||
|
@NotNull
|
||||||
|
final BlockChangeDelegate delegate) {
|
||||||
return TaskManager.IMP.sync(() -> parent.generateTree(loc, type, delegate));
|
return TaskManager.IMP.sync(() -> parent.generateTree(loc, type, delegate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Entity spawnEntity(@NotNull Location loc, EntityType type) {
|
@NotNull
|
||||||
|
public Entity spawnEntity(@NotNull Location loc, EntityType type) {
|
||||||
return spawn(loc, type.getEntityClass());
|
return spawn(loc, type.getEntityClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull LightningStrike strikeLightning(final @NotNull Location loc) {
|
@NotNull
|
||||||
|
public LightningStrike strikeLightning(
|
||||||
|
@NotNull
|
||||||
|
final Location loc) {
|
||||||
return TaskManager.IMP.sync(() -> parent.strikeLightning(loc));
|
return TaskManager.IMP.sync(() -> parent.strikeLightning(loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull LightningStrike strikeLightningEffect(final @NotNull Location loc) {
|
@NotNull
|
||||||
|
public LightningStrike strikeLightningEffect(
|
||||||
|
@NotNull
|
||||||
|
final Location loc) {
|
||||||
return TaskManager.IMP.sync(() -> parent.strikeLightningEffect(loc));
|
return TaskManager.IMP.sync(() -> parent.strikeLightningEffect(loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List getEntities() {
|
@NotNull
|
||||||
|
public List getEntities() {
|
||||||
return TaskManager.IMP.sync(() -> parent.getEntities());
|
return TaskManager.IMP.sync(() -> parent.getEntities());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<LivingEntity> getLivingEntities() {
|
@NotNull
|
||||||
|
public List<LivingEntity> getLivingEntities() {
|
||||||
return TaskManager.IMP.sync(() -> parent.getLivingEntities());
|
return TaskManager.IMP.sync(() -> parent.getLivingEntities());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public <T extends Entity> @NotNull Collection<T> getEntitiesByClass(final Class<T>... classes) {
|
public <T extends Entity> Collection<T> getEntitiesByClass(
|
||||||
|
@NotNull
|
||||||
|
final Class<T>... classes) {
|
||||||
return TaskManager.IMP.sync(() -> parent.getEntitiesByClass(classes));
|
return TaskManager.IMP.sync(() -> parent.getEntitiesByClass(classes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public <T extends Entity> @NotNull Collection<T> getEntitiesByClass(
|
public <T extends Entity> Collection<T> getEntitiesByClass(
|
||||||
final @NotNull Class<T> cls) {
|
@NotNull
|
||||||
|
final Class<T> cls) {
|
||||||
return TaskManager.IMP.sync(() -> parent.getEntitiesByClass(cls));
|
return TaskManager.IMP.sync(() -> parent.getEntitiesByClass(cls));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Collection<Entity> getEntitiesByClasses(final Class<?>... classes) {
|
@NotNull
|
||||||
|
public Collection<Entity> getEntitiesByClasses(
|
||||||
|
@NotNull
|
||||||
|
final Class<?>... classes) {
|
||||||
return TaskManager.IMP.sync(() -> parent.getEntitiesByClasses(classes));
|
return TaskManager.IMP.sync(() -> parent.getEntitiesByClasses(classes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<Player> getPlayers() {
|
@NotNull
|
||||||
|
public List<Player> getPlayers() {
|
||||||
return TaskManager.IMP.sync(() -> parent.getPlayers());
|
return TaskManager.IMP.sync(() -> parent.getPlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Collection<Entity> getNearbyEntities(final @NotNull Location location,
|
@NotNull
|
||||||
|
public Collection<Entity> getNearbyEntities(
|
||||||
|
@NotNull
|
||||||
|
final Location location,
|
||||||
final double x, final double y, final double z) {
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull String getName() {
|
@NotNull
|
||||||
|
public String getName() {
|
||||||
return parent.getName();
|
return parent.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull UUID getUID() {
|
@NotNull
|
||||||
|
public UUID getUID() {
|
||||||
return parent.getUID();
|
return parent.getUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Location getSpawnLocation() {
|
@NotNull
|
||||||
|
public Location getSpawnLocation() {
|
||||||
return parent.getSpawnLocation();
|
return parent.getSpawnLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +584,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull MoonPhase getMoonPhase() {
|
@NotNull
|
||||||
|
public MoonPhase getMoonPhase() {
|
||||||
return parent.getMoonPhase();
|
return parent.getMoonPhase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,45 +720,52 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<BlockPopulator> getPopulators() {
|
@NotNull
|
||||||
|
public List<BlockPopulator> getPopulators() {
|
||||||
return parent.getPopulators();
|
return parent.getPopulators();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public <T extends Entity> @NotNull T spawn(final @NotNull Location location,
|
public <T extends Entity> T spawn(@NotNull final Location location, @NotNull final Class<T> clazz) throws IllegalArgumentException {
|
||||||
final @NotNull Class<T> clazz) throws IllegalArgumentException {
|
|
||||||
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz));
|
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public <T extends Entity> @NotNull T spawn(@NotNull Location location, @NotNull Class<T> clazz,
|
public <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz,
|
||||||
Consumer<T> function) throws IllegalArgumentException {
|
Consumer<T> function) throws IllegalArgumentException {
|
||||||
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz, function));
|
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz, function));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public <T extends Entity> @NotNull T spawn(@NotNull Location location, @NotNull Class<T> clazz,
|
public <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz,
|
||||||
@Nullable Consumer<T> function, CreatureSpawnEvent.@NotNull SpawnReason reason)
|
@Nullable Consumer<T> function, @NotNull
|
||||||
|
CreatureSpawnEvent.SpawnReason reason)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
return null;
|
return TaskManager.IMP.sync(() -> parent.spawn(location, clazz, function, reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull FallingBlock spawnFallingBlock(@NotNull Location location,
|
@NotNull
|
||||||
@NotNull MaterialData data) throws IllegalArgumentException {
|
public 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
|
||||||
@NotNull Material material, byte data) throws IllegalArgumentException {
|
public 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
|
||||||
@NotNull BlockData blockData) throws IllegalArgumentException {
|
public 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -717,7 +775,10 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playEffect(final @NotNull Location location, final @NotNull Effect effect,
|
public void playEffect(
|
||||||
|
@NotNull
|
||||||
|
final Location location, @NotNull
|
||||||
|
final Effect effect,
|
||||||
final int data, final int radius) {
|
final int data, final int radius) {
|
||||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
@ -733,7 +794,10 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void playEffect(final @NotNull Location location, final @NotNull Effect effect,
|
public <T> void playEffect(
|
||||||
|
@NotNull
|
||||||
|
final Location location, @NotNull
|
||||||
|
final Effect effect,
|
||||||
final T data, final int radius) {
|
final T data, final int radius) {
|
||||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
@ -744,8 +808,9 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ChunkSnapshot getEmptyChunkSnapshot(final int x, final int z,
|
@NotNull
|
||||||
final boolean includeBiome, final boolean includeBiomeTempRain) {
|
public ChunkSnapshot getEmptyChunkSnapshot(final int x, final int z,
|
||||||
|
final boolean includeBiome, final boolean includeBiomeTempRain) {
|
||||||
return TaskManager.IMP
|
return TaskManager.IMP
|
||||||
.sync(() -> parent.getEmptyChunkSnapshot(x, z, includeBiome, includeBiomeTempRain));
|
.sync(() -> parent.getEmptyChunkSnapshot(x, z, includeBiome, includeBiomeTempRain));
|
||||||
}
|
}
|
||||||
@ -766,12 +831,14 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Biome getBiome(int x, int z) {
|
@NotNull
|
||||||
|
public Biome getBiome(int x, int z) {
|
||||||
return adapter.adapt(getExtent().getBiomeType(x, 0, z));
|
return adapter.adapt(getExtent().getBiomeType(x, 0, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Biome getBiome(int x, int y, int z) {
|
@NotNull
|
||||||
|
public Biome getBiome(int x, int y, int z) {
|
||||||
return adapter.adapt(getExtent().getBiomeType(x, y, z));
|
return adapter.adapt(getExtent().getBiomeType(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -788,6 +855,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public double getTemperature(int x, int z) {
|
public double getTemperature(int x, int z) {
|
||||||
return parent.getTemperature(x, z);
|
return parent.getTemperature(x, z);
|
||||||
}
|
}
|
||||||
@ -798,6 +866,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public double getHumidity(int x, int z) {
|
public double getHumidity(int x, int z) {
|
||||||
return parent.getHumidity(x, z);
|
return parent.getHumidity(x, z);
|
||||||
}
|
}
|
||||||
@ -848,16 +917,19 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Difficulty getDifficulty() {
|
@NotNull
|
||||||
|
public Difficulty getDifficulty() {
|
||||||
return parent.getDifficulty();
|
return parent.getDifficulty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull File getWorldFolder() {
|
@NotNull
|
||||||
|
public File getWorldFolder() {
|
||||||
return parent.getWorldFolder();
|
return parent.getWorldFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public WorldType getWorldType() {
|
public WorldType getWorldType() {
|
||||||
return parent.getWorldType();
|
return parent.getWorldType();
|
||||||
}
|
}
|
||||||
@ -948,7 +1020,10 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playSound(final @NotNull Location location, final @NotNull Sound sound,
|
public void playSound(
|
||||||
|
@NotNull
|
||||||
|
final Location location, @NotNull
|
||||||
|
final Sound sound,
|
||||||
final float volume, final float pitch) {
|
final float volume, final float pitch) {
|
||||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
@ -959,7 +1034,10 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playSound(final @NotNull Location location, final @NotNull String sound,
|
public void playSound(
|
||||||
|
@NotNull
|
||||||
|
final Location location, @NotNull
|
||||||
|
final String sound,
|
||||||
final float volume, final float pitch) {
|
final float volume, final float pitch) {
|
||||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
@ -991,17 +1069,20 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String[] getGameRules() {
|
public String[] getGameRules() {
|
||||||
return parent.getGameRules();
|
return parent.getGameRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public String getGameRuleValue(String rule) {
|
public String getGameRuleValue(String rule) {
|
||||||
return parent.getGameRuleValue(rule);
|
return parent.getGameRuleValue(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public boolean setGameRuleValue(@NotNull String rule, @NotNull String value) {
|
public boolean setGameRuleValue(@NotNull String rule, @NotNull String value) {
|
||||||
return parent.setGameRuleValue(rule, value);
|
return parent.setGameRuleValue(rule, value);
|
||||||
}
|
}
|
||||||
@ -1012,6 +1093,7 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public <T> T getGameRuleValue(@NotNull GameRule<T> gameRule) {
|
public <T> T getGameRuleValue(@NotNull GameRule<T> gameRule) {
|
||||||
return parent.getGameRuleValue(gameRule);
|
return parent.getGameRuleValue(gameRule);
|
||||||
}
|
}
|
||||||
@ -1027,22 +1109,28 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Spigot spigot() {
|
@NotNull
|
||||||
|
public Spigot spigot() {
|
||||||
return parent.spigot();
|
return parent.spigot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable Raid locateNearestRaid(@NotNull Location location, int i) {
|
@Nullable
|
||||||
|
public Raid locateNearestRaid(@NotNull Location location, int i) {
|
||||||
return parent.locateNearestRaid(location, i);
|
return parent.locateNearestRaid(location, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<Raid> getRaids() {
|
@NotNull
|
||||||
|
public List<Raid> getRaids() {
|
||||||
return parent.getRaids();
|
return parent.getRaids();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMetadata(final @NotNull String key, final @NotNull MetadataValue meta) {
|
public void setMetadata(
|
||||||
|
@NotNull
|
||||||
|
final String key, @NotNull
|
||||||
|
final MetadataValue meta) {
|
||||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(Object value) {
|
||||||
@ -1052,7 +1140,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<MetadataValue> getMetadata(@NotNull String key) {
|
@NotNull
|
||||||
|
public List<MetadataValue> getMetadata(@NotNull String key) {
|
||||||
return parent.getMetadata(key);
|
return parent.getMetadata(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1062,7 +1151,10 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMetadata(final @NotNull String key, final @NotNull Plugin plugin) {
|
public void removeMetadata(
|
||||||
|
@NotNull
|
||||||
|
final String key, @NotNull
|
||||||
|
final Plugin plugin) {
|
||||||
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Object value) {
|
public void run(Object value) {
|
||||||
@ -1072,12 +1164,14 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPluginMessage(@NotNull Plugin source, @NotNull String channel, byte[] message) {
|
public void sendPluginMessage(@NotNull Plugin source, @NotNull String channel, @NotNull
|
||||||
|
byte[] message) {
|
||||||
parent.sendPluginMessage(source, channel, message);
|
parent.sendPluginMessage(source, channel, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Set<String> getListeningPluginChannels() {
|
@NotNull
|
||||||
|
public Set<String> getListeningPluginChannels() {
|
||||||
return parent.getListeningPluginChannels();
|
return parent.getListeningPluginChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1086,19 +1180,22 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Collection<Entity> getNearbyEntities(@NotNull BoundingBox arg0) {
|
@NotNull
|
||||||
|
public Collection<Entity> getNearbyEntities(@NotNull BoundingBox arg0) {
|
||||||
return parent.getNearbyEntities(arg0);
|
return parent.getNearbyEntities(arg0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Collection<Entity> getNearbyEntities(@NotNull BoundingBox arg0,
|
@NotNull
|
||||||
Predicate<Entity> arg1) {
|
public 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,
|
@NotNull
|
||||||
double arg2, double arg3, Predicate<Entity> arg4) {
|
public Collection<Entity> getNearbyEntities(@NotNull Location arg0, double arg1,
|
||||||
|
double arg2, double arg3, Predicate<Entity> arg4) {
|
||||||
return parent.getNearbyEntities(arg0, arg1, arg2, arg3, arg4);
|
return parent.getNearbyEntities(arg0, arg1, arg2, arg3, arg4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1196,7 +1293,8 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Collection<Chunk> getForceLoadedChunks() {
|
@NotNull
|
||||||
|
public Collection<Chunk> getForceLoadedChunks() {
|
||||||
return parent.getForceLoadedChunks();
|
return parent.getForceLoadedChunks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1216,18 +1314,22 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Collection<Plugin> getPluginChunkTickets(int x, int z) {
|
@NotNull
|
||||||
|
public Collection<Plugin> getPluginChunkTickets(int x, int z) {
|
||||||
return getBukkitWorld().getPluginChunkTickets(x, z);
|
return getBukkitWorld().getPluginChunkTickets(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Map<Plugin, Collection<Chunk>> getPluginChunkTickets() {
|
@NotNull
|
||||||
|
public Map<Plugin, Collection<Chunk>> getPluginChunkTickets() {
|
||||||
return getBukkitWorld().getPluginChunkTickets();
|
return getBukkitWorld().getPluginChunkTickets();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public int getHighestBlockYAt(int x, int z,
|
public int getHighestBlockYAt(int x, int z,
|
||||||
com.destroystokyo.paper.@NotNull HeightmapType heightmap)
|
@NotNull
|
||||||
|
com.destroystokyo.paper.HeightmapType heightmap)
|
||||||
throws UnsupportedOperationException {
|
throws UnsupportedOperationException {
|
||||||
return TaskManager.IMP.sync(() -> parent.getHighestBlockYAt(x, z, heightmap));
|
return TaskManager.IMP.sync(() -> parent.getHighestBlockYAt(x, z, heightmap));
|
||||||
}
|
}
|
||||||
@ -1258,14 +1360,16 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull CompletableFuture<Chunk> getChunkAtAsync(int arg0, int arg1, boolean arg2) {
|
@NotNull
|
||||||
return parent.getChunkAtAsync(arg0, arg1, arg2);
|
public CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen) {
|
||||||
|
return parent.getChunkAtAsync(x, z, gen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen,
|
@NotNull
|
||||||
boolean urgent) {
|
public CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen,
|
||||||
return null;
|
boolean urgent) {
|
||||||
|
return parent.getChunkAtAsync(x, z, gen, urgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1274,16 +1378,19 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public void getChunkAtAsync(int x, int z, @NotNull ChunkLoadCallback cb) {
|
public void getChunkAtAsync(int x, int z, @NotNull ChunkLoadCallback cb) {
|
||||||
parent.getChunkAtAsync(x, z, cb);
|
parent.getChunkAtAsync(x, z, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public void getChunkAtAsync(@NotNull Location location, @NotNull ChunkLoadCallback cb) {
|
public void getChunkAtAsync(@NotNull Location location, @NotNull ChunkLoadCallback cb) {
|
||||||
parent.getChunkAtAsync(location, cb);
|
parent.getChunkAtAsync(location, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public void getChunkAtAsync(@NotNull Block block, @NotNull ChunkLoadCallback cb) {
|
public void getChunkAtAsync(@NotNull Block block, @NotNull ChunkLoadCallback cb) {
|
||||||
parent.getChunkAtAsync(block, cb);
|
parent.getChunkAtAsync(block, cb);
|
||||||
}
|
}
|
||||||
@ -1343,20 +1450,25 @@ public class AsyncWorld extends PassthroughExtent implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public int getHighestBlockYAt(@NotNull Location location, @NotNull HeightmapType heightmap)
|
public int getHighestBlockYAt(@NotNull Location location, @NotNull HeightmapType heightmap)
|
||||||
throws UnsupportedOperationException {
|
throws UnsupportedOperationException {
|
||||||
return parent.getHighestBlockYAt(location, heightmap);
|
return parent.getHighestBlockYAt(location, heightmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Block getHighestBlockAt(int x, int z, @NotNull HeightmapType heightmap)
|
@NotNull
|
||||||
|
@Deprecated
|
||||||
|
public Block getHighestBlockAt(int x, int z, @NotNull HeightmapType heightmap)
|
||||||
throws UnsupportedOperationException {
|
throws UnsupportedOperationException {
|
||||||
return parent.getHighestBlockAt(x, z, heightmap);
|
return parent.getHighestBlockAt(x, z, heightmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Block getHighestBlockAt(@NotNull Location location,
|
@NotNull
|
||||||
@NotNull HeightmapType heightmap) throws UnsupportedOperationException {
|
@Deprecated
|
||||||
|
public Block getHighestBlockAt(@NotNull Location location,
|
||||||
|
@NotNull HeightmapType heightmap) throws UnsupportedOperationException {
|
||||||
return parent.getHighestBlockAt(location, heightmap);
|
return parent.getHighestBlockAt(location, heightmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,12 @@ package com.boydti.fawe.bukkit.wrapper.state;
|
|||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.persistence.PersistentDataAdapterContext;
|
||||||
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -11,13 +17,6 @@ import java.util.Map;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
import org.bukkit.NamespacedKey;
|
|
||||||
import org.bukkit.persistence.PersistentDataAdapterContext;
|
|
||||||
import org.bukkit.persistence.PersistentDataContainer;
|
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public final class AsyncDataContainer implements PersistentDataContainer {
|
public final class AsyncDataContainer implements PersistentDataContainer {
|
||||||
private final CompoundTag root;
|
private final CompoundTag root;
|
||||||
|
|
||||||
@ -38,7 +37,9 @@ public final class AsyncDataContainer implements PersistentDataContainer {
|
|||||||
CompoundTag tag = root();
|
CompoundTag tag = root();
|
||||||
Map<String, Tag> raw;
|
Map<String, Tag> raw;
|
||||||
if (tag == null) {
|
if (tag == null) {
|
||||||
if (!create) return Collections.emptyMap();
|
if (!create) {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
Map<String, Tag> map = root.getValue();
|
Map<String, Tag> map = root.getValue();
|
||||||
map.put("PublicBukkitValues", new CompoundTag(raw = new HashMap<>()));
|
map.put("PublicBukkitValues", new CompoundTag(raw = new HashMap<>()));
|
||||||
} else {
|
} else {
|
||||||
@ -58,7 +59,9 @@ public final class AsyncDataContainer implements PersistentDataContainer {
|
|||||||
Validate.notNull(key, "The provided key for the custom value was null");
|
Validate.notNull(key, "The provided key for the custom value was null");
|
||||||
Validate.notNull(type, "The provided type for the custom value was null");
|
Validate.notNull(type, "The provided type for the custom value was null");
|
||||||
Tag value = get(false).get(key.toString());
|
Tag value = get(false).get(key.toString());
|
||||||
if (value == null) return type == null;
|
if (value == null) {
|
||||||
|
return type == null;
|
||||||
|
}
|
||||||
return type.getPrimitiveType() == value.getValue().getClass();
|
return type.getPrimitiveType() == value.getValue().getClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +109,7 @@ public final class AsyncDataContainer implements PersistentDataContainer {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
Map<String, Tag> myRawMap = this.getRaw();
|
Map<String, Tag> myRawMap = this.getRaw();
|
||||||
Map<String, Tag> theirRawMap = ((AsyncDataContainer)obj).getRaw();
|
Map<String, Tag> theirRawMap = ((AsyncDataContainer) obj).getRaw();
|
||||||
return Objects.equals(myRawMap, theirRawMap);
|
return Objects.equals(myRawMap, theirRawMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,15 +8,15 @@ import com.sk89q.jnbt.Tag;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.serializer.gson.GsonComponentSerializer;
|
import com.sk89q.worldedit.util.formatting.text.serializer.gson.GsonComponentSerializer;
|
||||||
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
|
import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.persistence.PersistentDataContainer;
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class AsyncSign extends AsyncBlockState implements Sign {
|
public class AsyncSign extends AsyncBlockState implements Sign {
|
||||||
public AsyncSign(AsyncBlock block, BaseBlock state) {
|
public AsyncSign(AsyncBlock block, BaseBlock state) {
|
||||||
@ -38,12 +38,16 @@ public class AsyncSign extends AsyncBlockState implements Sign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String fromJson(String jsonInput) {
|
private String fromJson(String jsonInput) {
|
||||||
if (jsonInput == null || jsonInput.isEmpty()) return "";
|
if (jsonInput == null || jsonInput.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return GsonComponentSerializer.INSTANCE.deserialize(jsonInput).toString();
|
return GsonComponentSerializer.INSTANCE.deserialize(jsonInput).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toJson(String oldInput) {
|
private String toJson(String oldInput) {
|
||||||
if (oldInput == null || oldInput.isEmpty()) return "";
|
if (oldInput == null || oldInput.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return LegacyComponentSerializer.INSTANCE.serialize(TextComponent.of(oldInput));
|
return LegacyComponentSerializer.INSTANCE.serialize(TextComponent.of(oldInput));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,16 +77,20 @@ public class AsyncSign extends AsyncBlockState implements Sign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull PersistentDataContainer getPersistentDataContainer() {
|
@NotNull
|
||||||
|
public PersistentDataContainer getPersistentDataContainer() {
|
||||||
return new AsyncDataContainer(getNbtData());
|
return new AsyncDataContainer(getNbtData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable DyeColor getColor() {
|
@Nullable
|
||||||
|
public DyeColor getColor() {
|
||||||
CompoundTag nbt = getNbtData();
|
CompoundTag nbt = getNbtData();
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
String color = nbt.getString("Color").toUpperCase();
|
String color = nbt.getString("Color").toUpperCase(Locale.ROOT);
|
||||||
if (!color.isEmpty()) return DyeColor.valueOf(color);
|
if (!color.isEmpty()) {
|
||||||
|
return DyeColor.valueOf(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return DyeColor.BLACK;
|
return DyeColor.BLACK;
|
||||||
}
|
}
|
||||||
@ -92,7 +100,7 @@ public class AsyncSign extends AsyncBlockState implements Sign {
|
|||||||
CompoundTag nbt = getNbtData();
|
CompoundTag nbt = getNbtData();
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
Map<String, Tag> map = nbt.getValue();
|
Map<String, Tag> map = nbt.getValue();
|
||||||
map.put("Color", new StringTag(color.name().toLowerCase()));
|
map.put("Color", new StringTag(color.name().toLowerCase(Locale.ROOT)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
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.bukkit.adapter.BukkitImplAdapter;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||||
@ -42,9 +40,6 @@ import com.sk89q.worldedit.world.entity.EntityType;
|
|||||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
@ -55,6 +50,12 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapts between Bukkit and WorldEdit equivalent objects.
|
* Adapts between Bukkit and WorldEdit equivalent objects.
|
||||||
*/
|
*/
|
||||||
@ -83,7 +84,7 @@ public enum BukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks equality between a WorldEdit BlockType and a Bukkit Material
|
* Checks equality between a WorldEdit BlockType and a Bukkit Material.
|
||||||
*
|
*
|
||||||
* @param blockType The WorldEdit BlockType
|
* @param blockType The WorldEdit BlockType
|
||||||
* @param type The Bukkit Material
|
* @param type The Bukkit Material
|
||||||
@ -117,7 +118,7 @@ public enum BukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a WorldEdit Actor from a Bukkit CommandSender
|
* Create a WorldEdit Actor from a Bukkit CommandSender.
|
||||||
*
|
*
|
||||||
* @param sender The Bukkit CommandSender
|
* @param sender The Bukkit CommandSender
|
||||||
* @return The WorldEdit Actor
|
* @return The WorldEdit Actor
|
||||||
@ -284,7 +285,7 @@ public enum BukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit Material form a WorldEdit ItemType
|
* Create a Bukkit Material form a WorldEdit ItemType.
|
||||||
*
|
*
|
||||||
* @param itemType The WorldEdit ItemType
|
* @param itemType The WorldEdit ItemType
|
||||||
* @return The Bukkit Material
|
* @return The Bukkit Material
|
||||||
@ -294,7 +295,7 @@ public enum BukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit Material form a WorldEdit BlockType
|
* Create a Bukkit Material form a WorldEdit BlockType.
|
||||||
*
|
*
|
||||||
* @param blockType The WorldEdit BlockType
|
* @param blockType The WorldEdit BlockType
|
||||||
* @return The Bukkit Material
|
* @return The Bukkit Material
|
||||||
@ -345,7 +346,7 @@ public enum BukkitAdapter {
|
|||||||
private static EnumMap<Material, ItemType> materialItemTypeCache = new EnumMap<>(Material.class);
|
private static EnumMap<Material, ItemType> materialItemTypeCache = new EnumMap<>(Material.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Material to a BlockType
|
* Converts a Material to a BlockType.
|
||||||
*
|
*
|
||||||
* @param material The material
|
* @param material The material
|
||||||
* @return The blocktype
|
* @return The blocktype
|
||||||
@ -356,7 +357,7 @@ public enum BukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Material to a ItemType
|
* Converts a Material to a ItemType.
|
||||||
*
|
*
|
||||||
* @param material The material
|
* @param material The material
|
||||||
* @return The itemtype
|
* @return The itemtype
|
||||||
@ -370,7 +371,7 @@ public enum BukkitAdapter {
|
|||||||
private static Map<String, BlockState> blockStateStringCache = new HashMap<>();
|
private static Map<String, BlockState> blockStateStringCache = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a WorldEdit BlockState from a Bukkit BlockData
|
* Create a WorldEdit BlockState from a Bukkit BlockData.
|
||||||
*
|
*
|
||||||
* @param blockData The Bukkit BlockData
|
* @param blockData The Bukkit BlockData
|
||||||
* @return The WorldEdit BlockState
|
* @return The WorldEdit BlockState
|
||||||
@ -382,7 +383,7 @@ public enum BukkitAdapter {
|
|||||||
private static Int2ObjectMap<BlockData> blockDataCache = new Int2ObjectOpenHashMap<>();
|
private static Int2ObjectMap<BlockData> blockDataCache = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit BlockData from a WorldEdit BlockStateHolder
|
* Create a Bukkit BlockData from a WorldEdit BlockStateHolder.
|
||||||
*
|
*
|
||||||
* @param block The WorldEdit BlockStateHolder
|
* @param block The WorldEdit BlockStateHolder
|
||||||
* @return The Bukkit BlockData
|
* @return The Bukkit BlockData
|
||||||
@ -392,7 +393,7 @@ public enum BukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a WorldEdit BlockState from a Bukkit ItemStack
|
* Create a WorldEdit BlockState from a Bukkit ItemStack.
|
||||||
*
|
*
|
||||||
* @param itemStack The Bukkit ItemStack
|
* @param itemStack The Bukkit ItemStack
|
||||||
* @return The WorldEdit BlockState
|
* @return The WorldEdit BlockState
|
||||||
@ -402,7 +403,7 @@ public enum BukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a WorldEdit BaseItemStack from a Bukkit ItemStack
|
* Create a WorldEdit BaseItemStack from a Bukkit ItemStack.
|
||||||
*
|
*
|
||||||
* @param itemStack The Bukkit ItemStack
|
* @param itemStack The Bukkit ItemStack
|
||||||
* @return The WorldEdit BaseItemStack
|
* @return The WorldEdit BaseItemStack
|
||||||
@ -412,7 +413,7 @@ public enum BukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Bukkit ItemStack from a WorldEdit BaseItemStack
|
* Create a Bukkit ItemStack from a WorldEdit BaseItemStack.
|
||||||
*
|
*
|
||||||
* @param item The WorldEdit BaseItemStack
|
* @param item The WorldEdit BaseItemStack
|
||||||
* @return The Bukkit ItemStack
|
* @return The Bukkit ItemStack
|
||||||
|
@ -94,6 +94,7 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
|
|||||||
print(TextComponent.of(part, TextColor.RED));
|
print(TextComponent.of(part, TextColor.RED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(Component component) {
|
public void print(Component component) {
|
||||||
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
|
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
|
||||||
|
@ -23,18 +23,17 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
|||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
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.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
|
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
|
||||||
import com.sk89q.worldedit.world.registry.PassthroughBlockMaterial;
|
import com.sk89q.worldedit.world.registry.PassthroughBlockMaterial;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class BukkitBlockRegistry extends BundledBlockRegistry {
|
public class BukkitBlockRegistry extends BundledBlockRegistry {
|
||||||
|
|
||||||
@ -46,7 +45,9 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
|
|||||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
BlockMaterial result = adapter.getMaterial(blockType);
|
BlockMaterial result = adapter.getMaterial(blockType);
|
||||||
if (result != null) return result;
|
if (result != null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Material mat = BukkitAdapter.adapt(blockType);
|
Material mat = BukkitAdapter.adapt(blockType);
|
||||||
if (mat == null) {
|
if (mat == null) {
|
||||||
@ -69,7 +70,9 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
|
|||||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
BlockMaterial result = adapter.getMaterial(state);
|
BlockMaterial result = adapter.getMaterial(state);
|
||||||
if (result != null) return result;
|
if (result != null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return super.getMaterial(state);
|
return super.getMaterial(state);
|
||||||
}
|
}
|
||||||
@ -81,6 +84,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
|
|||||||
}
|
}
|
||||||
return OptionalInt.empty();
|
return OptionalInt.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) {
|
public Map<String, ? extends Property<?>> getProperties(BlockType blockType) {
|
||||||
|
@ -19,13 +19,9 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static com.sk89q.worldedit.util.formatting.WorldEditText.reduceToText;
|
|
||||||
|
|
||||||
import com.sk89q.bukkit.util.CommandInspector;
|
import com.sk89q.bukkit.util.CommandInspector;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import java.util.Optional;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.enginehub.piston.CommandManager;
|
import org.enginehub.piston.CommandManager;
|
||||||
@ -33,10 +29,13 @@ import org.enginehub.piston.inject.InjectedValueStore;
|
|||||||
import org.enginehub.piston.inject.Key;
|
import org.enginehub.piston.inject.Key;
|
||||||
import org.enginehub.piston.inject.MapBackedValueStore;
|
import org.enginehub.piston.inject.MapBackedValueStore;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
import static com.sk89q.worldedit.util.formatting.WorldEditText.reduceToText;
|
||||||
|
|
||||||
class BukkitCommandInspector implements CommandInspector {
|
class BukkitCommandInspector implements CommandInspector {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(BukkitCommandInspector.class);
|
private static final Logger logger = LoggerFactory.getLogger(BukkitCommandInspector.class);
|
||||||
|
@ -19,25 +19,24 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
|
||||||
import com.sk89q.worldedit.extension.platform.AbstractNonPlayerActor;
|
import com.sk89q.worldedit.extension.platform.AbstractNonPlayerActor;
|
||||||
import com.sk89q.worldedit.session.SessionKey;
|
import com.sk89q.worldedit.session.SessionKey;
|
||||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||||
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
import com.sk89q.worldedit.util.formatting.WorldEditText;
|
||||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||||
import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter;
|
import com.sk89q.worldedit.util.formatting.text.adapter.bukkit.TextAdapter;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public class BukkitCommandSender extends AbstractNonPlayerActor {
|
public class BukkitCommandSender extends AbstractNonPlayerActor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,8 +44,8 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
|
|||||||
*/
|
*/
|
||||||
private static final UUID DEFAULT_ID = UUID.fromString("a233eb4b-4cab-42cd-9fd9-7e7b9a3f74be");
|
private static final UUID DEFAULT_ID = UUID.fromString("a233eb4b-4cab-42cd-9fd9-7e7b9a3f74be");
|
||||||
|
|
||||||
private CommandSender sender;
|
private final CommandSender sender;
|
||||||
private WorldEditPlugin plugin;
|
private final WorldEditPlugin plugin;
|
||||||
|
|
||||||
public BukkitCommandSender(WorldEditPlugin plugin, CommandSender sender) {
|
public BukkitCommandSender(WorldEditPlugin plugin, CommandSender sender) {
|
||||||
checkNotNull(plugin);
|
checkNotNull(plugin);
|
||||||
@ -68,6 +67,7 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public void printRaw(String msg) {
|
public void printRaw(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
sender.sendMessage(part);
|
sender.sendMessage(part);
|
||||||
@ -75,25 +75,29 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public void print(String msg) {
|
public void print(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
sender.sendMessage("\u00A7d" + part);
|
sender.sendMessage("§d" + part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public void printDebug(String msg) {
|
public void printDebug(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
sender.sendMessage("\u00A77" + part);
|
sender.sendMessage("§7" + part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public void printError(String msg) {
|
public void printError(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
sender.sendMessage("\u00A7c" + part);
|
sender.sendMessage("§c" + part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(Component component) {
|
public void print(Component component) {
|
||||||
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
|
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.entity.metadata.EntityProperties;
|
import com.sk89q.worldedit.entity.metadata.EntityProperties;
|
||||||
import org.bukkit.entity.Ambient;
|
import org.bukkit.entity.Ambient;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
@ -44,6 +42,8 @@ import org.bukkit.entity.Tameable;
|
|||||||
import org.bukkit.entity.Villager;
|
import org.bukkit.entity.Villager;
|
||||||
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
import org.bukkit.entity.minecart.ExplosiveMinecart;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
class BukkitEntityProperties implements EntityProperties {
|
class BukkitEntityProperties implements EntityProperties {
|
||||||
|
|
||||||
private final Entity entity;
|
private final Entity entity;
|
||||||
|
@ -14,10 +14,12 @@ public class BukkitEntityRegistry implements EntityRegistry {
|
|||||||
for (EntityType type : EntityType.values()) {
|
for (EntityType type : EntityType.values()) {
|
||||||
String name = type.getName();
|
String name = type.getName();
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
if (name.indexOf(':') == -1) name = "minecraft:" + name;
|
if (name.indexOf(':') == -1) {
|
||||||
|
name = "minecraft:" + name;
|
||||||
|
}
|
||||||
types.add(name);
|
types.add(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,11 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
import org.bukkit.permissions.PermissionAttachment;
|
import org.bukkit.permissions.PermissionAttachment;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class BukkitPlayer extends AbstractPlayerActor {
|
public class BukkitPlayer extends AbstractPlayerActor {
|
||||||
@ -173,23 +172,24 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
@Override
|
@Override
|
||||||
public void print(String msg) {
|
public void print(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
player.sendMessage("\u00A7d" + part);
|
player.sendMessage("§d" + part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printDebug(String msg) {
|
public void printDebug(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
player.sendMessage("\u00A77" + part);
|
player.sendMessage("§7" + part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void printError(String msg) {
|
public void printError(String msg) {
|
||||||
for (String part : msg.split("\n")) {
|
for (String part : msg.split("\n")) {
|
||||||
player.sendMessage("\u00A7c" + part);
|
player.sendMessage("§c" + part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void print(Component component) {
|
public void print(Component component) {
|
||||||
component = Caption.color(TranslatableComponent.of("prefix", component), getLocale());
|
component = Caption.color(TranslatableComponent.of("prefix", component), getLocale());
|
||||||
|
@ -44,14 +44,14 @@ import org.enginehub.piston.inject.MapBackedValueStore;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all events thrown in relation to a Player
|
* Handles all events thrown in relation to a Player.
|
||||||
*/
|
*/
|
||||||
public class WorldEditListener implements Listener {
|
public class WorldEditListener implements Listener {
|
||||||
|
|
||||||
private WorldEditPlugin plugin;
|
private final WorldEditPlugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the object;
|
* Construct the object.
|
||||||
*
|
*
|
||||||
* @param plugin the plugin
|
* @param plugin the plugin
|
||||||
*/
|
*/
|
||||||
@ -84,7 +84,7 @@ public class WorldEditListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a player interacts
|
* Called when a player interacts.
|
||||||
*
|
*
|
||||||
* @param event Relevant event details
|
* @param event Relevant event details
|
||||||
*/
|
*/
|
||||||
|
@ -42,10 +42,6 @@ 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.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.OptionalInt;
|
|
||||||
import java.util.Set;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
@ -55,6 +51,11 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.OptionalInt;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface for adapters of various Bukkit implementations.
|
* An interface for adapters of various Bukkit implementations.
|
||||||
*/
|
*/
|
||||||
@ -68,7 +69,7 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
int getDataVersion();
|
int getDataVersion();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a data fixer, or null if not supported
|
* Get a data fixer, or null if not supported.
|
||||||
*
|
*
|
||||||
* @return the data fixer
|
* @return the data fixer
|
||||||
*/
|
*/
|
||||||
@ -76,6 +77,8 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
DataFixer getDataFixer();
|
DataFixer getDataFixer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Check if this adapter supports the watchdog.
|
||||||
|
*
|
||||||
* @return {@code true} if {@link #tickWatchdog()} is implemented
|
* @return {@code true} if {@link #tickWatchdog()} is implemented
|
||||||
*/
|
*/
|
||||||
default boolean supportsWatchdog() {
|
default boolean supportsWatchdog() {
|
||||||
@ -217,14 +220,13 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
default @Nullable World createWorld(WorldCreator creator) {
|
@Nullable
|
||||||
|
default World createWorld(WorldCreator creator) {
|
||||||
return ((FaweBukkit) Fawe.imp()).createWorldUnloaded(creator::createWorld);
|
return ((FaweBukkit) Fawe.imp()).createWorldUnloaded(creator::createWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a fake chunk packet to a player
|
* Send a fake chunk packet to a player.
|
||||||
* @param player
|
|
||||||
* @param packet
|
|
||||||
*/
|
*/
|
||||||
default void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket packet) {
|
default void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket packet) {
|
||||||
throw new UnsupportedOperationException("Cannot send fake chunks");
|
throw new UnsupportedOperationException("Cannot send fake chunks");
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.sk89q.worldedit.bukkit.adapter;
|
package com.sk89q.worldedit.bukkit.adapter;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
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;
|
||||||
@ -9,11 +7,14 @@ 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.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
import java.util.List;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
||||||
private int[] itemTypes;
|
private int[] itemTypes;
|
||||||
private int[] blockTypes;
|
private int[] blockTypes;
|
||||||
@ -25,7 +26,9 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
|||||||
blockTypes = new int[materials.length];
|
blockTypes = new int[materials.length];
|
||||||
for (int i = 0; i < materials.length; i++) {
|
for (int i = 0; i < materials.length; i++) {
|
||||||
Material material = materials[i];
|
Material material = materials[i];
|
||||||
if (material.isLegacy()) continue;
|
if (material.isLegacy()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
NamespacedKey key = material.getKey();
|
NamespacedKey key = material.getKey();
|
||||||
String id = key.getNamespace() + ":" + key.getKey();
|
String id = key.getNamespace() + ":" + key.getKey();
|
||||||
if (material.isBlock()) {
|
if (material.isBlock()) {
|
||||||
@ -41,7 +44,7 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a Material to a ItemType
|
* Converts a Material to a ItemType.
|
||||||
*
|
*
|
||||||
* @param material The material
|
* @param material The material
|
||||||
* @return The itemtype
|
* @return The itemtype
|
||||||
@ -51,7 +54,9 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
|||||||
try {
|
try {
|
||||||
return ItemTypes.get(itemTypes[material.ordinal()]);
|
return ItemTypes.get(itemTypes[material.ordinal()]);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
if (init()) return asItemType(material);
|
if (init()) {
|
||||||
|
return asItemType(material);
|
||||||
|
}
|
||||||
return ItemTypes.get(itemTypes[material.ordinal()]);
|
return ItemTypes.get(itemTypes[material.ordinal()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,13 +66,15 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
|||||||
try {
|
try {
|
||||||
return BlockTypesCache.values[blockTypes[material.ordinal()]];
|
return BlockTypesCache.values[blockTypes[material.ordinal()]];
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
if (init()) return asBlockType(material);
|
if (init()) {
|
||||||
|
return asBlockType(material);
|
||||||
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a WorldEdit BlockStateHolder from a Bukkit BlockData
|
* Create a WorldEdit BlockStateHolder from a Bukkit BlockData.
|
||||||
*
|
*
|
||||||
* @param blockData The Bukkit BlockData
|
* @param blockData The Bukkit BlockData
|
||||||
* @return The WorldEdit BlockState
|
* @return The WorldEdit BlockState
|
||||||
@ -79,11 +86,15 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter {
|
|||||||
Material material = blockData.getMaterial();
|
Material material = blockData.getMaterial();
|
||||||
BlockType type = BlockTypes.getFromStateId(blockTypes[material.ordinal()]);
|
BlockType type = BlockTypes.getFromStateId(blockTypes[material.ordinal()]);
|
||||||
List<? extends Property> propList = type.getProperties();
|
List<? extends Property> propList = type.getProperties();
|
||||||
if (propList.size() == 0) return type.getDefaultState();
|
if (propList.size() == 0) {
|
||||||
|
return type.getDefaultState();
|
||||||
|
}
|
||||||
String properties = blockData.getAsString();
|
String properties = blockData.getAsString();
|
||||||
return BlockState.get(type, properties, type.getDefaultState());
|
return BlockState.get(type, properties, type.getDefaultState());
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
if (init()) return adapt(blockData);
|
if (init()) {
|
||||||
|
return adapt(blockData);
|
||||||
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public interface IBukkitAdapter {
|
|||||||
position.getX(), position.getY(), position.getZ());
|
position.getX(), position.getY(), position.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
default org.bukkit.Location adapt(org.bukkit.World world, BlockVector3 position){
|
default org.bukkit.Location adapt(org.bukkit.World world, BlockVector3 position) {
|
||||||
return adapt(world, position.toVector3());
|
return adapt(world, position.toVector3());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +254,9 @@ public interface IBukkitAdapter {
|
|||||||
*/
|
*/
|
||||||
default ItemStack adapt(BaseItemStack item) {
|
default ItemStack adapt(BaseItemStack item) {
|
||||||
checkNotNull(item);
|
checkNotNull(item);
|
||||||
if (item instanceof BukkitItemStack) return ((BukkitItemStack) item).getBukkitItemStack();
|
if (item instanceof BukkitItemStack) {
|
||||||
|
return ((BukkitItemStack) item).getBukkitItemStack();
|
||||||
|
}
|
||||||
return new ItemStack(adapt(item.getType()), item.getAmount());
|
return new ItemStack(adapt(item.getType()), item.getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ public class SimpleBukkitAdapter extends CachedBukkitAdapter {
|
|||||||
private BlockData[][] blockDataCache;
|
private BlockData[][] blockDataCache;
|
||||||
|
|
||||||
private boolean init() {
|
private boolean init() {
|
||||||
if (blockDataCache != null) return false;
|
if (blockDataCache != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
this.blockDataCache = new BlockData[BlockTypes.size()][];
|
this.blockDataCache = new BlockData[BlockTypes.size()][];
|
||||||
blockDataCache[0] = new BlockData[] {Material.AIR.createBlockData()};
|
blockDataCache[0] = new BlockData[] {Material.AIR.createBlockData()};
|
||||||
return true;
|
return true;
|
||||||
@ -42,7 +44,9 @@ public class SimpleBukkitAdapter extends CachedBukkitAdapter {
|
|||||||
}
|
}
|
||||||
return blockData;
|
return blockData;
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
if (init()) return adapt(block);
|
if (init()) {
|
||||||
|
return adapt(block);
|
||||||
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,15 @@ import com.boydti.fawe.beta.IQueueChunk;
|
|||||||
import com.boydti.fawe.beta.IQueueExtent;
|
import com.boydti.fawe.beta.IQueueExtent;
|
||||||
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
||||||
import com.boydti.fawe.beta.implementation.queue.SingleThreadQueueExtent;
|
import com.boydti.fawe.beta.implementation.queue.SingleThreadQueueExtent;
|
||||||
import com.boydti.fawe.bukkit.adapter.mc1_15_2.*;
|
import com.boydti.fawe.bukkit.adapter.mc1_15_2.BlockMaterial_1_15_2;
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_15_2.BukkitAdapter_1_15_2;
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_15_2.BukkitGetBlocks_1_15_2;
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_15_2.FAWEWorldNativeAccess_1_15_2;
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_15_2.MapChunkUtil_1_15_2;
|
||||||
import com.boydti.fawe.bukkit.adapter.mc1_15_2.nbt.LazyCompoundTag_1_15_2;
|
import com.boydti.fawe.bukkit.adapter.mc1_15_2.nbt.LazyCompoundTag_1_15_2;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.jnbt.StringTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
@ -48,11 +53,39 @@ import com.sk89q.worldedit.registry.state.Property;
|
|||||||
import com.sk89q.worldedit.util.SideEffect;
|
import com.sk89q.worldedit.util.SideEffect;
|
||||||
import com.sk89q.worldedit.util.SideEffectSet;
|
import com.sk89q.worldedit.util.SideEffectSet;
|
||||||
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.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.*;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
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.entity.EntityType;
|
import com.sk89q.worldedit.world.entity.EntityType;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import net.minecraft.server.v1_15_R1.*;
|
import net.minecraft.server.v1_15_R1.BiomeBase;
|
||||||
|
import net.minecraft.server.v1_15_R1.Block;
|
||||||
|
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_15_R1.Chunk;
|
||||||
|
import net.minecraft.server.v1_15_R1.ChunkCoordIntPair;
|
||||||
|
import net.minecraft.server.v1_15_R1.ChunkProviderServer;
|
||||||
|
import net.minecraft.server.v1_15_R1.ChunkSection;
|
||||||
|
import net.minecraft.server.v1_15_R1.Entity;
|
||||||
|
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
||||||
|
import net.minecraft.server.v1_15_R1.EntityTypes;
|
||||||
|
import net.minecraft.server.v1_15_R1.IBlockData;
|
||||||
|
import net.minecraft.server.v1_15_R1.IRegistry;
|
||||||
|
import net.minecraft.server.v1_15_R1.ItemStack;
|
||||||
|
import net.minecraft.server.v1_15_R1.MinecraftKey;
|
||||||
|
import net.minecraft.server.v1_15_R1.MinecraftServer;
|
||||||
|
import net.minecraft.server.v1_15_R1.NBTBase;
|
||||||
|
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||||
|
import net.minecraft.server.v1_15_R1.NBTTagInt;
|
||||||
|
import net.minecraft.server.v1_15_R1.PacketPlayOutMapChunk;
|
||||||
|
import net.minecraft.server.v1_15_R1.PlayerChunk;
|
||||||
|
import net.minecraft.server.v1_15_R1.TileEntity;
|
||||||
|
import net.minecraft.server.v1_15_R1.World;
|
||||||
|
import net.minecraft.server.v1_15_R1.WorldData;
|
||||||
|
import net.minecraft.server.v1_15_R1.WorldNBTStorage;
|
||||||
|
import net.minecraft.server.v1_15_R1.WorldServer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
@ -67,7 +100,6 @@ import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
@ -79,9 +111,9 @@ import java.util.concurrent.ExecutionException;
|
|||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import com.sk89q.jnbt.StringTag;
|
|
||||||
|
|
||||||
public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
|
public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
|
||||||
private final Spigot_v1_15_R2 parent;
|
private final Spigot_v1_15_R2 parent;
|
||||||
@ -101,7 +133,9 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized boolean init() {
|
private synchronized boolean init() {
|
||||||
if (ibdToStateOrdinal != null && ibdToStateOrdinal[1] != 0) return false;
|
if (ibdToStateOrdinal != null && ibdToStateOrdinal[1] != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ibdToStateOrdinal = new char[Block.REGISTRY_ID.a()]; // size
|
ibdToStateOrdinal = new char[Block.REGISTRY_ID.a()]; // size
|
||||||
for (int i = 0; i < ibdToStateOrdinal.length; i++) {
|
for (int i = 0; i < ibdToStateOrdinal.length; i++) {
|
||||||
BlockState state = BlockTypesCache.states[i];
|
BlockState state = BlockTypesCache.states[i];
|
||||||
@ -202,9 +236,13 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (existing == blockData) return true;
|
if (existing == blockData) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
if (blockData.isAir()) return true;
|
if (blockData.isAir()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
sections[y4] = section = new ChunkSection(y4 << 4);
|
sections[y4] = section = new ChunkSection(y4 << 4);
|
||||||
}
|
}
|
||||||
nmsChunk.setType(blockPos, blockData, false);
|
nmsChunk.setType(blockPos, blockData, false);
|
||||||
@ -300,7 +338,7 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I
|
|||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
init();
|
init();
|
||||||
return adaptToChar(ibd);
|
return adaptToChar(ibd);
|
||||||
} catch(ArrayIndexOutOfBoundsException e1){
|
} catch (ArrayIndexOutOfBoundsException e1) {
|
||||||
Fawe.debug("Attempted to convert " + ibd.getBlock() + " with ID " + Block.REGISTRY_ID.getId(ibd) + " to char. ibdToStateOrdinal length: " + ibdToStateOrdinal.length + ". Defaulting to air!");
|
Fawe.debug("Attempted to convert " + ibd.getBlock() + " with ID " + Block.REGISTRY_ID.getId(ibd) + " to char. ibdToStateOrdinal length: " + ibdToStateOrdinal.length + ". Defaulting to air!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -406,7 +444,7 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I
|
|||||||
originalWorld.getMethodProfiler(),
|
originalWorld.getMethodProfiler(),
|
||||||
server.worldLoadListenerFactory.create(11),
|
server.worldLoadListenerFactory.create(11),
|
||||||
env,
|
env,
|
||||||
gen){
|
gen) {
|
||||||
@Override
|
@Override
|
||||||
public boolean addEntityChunk(net.minecraft.server.v1_15_R1.Entity entity) {
|
public boolean addEntityChunk(net.minecraft.server.v1_15_R1.Entity entity) {
|
||||||
//Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously
|
//Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously
|
||||||
@ -421,10 +459,12 @@ public final class FAWE_Spigot_v1_15_R2 extends CachedBukkitAdapter implements I
|
|||||||
IQueueExtent<IQueueChunk> extent = new SingleThreadQueueExtent();
|
IQueueExtent<IQueueChunk> extent = new SingleThreadQueueExtent();
|
||||||
extent.init(null, (x, z) -> new BukkitGetBlocks_1_15_2(freshWorld, x, z) {
|
extent.init(null, (x, z) -> new BukkitGetBlocks_1_15_2(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) {
|
||||||
Future<Chunk> future = Fawe.get().getQueueHandler().sync((Supplier<Chunk>) () -> freshWorld.getChunkAt(X, Z));
|
return cached;
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
@ -88,7 +88,9 @@ public final class FAWE_Spigot_v1_16_R1 extends CachedBukkitAdapter implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized boolean init() {
|
private synchronized boolean init() {
|
||||||
if (ibdToStateOrdinal != null && ibdToStateOrdinal[1] != 0) return false;
|
if (ibdToStateOrdinal != null && ibdToStateOrdinal[1] != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ibdToStateOrdinal = new char[Block.REGISTRY_ID.a()]; // size
|
ibdToStateOrdinal = new char[Block.REGISTRY_ID.a()]; // size
|
||||||
for (int i = 0; i < ibdToStateOrdinal.length; i++) {
|
for (int i = 0; i < ibdToStateOrdinal.length; i++) {
|
||||||
BlockState state = BlockTypesCache.states[i];
|
BlockState state = BlockTypesCache.states[i];
|
||||||
@ -189,9 +191,13 @@ public final class FAWE_Spigot_v1_16_R1 extends CachedBukkitAdapter implements I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (existing == blockData) return true;
|
if (existing == blockData) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
if (blockData.isAir()) return true;
|
if (blockData.isAir()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
sections[y4] = section = new ChunkSection(y4 << 4);
|
sections[y4] = section = new ChunkSection(y4 << 4);
|
||||||
}
|
}
|
||||||
nmsChunk.setType(blockPos, blockData, false);
|
nmsChunk.setType(blockPos, blockData, false);
|
||||||
@ -287,7 +293,7 @@ public final class FAWE_Spigot_v1_16_R1 extends CachedBukkitAdapter implements I
|
|||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
init();
|
init();
|
||||||
return adaptToChar(ibd);
|
return adaptToChar(ibd);
|
||||||
} catch(ArrayIndexOutOfBoundsException e1){
|
} catch (ArrayIndexOutOfBoundsException e1) {
|
||||||
Fawe.debug("Attempted to convert " + ibd.getBlock() + " with ID " + Block.REGISTRY_ID.getId(ibd) + " to char. ibdToStateOrdinal length: " + ibdToStateOrdinal.length + ". Defaulting to air!");
|
Fawe.debug("Attempted to convert " + ibd.getBlock() + " with ID " + Block.REGISTRY_ID.getId(ibd) + " to char. ibdToStateOrdinal length: " + ibdToStateOrdinal.length + ". Defaulting to air!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -393,7 +399,7 @@ public final class FAWE_Spigot_v1_16_R1 extends CachedBukkitAdapter implements I
|
|||||||
// originalWorld.getMethodProfiler(),
|
// originalWorld.getMethodProfiler(),
|
||||||
// server.worldLoadListenerFactory.create(11),
|
// server.worldLoadListenerFactory.create(11),
|
||||||
// env,
|
// env,
|
||||||
// gen){
|
// gen) {
|
||||||
// @Override
|
// @Override
|
||||||
// public boolean addEntityChunk(Entity entity) {
|
// public boolean addEntityChunk(Entity entity) {
|
||||||
// //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously
|
// //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously
|
||||||
|
@ -23,9 +23,14 @@ import com.boydti.fawe.Fawe;
|
|||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
import com.boydti.fawe.beta.IChunkGet;
|
||||||
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
|
||||||
import com.boydti.fawe.bukkit.adapter.mc1_16_2.*;
|
import com.boydti.fawe.bukkit.adapter.mc1_16_2.BlockMaterial_1_16_2;
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_16_2.BukkitAdapter_1_16_2;
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_16_2.BukkitGetBlocks_1_16_2;
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_16_2.FAWEWorldNativeAccess_1_16;
|
||||||
|
import com.boydti.fawe.bukkit.adapter.mc1_16_2.MapChunkUtil_1_16_2;
|
||||||
import com.boydti.fawe.bukkit.adapter.mc1_16_2.nbt.LazyCompoundTag_1_16_2;
|
import com.boydti.fawe.bukkit.adapter.mc1_16_2.nbt.LazyCompoundTag_1_16_2;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.jnbt.StringTag;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
@ -42,14 +47,38 @@ import com.sk89q.worldedit.registry.state.Property;
|
|||||||
import com.sk89q.worldedit.util.SideEffect;
|
import com.sk89q.worldedit.util.SideEffect;
|
||||||
import com.sk89q.worldedit.util.SideEffectSet;
|
import com.sk89q.worldedit.util.SideEffectSet;
|
||||||
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.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.*;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
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.entity.EntityType;
|
import com.sk89q.worldedit.world.entity.EntityType;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
import net.minecraft.server.v1_16_R2.*;
|
import net.minecraft.server.v1_16_R2.BiomeBase;
|
||||||
|
import net.minecraft.server.v1_16_R2.Block;
|
||||||
|
import net.minecraft.server.v1_16_R2.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_16_R2.Chunk;
|
||||||
|
import net.minecraft.server.v1_16_R2.ChunkCoordIntPair;
|
||||||
|
import net.minecraft.server.v1_16_R2.ChunkSection;
|
||||||
|
import net.minecraft.server.v1_16_R2.Entity;
|
||||||
|
import net.minecraft.server.v1_16_R2.EntityPlayer;
|
||||||
|
import net.minecraft.server.v1_16_R2.EntityTypes;
|
||||||
|
import net.minecraft.server.v1_16_R2.IBlockData;
|
||||||
|
import net.minecraft.server.v1_16_R2.IRegistry;
|
||||||
|
import net.minecraft.server.v1_16_R2.ItemStack;
|
||||||
|
import net.minecraft.server.v1_16_R2.MinecraftKey;
|
||||||
|
import net.minecraft.server.v1_16_R2.MinecraftServer;
|
||||||
|
import net.minecraft.server.v1_16_R2.NBTBase;
|
||||||
|
import net.minecraft.server.v1_16_R2.NBTTagCompound;
|
||||||
|
import net.minecraft.server.v1_16_R2.NBTTagInt;
|
||||||
|
import net.minecraft.server.v1_16_R2.PacketPlayOutMapChunk;
|
||||||
|
import net.minecraft.server.v1_16_R2.PlayerChunk;
|
||||||
|
import net.minecraft.server.v1_16_R2.TileEntity;
|
||||||
|
import net.minecraft.server.v1_16_R2.World;
|
||||||
|
import net.minecraft.server.v1_16_R2.WorldServer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.craftbukkit.v1_16_R2.CraftChunk;
|
import org.bukkit.craftbukkit.v1_16_R2.CraftChunk;
|
||||||
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R2.CraftWorld;
|
||||||
@ -60,16 +89,15 @@ import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer;
|
|||||||
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.OptionalInt;
|
import java.util.OptionalInt;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import com.sk89q.jnbt.StringTag;
|
|
||||||
|
|
||||||
public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
|
public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter<NBTBase> {
|
||||||
private final Spigot_v1_16_R2 parent;
|
private final Spigot_v1_16_R2 parent;
|
||||||
@ -89,7 +117,9 @@ public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
private synchronized boolean init() {
|
private synchronized boolean init() {
|
||||||
if (ibdToStateOrdinal != null && ibdToStateOrdinal[1] != 0) return false;
|
if (ibdToStateOrdinal != null && ibdToStateOrdinal[1] != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ibdToStateOrdinal = new char[Block.REGISTRY_ID.a()]; // size
|
ibdToStateOrdinal = new char[Block.REGISTRY_ID.a()]; // size
|
||||||
for (int i = 0; i < ibdToStateOrdinal.length; i++) {
|
for (int i = 0; i < ibdToStateOrdinal.length; i++) {
|
||||||
BlockState state = BlockTypesCache.states[i];
|
BlockState state = BlockTypesCache.states[i];
|
||||||
@ -188,9 +218,13 @@ public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (existing == blockData) return true;
|
if (existing == blockData) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
if (blockData.isAir()) return true;
|
if (blockData.isAir()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
sections[y4] = section = new ChunkSection(y4 << 4);
|
sections[y4] = section = new ChunkSection(y4 << 4);
|
||||||
}
|
}
|
||||||
nmsChunk.setType(blockPos, blockData, false);
|
nmsChunk.setType(blockPos, blockData, false);
|
||||||
@ -231,7 +265,7 @@ public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements I
|
|||||||
Supplier<CompoundTag> saveTag = () -> {
|
Supplier<CompoundTag> saveTag = () -> {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
readEntityIntoTag(mcEntity, tag);
|
readEntityIntoTag(mcEntity, tag);
|
||||||
|
|
||||||
//add Id for AbstractChangeSet to work
|
//add Id for AbstractChangeSet to work
|
||||||
CompoundTag natve = (CompoundTag) toNative(tag);
|
CompoundTag natve = (CompoundTag) toNative(tag);
|
||||||
natve.getValue().put("Id", new StringTag(id));
|
natve.getValue().put("Id", new StringTag(id));
|
||||||
@ -286,7 +320,7 @@ public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements I
|
|||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
init();
|
init();
|
||||||
return adaptToChar(ibd);
|
return adaptToChar(ibd);
|
||||||
} catch(ArrayIndexOutOfBoundsException e1){
|
} catch (ArrayIndexOutOfBoundsException e1) {
|
||||||
Fawe.debug("Attempted to convert " + ibd.getBlock() + " with ID " + Block.REGISTRY_ID.getId(ibd) + " to char. ibdToStateOrdinal length: " + ibdToStateOrdinal.length + ". Defaulting to air!");
|
Fawe.debug("Attempted to convert " + ibd.getBlock() + " with ID " + Block.REGISTRY_ID.getId(ibd) + " to char. ibdToStateOrdinal length: " + ibdToStateOrdinal.length + ". Defaulting to air!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -392,7 +426,7 @@ public final class FAWE_Spigot_v1_16_R2 extends CachedBukkitAdapter implements I
|
|||||||
// originalWorld.getMethodProfiler(),
|
// originalWorld.getMethodProfiler(),
|
||||||
// server.worldLoadListenerFactory.create(11),
|
// server.worldLoadListenerFactory.create(11),
|
||||||
// env,
|
// env,
|
||||||
// gen){
|
// gen) {
|
||||||
// @Override
|
// @Override
|
||||||
// public boolean addEntityChunk(Entity entity) {
|
// public boolean addEntityChunk(Entity entity) {
|
||||||
// //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously
|
// //Fixes #320; Prevent adding entities so we aren't attempting to spawn them asynchronously
|
||||||
|
@ -79,70 +79,57 @@ public class Fawe {
|
|||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(Fawe.class);
|
private static final Logger log = LoggerFactory.getLogger(Fawe.class);
|
||||||
|
|
||||||
/**
|
private static Fawe instance;
|
||||||
* The FAWE instance;
|
|
||||||
*/
|
|
||||||
private static Fawe INSTANCE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TPS timer
|
* The ticks-per-second timer.
|
||||||
*/
|
*/
|
||||||
private final FaweTimer timer;
|
private final FaweTimer timer;
|
||||||
private FaweVersion version;
|
private FaweVersion version;
|
||||||
private VisualQueue visualQueue;
|
private VisualQueue visualQueue;
|
||||||
private TextureUtil textures;
|
private TextureUtil textures;
|
||||||
// TODO: Ping @MattBDev to reimplement 2020-02-04
|
|
||||||
// private DefaultTransformParser transformParser;
|
|
||||||
|
|
||||||
private QueueHandler queueHandler;
|
private QueueHandler queueHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the implementation specific class
|
* Get the implementation specific class.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <T extends IFawe> T imp() {
|
public static <T extends IFawe> T imp() {
|
||||||
return INSTANCE != null ? (T) INSTANCE.IMP : null;
|
return instance != null ? (T) instance.implementation : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the implementation independent class
|
* Get the implementation independent class.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static Fawe get() {
|
public static Fawe get() {
|
||||||
return INSTANCE;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup Fawe
|
* This method is not for public use. If you have to ask what it does then you shouldn't be using it.
|
||||||
*
|
|
||||||
* @param implementation
|
|
||||||
* @throws InstanceAlreadyExistsException
|
|
||||||
*/
|
*/
|
||||||
public static void set(final IFawe implementation) throws InstanceAlreadyExistsException, IllegalArgumentException {
|
public static void set(final IFawe implementation) throws InstanceAlreadyExistsException, IllegalArgumentException {
|
||||||
if (INSTANCE != null) {
|
if (instance != null) {
|
||||||
throw new InstanceAlreadyExistsException("FAWE has already been initialized with: " + INSTANCE.IMP);
|
throw new InstanceAlreadyExistsException("FAWE has already been initialized with: " + instance.implementation);
|
||||||
}
|
}
|
||||||
if (implementation == null) {
|
if (implementation == null) {
|
||||||
throw new IllegalArgumentException("Implementation may not be null.");
|
throw new IllegalArgumentException("Implementation may not be null.");
|
||||||
}
|
}
|
||||||
INSTANCE = new Fawe(implementation);
|
instance = new Fawe(implementation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debugPlain(String s) {
|
public static void debugPlain(String s) {
|
||||||
if (INSTANCE != null) {
|
if (instance != null) {
|
||||||
INSTANCE.IMP.debug(s);
|
instance.implementation.debug(s);
|
||||||
} else {
|
} else {
|
||||||
System.out.println(s);
|
log.debug(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write something to the console
|
* Write something to the console.
|
||||||
*
|
|
||||||
* @param s
|
|
||||||
*/
|
*/
|
||||||
public static void debug(String s) {
|
public static void debug(String s) {
|
||||||
Actor actor = Request.request().getActor();
|
Actor actor = Request.request().getActor();
|
||||||
@ -152,9 +139,9 @@ public class Fawe {
|
|||||||
}
|
}
|
||||||
debugPlain(s);
|
debugPlain(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write something to the console
|
* Write something to the console.
|
||||||
*
|
*
|
||||||
* @param c The Component to be printed
|
* @param c The Component to be printed
|
||||||
*/
|
*/
|
||||||
@ -168,24 +155,26 @@ public class Fawe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The platform specific implementation
|
* The platform specific implementation.
|
||||||
*/
|
*/
|
||||||
private final IFawe IMP;
|
private final IFawe implementation;
|
||||||
private Thread thread;
|
private Thread thread;
|
||||||
|
|
||||||
private Fawe(final IFawe implementation) {
|
private Fawe(final IFawe implementation) {
|
||||||
INSTANCE = this;
|
instance = this;
|
||||||
this.IMP = implementation;
|
this.implementation = implementation;
|
||||||
this.thread = Thread.currentThread();
|
this.thread = Thread.currentThread();
|
||||||
/*
|
/*
|
||||||
* Implementation dependent stuff
|
* Implementation dependent stuff
|
||||||
*/
|
*/
|
||||||
this.setupConfigs();
|
this.setupConfigs();
|
||||||
TaskManager.IMP = this.IMP.getTaskManager();
|
TaskManager.IMP = this.implementation.getTaskManager();
|
||||||
|
|
||||||
TaskManager.IMP.async(() -> {
|
TaskManager.IMP.async(() -> {
|
||||||
MainUtil.deleteOlder(MainUtil.getFile(IMP.getDirectory(), Settings.IMP.PATHS.HISTORY), TimeUnit.DAYS.toMillis(Settings.IMP.HISTORY.DELETE_AFTER_DAYS), false);
|
MainUtil.deleteOlder(MainUtil.getFile(this.implementation
|
||||||
MainUtil.deleteOlder(MainUtil.getFile(IMP.getDirectory(), Settings.IMP.PATHS.CLIPBOARD), TimeUnit.DAYS.toMillis(Settings.IMP.CLIPBOARD.DELETE_AFTER_DAYS), false);
|
.getDirectory(), Settings.IMP.PATHS.HISTORY), TimeUnit.DAYS.toMillis(Settings.IMP.HISTORY.DELETE_AFTER_DAYS), false);
|
||||||
|
MainUtil.deleteOlder(MainUtil.getFile(this.implementation
|
||||||
|
.getDirectory(), Settings.IMP.PATHS.CLIPBOARD), TimeUnit.DAYS.toMillis(Settings.IMP.CLIPBOARD.DELETE_AFTER_DAYS), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -197,11 +186,10 @@ public class Fawe {
|
|||||||
// Delayed worldedit setup
|
// Delayed worldedit setup
|
||||||
TaskManager.IMP.later(() -> {
|
TaskManager.IMP.later(() -> {
|
||||||
try {
|
try {
|
||||||
// TODO: Ping @MattBDev to reimplement 2020-02-04
|
|
||||||
// transformParser = new DefaultTransformParser(getWorldEdit());
|
|
||||||
visualQueue = new VisualQueue(3);
|
visualQueue = new VisualQueue(3);
|
||||||
WEManager.IMP.managers.addAll(Fawe.this.IMP.getMaskManagers());
|
WEManager.IMP.managers.addAll(Fawe.this.implementation.getMaskManagers());
|
||||||
} catch (Throwable ignored) {}
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
TaskManager.IMP.repeat(timer, 1);
|
TaskManager.IMP.repeat(timer, 1);
|
||||||
@ -214,17 +202,12 @@ public class Fawe {
|
|||||||
if (queueHandler == null) {
|
if (queueHandler == null) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (queueHandler == null) {
|
if (queueHandler == null) {
|
||||||
queueHandler = IMP.getQueueHandler();
|
queueHandler = implementation.getQueueHandler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return queueHandler;
|
return queueHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Ping @MattBDev to reimplement 2020-02-04
|
|
||||||
// public DefaultTransformParser getTransformParser() {
|
|
||||||
// return transformParser;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public TextureUtil getCachedTextureUtil(boolean randomize, int min, int max) {
|
public TextureUtil getCachedTextureUtil(boolean randomize, int min, int max) {
|
||||||
// TODO NOT IMPLEMENTED - optimize this by caching the default true/0/100 texture util
|
// TODO NOT IMPLEMENTED - optimize this by caching the default true/0/100 texture util
|
||||||
@ -257,32 +240,27 @@ public class Fawe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The FaweTimer is a useful class for monitoring TPS
|
* Gets the TPS monitor.
|
||||||
*
|
|
||||||
* @return FaweTimer
|
|
||||||
*/
|
*/
|
||||||
public FaweTimer getTimer() {
|
public FaweTimer getTimer() {
|
||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The visual queue is used to queue visualizations
|
* Get the visual queue.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public VisualQueue getVisualQueue() {
|
public VisualQueue getVisualQueue() {
|
||||||
return visualQueue;
|
return visualQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The FAWE version
|
* The FAWE version.
|
||||||
* - Unofficial jars may be lacking version information
|
|
||||||
*
|
*
|
||||||
|
* @apiNote Unofficial jars may be lacking version information
|
||||||
* @return FaweVersion
|
* @return FaweVersion
|
||||||
*/
|
*/
|
||||||
public
|
|
||||||
@Nullable
|
@Nullable
|
||||||
FaweVersion getVersion() {
|
public FaweVersion getVersion() {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,8 +271,8 @@ public class Fawe {
|
|||||||
public void setupConfigs() {
|
public void setupConfigs() {
|
||||||
MainUtil.copyFile(MainUtil.getJarFile(), "lang/strings.json", null);
|
MainUtil.copyFile(MainUtil.getJarFile(), "lang/strings.json", null);
|
||||||
// Setting up config.yml
|
// Setting up config.yml
|
||||||
File file = new File(this.IMP.getDirectory(), "config.yml");
|
File file = new File(this.implementation.getDirectory(), "config.yml");
|
||||||
Settings.IMP.PLATFORM = IMP.getPlatform().replace("\"", "");
|
Settings.IMP.PLATFORM = implementation.getPlatform().replace("\"", "");
|
||||||
try (InputStream stream = getClass().getResourceAsStream(File.separator + "fawe.properties");
|
try (InputStream stream = getClass().getResourceAsStream(File.separator + "fawe.properties");
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(stream))) {
|
BufferedReader br = new BufferedReader(new InputStreamReader(stream))) {
|
||||||
String versionString = br.readLine();
|
String versionString = br.readLine();
|
||||||
@ -305,14 +283,12 @@ public class Fawe {
|
|||||||
Settings.IMP.DATE = new Date(100 + version.year, version.month, version.day).toGMTString();
|
Settings.IMP.DATE = new Date(100 + version.year, version.month, version.day).toGMTString();
|
||||||
Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit-1.16/" + version.build;
|
Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit-1.16/" + version.build;
|
||||||
Settings.IMP.COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit/commit/" + Integer.toHexString(version.hash);
|
Settings.IMP.COMMIT = "https://github.com/IntellectualSites/FastAsyncWorldEdit/commit/" + Integer.toHexString(version.hash);
|
||||||
} catch (Throwable ignore) {}
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Settings.IMP.reload(file);
|
Settings.IMP.reload(file);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
debug("====== Failed to load config ======");
|
log.error("Failed to load config.", e);
|
||||||
debug("Please validate your yaml files:");
|
|
||||||
e.printStackTrace();
|
|
||||||
debug("====================================");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,22 +310,15 @@ public class Fawe {
|
|||||||
if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL > 6 || Settings.IMP.HISTORY.COMPRESSION_LEVEL > 6) {
|
if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL > 6 || Settings.IMP.HISTORY.COMPRESSION_LEVEL > 6) {
|
||||||
Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL);
|
Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL);
|
||||||
Settings.IMP.HISTORY.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.HISTORY.COMPRESSION_LEVEL);
|
Settings.IMP.HISTORY.COMPRESSION_LEVEL = Math.min(6, Settings.IMP.HISTORY.COMPRESSION_LEVEL);
|
||||||
debug("====== ZSTD COMPRESSION BINDING NOT FOUND ======");
|
log.error("ZSTD Compression Binding Not Found.\n"
|
||||||
debug(e.getMessage());
|
+ "FAWE will still work but compression won't work as well.\n", e);
|
||||||
debug("FAWE will work but won't compress data as much");
|
|
||||||
debug("===============================================");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
net.jpountz.util.Native.load();
|
net.jpountz.util.Native.load();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
log.error("LZ4 Compression Binding Not Found.\n"
|
||||||
debug("====== LZ4 COMPRESSION BINDING NOT FOUND ======");
|
+ "FAWE will still work but compression will be slower.\n", e);
|
||||||
debug(e.getMessage());
|
|
||||||
debug("FAWE will work but compression will be slower");
|
|
||||||
debug(" - Try updating your JVM / OS");
|
|
||||||
debug(" - Report this issue if you cannot resolve it");
|
|
||||||
debug("===============================================");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,22 +371,18 @@ public class Fawe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the main thread
|
* Get the main thread.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public Thread getMainThread() {
|
public Thread getMainThread() {
|
||||||
return this.thread;
|
return this.thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMainThread() {
|
public static boolean isMainThread() {
|
||||||
return INSTANCE == null || INSTANCE.thread == Thread.currentThread();
|
return instance == null || instance.thread == Thread.currentThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the main thread to the current thread
|
* Sets the main thread to the current thread.
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public Thread setMainThread() {
|
public Thread setMainThread() {
|
||||||
return this.thread = Thread.currentThread();
|
return this.thread = Thread.currentThread();
|
||||||
|
@ -55,19 +55,20 @@ import javax.annotation.Nullable;
|
|||||||
* FaweAPI.[some method]
|
* FaweAPI.[some method]
|
||||||
*/
|
*/
|
||||||
public class FaweAPI {
|
public class FaweAPI {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Offers a lot of options for building an EditSession
|
* Offers a lot of options for building an EditSession.
|
||||||
*
|
*
|
||||||
* @param world
|
|
||||||
* @return A new EditSessionBuilder
|
* @return A new EditSessionBuilder
|
||||||
* @see EditSessionBuilder
|
* @see EditSessionBuilder
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static EditSessionBuilder getEditSessionBuilder(World world) {
|
public static EditSessionBuilder getEditSessionBuilder(World world) {
|
||||||
return new EditSessionBuilder(world);
|
return new EditSessionBuilder(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The TaskManager has some useful methods for doing things asynchronously
|
* The TaskManager has some useful methods for doing things asynchronously.
|
||||||
*
|
*
|
||||||
* @return TaskManager
|
* @return TaskManager
|
||||||
*/
|
*/
|
||||||
@ -75,26 +76,15 @@ public class FaweAPI {
|
|||||||
return TaskManager.IMP;
|
return TaskManager.IMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Add a custom transform for use in
|
|
||||||
// *
|
|
||||||
// * @param methods The class with a bunch of transform methods
|
|
||||||
// * @return true if the transform was registered
|
|
||||||
// * @see com.sk89q.worldedit.command.TransformCommands
|
|
||||||
// */
|
|
||||||
// public static boolean registerTransforms(Object methods) {
|
|
||||||
// DefaultTransformParser parser = Fawe.get().getTransformParser();
|
|
||||||
// if (parser != null) parser.register(methods);
|
|
||||||
// return parser != null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You can either use a IQueueExtent or an EditSession to change blocks<br>
|
* You can either use a {@code IQueueExtent} or an {@code EditSession} to change blocks.
|
||||||
* - The IQueueExtent skips a bit of overhead so it's marginally faster<br>
|
|
||||||
* - The WorldEdit EditSession can do a lot more<br>
|
|
||||||
* Remember to commit when you're done!<br>
|
|
||||||
*
|
*
|
||||||
* @param world The name of the world
|
* <p>
|
||||||
|
* The {@link IQueueExtent} skips a bit of overhead, so it is marginally faster. {@link
|
||||||
|
* EditSession} can do a lot more. Remember to commit when you are done!
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param world The name of the world
|
||||||
* @param autoQueue If it should start dispatching before you enqueue it.
|
* @param autoQueue If it should start dispatching before you enqueue it.
|
||||||
* @return the queue extent
|
* @return the queue extent
|
||||||
*/
|
*/
|
||||||
@ -118,10 +108,10 @@ public class FaweAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload the clipboard to the configured web interface
|
* Upload the clipboard to the configured web interface.
|
||||||
*
|
*
|
||||||
* @param clipboard The clipboard (may not be null)
|
* @param clipboard The clipboard (may not be null)
|
||||||
* @param format The format to use (some formats may not be supported)
|
* @param format The format to use (some formats may not be supported)
|
||||||
* @return The download URL or null
|
* @return The download URL or null
|
||||||
*/
|
*/
|
||||||
public static URL upload(final Clipboard clipboard, final ClipboardFormat format) {
|
public static URL upload(final Clipboard clipboard, final ClipboardFormat format) {
|
||||||
@ -129,7 +119,7 @@ public class FaweAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just forwards to ClipboardFormat.SCHEMATIC.load(file)
|
* Just forwards to ClipboardFormat.SCHEMATIC.load(file).
|
||||||
*
|
*
|
||||||
* @param file the file to load
|
* @param file the file to load
|
||||||
* @return a clipboard containing the schematic
|
* @return a clipboard containing the schematic
|
||||||
@ -149,7 +139,7 @@ public class FaweAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the server has more than the configured low memory threshold
|
* Check if the server has more than the configured low memory threshold.
|
||||||
*
|
*
|
||||||
* @return True if the server has limited memory
|
* @return True if the server has limited memory
|
||||||
*/
|
*/
|
||||||
@ -158,28 +148,26 @@ public class FaweAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a player's allowed WorldEdit region
|
* Get a player's allowed WorldEdit region.
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static Region[] getRegions(Player player) {
|
public static Region[] getRegions(Player player) {
|
||||||
return WEManager.IMP.getMask(player);
|
return WEManager.IMP.getMask(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel the edit with the following extent<br>
|
* Cancel the edit with the following extent.
|
||||||
* - The extent must be the one being used by an EditSession, otherwise an error may be thrown <br>
|
|
||||||
* - Insert an extent into the EditSession using the EditSessionEvent: http://wiki.sk89q.com/wiki/WorldEdit/API/Hooking_EditSession <br>
|
|
||||||
*
|
*
|
||||||
* @param extent
|
* <p>
|
||||||
* @param reason
|
* The extent must be the one being used by an EditSession, otherwise an error will be thrown.
|
||||||
* @see EditSession#getRegionExtent() To get the FaweExtent for an EditSession
|
* Insert an extent into the EditSession using the EditSessionEvent.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @see EditSession#getRegionExtent() How to get the FaweExtent for an EditSession
|
||||||
*/
|
*/
|
||||||
public static void cancelEdit(AbstractDelegateExtent extent, Component reason) {
|
public static void cancelEdit(AbstractDelegateExtent extent, Component reason) {
|
||||||
try {
|
try {
|
||||||
WEManager.IMP.cancelEdit(extent, new FaweException(reason));
|
WEManager.IMP.cancelEdit(extent, new FaweException(reason));
|
||||||
} catch (WorldEditException ignore) {
|
} catch (WorldEditException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,10 +176,7 @@ public class FaweAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the DiskStorageHistory object representing a File
|
* Get the DiskStorageHistory object representing a File.
|
||||||
*
|
|
||||||
* @param file
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static DiskStorageHistory getChangeSetFromFile(File file) {
|
public static DiskStorageHistory getChangeSetFromFile(File file) {
|
||||||
if (!file.exists() || file.isDirectory()) {
|
if (!file.exists() || file.isDirectory()) {
|
||||||
@ -200,7 +185,7 @@ public class FaweAPI {
|
|||||||
if (Settings.IMP.HISTORY.USE_DISK) {
|
if (Settings.IMP.HISTORY.USE_DISK) {
|
||||||
throw new IllegalArgumentException("History on disk not enabled!");
|
throw new IllegalArgumentException("History on disk not enabled!");
|
||||||
}
|
}
|
||||||
if (!file.getName().toLowerCase().endsWith(".bd")) {
|
if (!file.getName().toLowerCase(Locale.ROOT).endsWith(".bd")) {
|
||||||
throw new IllegalArgumentException("Not a BD file!");
|
throw new IllegalArgumentException("Not a BD file!");
|
||||||
}
|
}
|
||||||
String[] path = file.getPath().split(File.separator);
|
String[] path = file.getPath().split(File.separator);
|
||||||
@ -223,16 +208,18 @@ public class FaweAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used in the RollBack to generate a list of DiskStorageHistory objects<br>
|
* Used in the rollback to generate a list of {@link DiskStorageHistory} objects.
|
||||||
* - Note: An edit outside the radius may be included if it overlaps with an edit inside that depends on it.
|
|
||||||
*
|
*
|
||||||
* @param origin - The origin location
|
* @param origin - The origin location
|
||||||
* @param user - The uuid (may be null)
|
* @param user - The uuid (may be null)
|
||||||
* @param radius - The radius from the origin of the edit
|
* @param radius - The radius from the origin of the edit
|
||||||
* @param timediff - The max age of the file in milliseconds
|
* @param timediff - The max age of the file in milliseconds
|
||||||
* @param shallow - If shallow is true, FAWE will only read the first Settings.IMP.BUFFER_SIZE bytes to obtain history info<br>
|
* @param shallow - If shallow is true, FAWE will only read the first {@link
|
||||||
* Reading only part of the file will result in unreliable bounds info for large edits
|
* Settings.HISTORY#BUFFER_SIZE} bytes to obtain history info
|
||||||
* @return a list of DiskStorageHistory Objects
|
* @return a list of DiskStorageHistory Objects
|
||||||
|
* @apiNote An edit outside the radius may be included if it overlaps with an edit inside
|
||||||
|
* that depends on it. Reading only part of the file will result in unreliable bounds info
|
||||||
|
* for large edits.
|
||||||
*/
|
*/
|
||||||
public static List<DiskStorageHistory> getBDFiles(Location origin, UUID user, int radius, long timediff, boolean shallow) {
|
public static List<DiskStorageHistory> getBDFiles(Location origin, UUID user, int radius, long timediff, boolean shallow) {
|
||||||
Extent extent = origin.getExtent();
|
Extent extent = origin.getExtent();
|
||||||
@ -312,35 +299,19 @@ public class FaweAPI {
|
|||||||
/**
|
/**
|
||||||
* The DiskStorageHistory class is what FAWE uses to represent the undo on disk.
|
* The DiskStorageHistory class is what FAWE uses to represent the undo on disk.
|
||||||
*
|
*
|
||||||
* @param world
|
|
||||||
* @param uuid
|
|
||||||
* @param index
|
|
||||||
* @return
|
|
||||||
* @see DiskStorageHistory#toEditSession(Player)
|
|
||||||
*/
|
*/
|
||||||
public static DiskStorageHistory getChangeSetFromDisk(World world, UUID uuid, int index) {
|
public static DiskStorageHistory getChangeSetFromDisk(World world, UUID uuid, int index) {
|
||||||
return new DiskStorageHistory(world, uuid, index);
|
return new DiskStorageHistory(world, uuid, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two versions
|
* Fix the lighting in a selection. This is a multi-step process as outlined below.
|
||||||
*
|
*
|
||||||
* @param version
|
* <ol>
|
||||||
* @param major
|
* <li>Removes all lighting, then relights.</li>
|
||||||
* @param minor
|
* <li>Relights in parallel (if enabled) for best performance.</li>
|
||||||
* @param minor2
|
* <li>Resends the chunks to the client.</li>
|
||||||
* @return true if version is >= major, minor, minor2
|
* </ol>
|
||||||
*/
|
|
||||||
public static boolean checkVersion(final int[] version, final int major, final int minor, final int minor2) {
|
|
||||||
return (version[0] > major) || ((version[0] == major) && (version[1] > minor)) || ((version[0] == major) && (version[1] == minor) && (version[2] >= minor2));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fix the lighting in a selection<br>
|
|
||||||
* - First removes all lighting, then relights
|
|
||||||
* - Relights in parallel (if enabled) for best performance<br>
|
|
||||||
* - Also resends chunks<br>
|
|
||||||
*
|
*
|
||||||
* @param world World to relight in
|
* @param world World to relight in
|
||||||
* @param selection Region to relight
|
* @param selection Region to relight
|
||||||
@ -395,26 +366,19 @@ public class FaweAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Have a task run when the server is low on memory (configured threshold)
|
* Runs a task when the server is low on memory.
|
||||||
*
|
|
||||||
* @param run
|
|
||||||
*/
|
*/
|
||||||
public static void addMemoryLimitedTask(Runnable run) {
|
public static void addMemoryLimitedTask(Runnable run) {
|
||||||
MemUtil.addMemoryLimitedTask(run);
|
MemUtil.addMemoryLimitedTask(run);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Have a task run when the server is no longer low on memory (configured threshold)
|
* Runs a task when the server is no longer low on memory.
|
||||||
*
|
|
||||||
* @param run
|
|
||||||
*/
|
*/
|
||||||
public static void addMemoryPlentifulTask(Runnable run) {
|
public static void addMemoryPlentifulTask(Runnable run) {
|
||||||
MemUtil.addMemoryPlentifulTask(run);
|
MemUtil.addMemoryPlentifulTask(run);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Map of translation ket to value
|
|
||||||
*/
|
|
||||||
public static Map<String, String> getTranslations(Locale locale) {
|
public static Map<String, String> getTranslations(Locale locale) {
|
||||||
return WorldEdit.getInstance().getTranslationManager().getTranslationMap(locale);
|
return WorldEdit.getInstance().getTranslationManager().getTranslationMap(locale);
|
||||||
}
|
}
|
||||||
|
@ -312,8 +312,6 @@ public enum FaweCache implements Trimable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert raw int array to unstretched palette (1.16)
|
* Convert raw int array to unstretched palette (1.16)
|
||||||
* @param layerOffset
|
|
||||||
* @param blocks
|
|
||||||
* @return palette
|
* @return palette
|
||||||
*/
|
*/
|
||||||
public Palette toPaletteUnstretched(int layerOffset, int[] blocks) {
|
public Palette toPaletteUnstretched(int layerOffset, int[] blocks) {
|
||||||
@ -518,7 +516,9 @@ public enum FaweCache implements Trimable {
|
|||||||
}
|
}
|
||||||
list.add(tag);
|
list.add(tag);
|
||||||
}
|
}
|
||||||
if (clazz == null) clazz = EndTag.class;
|
if (clazz == null) {
|
||||||
|
clazz = EndTag.class;
|
||||||
|
}
|
||||||
return new ListTag(clazz, list);
|
return new ListTag(clazz, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,7 +532,9 @@ public enum FaweCache implements Trimable {
|
|||||||
}
|
}
|
||||||
list.add(tag);
|
list.add(tag);
|
||||||
}
|
}
|
||||||
if (clazz == null) clazz = EndTag.class;
|
if (clazz == null) {
|
||||||
|
clazz = EndTag.class;
|
||||||
|
}
|
||||||
return new ListTag(clazz, list);
|
return new ListTag(clazz, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,9 +545,9 @@ public enum FaweCache implements Trimable {
|
|||||||
int nThreads = Settings.IMP.QUEUE.PARALLEL_THREADS;
|
int nThreads = Settings.IMP.QUEUE.PARALLEL_THREADS;
|
||||||
ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(nThreads);
|
ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(nThreads);
|
||||||
return new ThreadPoolExecutor(nThreads, nThreads,
|
return new ThreadPoolExecutor(nThreads, nThreads,
|
||||||
0L, TimeUnit.MILLISECONDS, queue
|
0L, TimeUnit.MILLISECONDS, queue,
|
||||||
, Executors.defaultThreadFactory(),
|
Executors.defaultThreadFactory(),
|
||||||
new ThreadPoolExecutor.CallerRunsPolicy()) {
|
new ThreadPoolExecutor.CallerRunsPolicy()) {
|
||||||
protected void afterExecute(Runnable r, Throwable t) {
|
protected void afterExecute(Runnable r, Throwable t) {
|
||||||
try {
|
try {
|
||||||
super.afterExecute(r, t);
|
super.afterExecute(r, t);
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
package com.boydti.fawe;
|
package com.boydti.fawe;
|
||||||
|
|
||||||
public class FaweVersion {
|
public class FaweVersion {
|
||||||
public final int year, month, day, hash, build;
|
public final int year;
|
||||||
|
public final int month;
|
||||||
|
public final int day;
|
||||||
|
public final int hash;
|
||||||
|
public final int build;
|
||||||
|
|
||||||
public FaweVersion(int year, int month, int day, int hash, int build) {
|
public FaweVersion(int year, int month, int day, int hash, int build) {
|
||||||
this.year = year;
|
this.year = year;
|
||||||
|
@ -18,8 +18,8 @@ public class CombinedBlocks implements IBlocks {
|
|||||||
private final int addMask;
|
private final int addMask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param secondary
|
* TODO Add a constructor here to satisfy checkstyle.
|
||||||
* @param primary
|
*
|
||||||
* @param addMask - bitMask for force sending sections, else 0 to send the primary ones
|
* @param addMask - bitMask for force sending sections, else 0 to send the primary ones
|
||||||
*/
|
*/
|
||||||
public CombinedBlocks(IBlocks secondary, IBlocks primary, int addMask) {
|
public CombinedBlocks(IBlocks secondary, IBlocks primary, int addMask) {
|
||||||
@ -92,11 +92,15 @@ public class CombinedBlocks implements IBlocks {
|
|||||||
BlockVector3 pos = entry.getKey();
|
BlockVector3 pos = entry.getKey();
|
||||||
BlockState block = primary.getBlock(pos.getX(), pos.getY(), pos.getZ());
|
BlockState block = primary.getBlock(pos.getX(), pos.getY(), pos.getZ());
|
||||||
if (block.getBlockType() == BlockTypes.__RESERVED__) {
|
if (block.getBlockType() == BlockTypes.__RESERVED__) {
|
||||||
if (copy == null) copy = new HashMap<>(tiles);
|
if (copy == null) {
|
||||||
|
copy = new HashMap<>(tiles);
|
||||||
|
}
|
||||||
copy.put(pos, entry.getValue());
|
copy.put(pos, entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (copy != null) return copy;
|
if (copy != null) {
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tiles;
|
return tiles;
|
||||||
@ -116,8 +120,12 @@ public class CombinedBlocks implements IBlocks {
|
|||||||
Set<CompoundTag> joined = primary.getEntities();
|
Set<CompoundTag> joined = primary.getEntities();
|
||||||
if (primary != secondary) {
|
if (primary != secondary) {
|
||||||
Set<CompoundTag> ents2 = secondary.getEntities();
|
Set<CompoundTag> ents2 = secondary.getEntities();
|
||||||
if (joined.isEmpty()) return ents2;
|
if (joined.isEmpty()) {
|
||||||
if (ents2.isEmpty()) return joined;
|
return ents2;
|
||||||
|
}
|
||||||
|
if (ents2.isEmpty()) {
|
||||||
|
return joined;
|
||||||
|
}
|
||||||
joined = new HashSet<>(joined);
|
joined = new HashSet<>(joined);
|
||||||
joined.addAll(ents2);
|
joined.addAll(ents2);
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,9 @@ import java.util.concurrent.Future;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public interface IBatchProcessor {
|
public interface IBatchProcessor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a chunk that has been set
|
* Process a chunk that has been set.
|
||||||
* @param chunk
|
|
||||||
* @param get
|
|
||||||
* @param set
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set);
|
IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set);
|
||||||
|
|
||||||
@ -31,18 +28,13 @@ public interface IBatchProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert this processor into an Extent based processor instead of a queue batch based on
|
* Convert this processor into an Extent based processor instead of a queue batch based on.
|
||||||
* @param child
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
Extent construct(Extent child);
|
Extent construct(Extent child);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to trim a chunk based on min and max Y
|
* Utility method to trim a chunk based on min and max Y.
|
||||||
* @param set
|
|
||||||
* @param minY
|
|
||||||
* @param maxY
|
|
||||||
* @return false if chunk is empty of blocks
|
* @return false if chunk is empty of blocks
|
||||||
*/
|
*/
|
||||||
default boolean trimY(IChunkSet set, int minY, int maxY) {
|
default boolean trimY(IChunkSet set, int minY, int maxY) {
|
||||||
@ -52,7 +44,9 @@ public interface IBatchProcessor {
|
|||||||
if (layer == minLayer) {
|
if (layer == minLayer) {
|
||||||
char[] arr = set.load(layer);
|
char[] arr = set.load(layer);
|
||||||
int index = (minY & 15) << 8;
|
int index = (minY & 15) << 8;
|
||||||
for (int i = 0; i < index; i++) arr[i] = 0;
|
for (int i = 0; i < index; i++) {
|
||||||
|
arr[i] = 0;
|
||||||
|
}
|
||||||
set.setBlocks(layer, arr);
|
set.setBlocks(layer, arr);
|
||||||
} else {
|
} else {
|
||||||
set.setBlocks(layer, null);
|
set.setBlocks(layer, null);
|
||||||
@ -65,7 +59,9 @@ public interface IBatchProcessor {
|
|||||||
if (layer == minLayer) {
|
if (layer == minLayer) {
|
||||||
char[] arr = set.load(layer);
|
char[] arr = set.load(layer);
|
||||||
int index = ((maxY + 1) & 15) << 8;
|
int index = ((maxY + 1) & 15) << 8;
|
||||||
for (int i = index; i < arr.length; i++) arr[i] = 0;
|
for (int i = index; i < arr.length; i++) {
|
||||||
|
arr[i] = 0;
|
||||||
|
}
|
||||||
set.setBlocks(layer, arr);
|
set.setBlocks(layer, arr);
|
||||||
} else {
|
} else {
|
||||||
set.setBlocks(layer, null);
|
set.setBlocks(layer, null);
|
||||||
@ -91,9 +87,8 @@ public interface IBatchProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to trim entity and blocks with a provided contains function
|
* Utility method to trim entity and blocks with a provided contains function.
|
||||||
* @param set
|
*
|
||||||
* @param contains
|
|
||||||
* @return false if chunk is empty of NBT
|
* @return false if chunk is empty of NBT
|
||||||
*/
|
*/
|
||||||
default boolean trimNBT(IChunkSet set, Function<BlockVector3, Boolean> contains) {
|
default boolean trimNBT(IChunkSet set, Function<BlockVector3, Boolean> contains) {
|
||||||
@ -110,9 +105,7 @@ public interface IBatchProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join two processors and return the result
|
* Join two processors and return the result.
|
||||||
* @param other
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
default IBatchProcessor join(IBatchProcessor other) {
|
default IBatchProcessor join(IBatchProcessor other) {
|
||||||
return MultiBatchProcessor.of(this, other);
|
return MultiBatchProcessor.of(this, other);
|
||||||
@ -122,13 +115,11 @@ public interface IBatchProcessor {
|
|||||||
return MultiBatchProcessor.of(this, other);
|
return MultiBatchProcessor.of(this, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void flush() {}
|
default void flush() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new processor after removing all are instances of a specified class
|
* Return a new processor after removing all are instances of a specified class.
|
||||||
* @param clazz
|
|
||||||
* @param <T>
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
default <T extends IBatchProcessor> IBatchProcessor remove(Class<T> clazz) {
|
default <T extends IBatchProcessor> IBatchProcessor remove(Class<T> clazz) {
|
||||||
if (clazz.isInstance(this)) {
|
if (clazz.isInstance(this)) {
|
||||||
|
@ -19,7 +19,7 @@ import java.util.Set;
|
|||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A shared interface for IGetBlocks and ISetBlocks
|
* A shared interface for IGetBlocks and ISetBlocks.
|
||||||
*/
|
*/
|
||||||
public interface IBlocks extends Trimable {
|
public interface IBlocks extends Trimable {
|
||||||
|
|
||||||
|
@ -75,16 +75,16 @@ public interface IChunkSet extends IBlocks, OutputExtent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Default to avoid tricky child classes. We only need it in a few cases anyway.
|
// Default to avoid tricky child classes. We only need it in a few cases anyway.
|
||||||
default void setFastMode(boolean fastMode){}
|
default void setFastMode(boolean fastMode) {}
|
||||||
|
|
||||||
default boolean isFastMode() {
|
default boolean isFastMode() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow setting for bitmask for flushing lighting. Default to avoid tricky child classes.
|
// Allow setting for bitmask for flushing lighting. Default to avoid tricky child classes.
|
||||||
default void setBitMask(int bitMask){}
|
default void setBitMask(int bitMask) {}
|
||||||
|
|
||||||
default int getBitMask(){
|
default int getBitMask() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,16 +49,16 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
|||||||
void init(Extent extent, IChunkCache<IChunkGet> get, IChunkCache<IChunkSet> set);
|
void init(Extent extent, IChunkCache<IChunkGet> get, IChunkCache<IChunkSet> set);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the cached get object
|
* Get the cached get object. This is faster than getting the object using NMS and allows for
|
||||||
* - Faster than getting it using NMS and allows for wrapping
|
* wrapping.
|
||||||
* @param x
|
* @param chunkX
|
||||||
* @param z
|
* @param chunkZ
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
IChunkGet getCachedGet(@Range(from = 0, to = 15) int x, @Range(from = 0, to = 15) int z);
|
IChunkGet getCachedGet(@Range(from = 0, to = 15) int chunkX, @Range(from = 0, to = 15) int chunkZ);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the cached chunk set object
|
* Get the cached chunk set object.
|
||||||
* @param chunkX
|
* @param chunkX
|
||||||
* @param chunkZ
|
* @param chunkZ
|
||||||
* @return
|
* @return
|
||||||
@ -88,19 +88,18 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
|||||||
boolean isFastMode();
|
boolean isFastMode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new root IChunk object<br> - Full chunks will be reused, so a more optimized chunk
|
* Create a new root IChunk object. Full chunks will be reused, so a more optimized chunk can be
|
||||||
* can be returned in that case<br> - Don't wrap the chunk, that should be done in {@link
|
* returned in that case.
|
||||||
* #wrap(T)}
|
|
||||||
*
|
*
|
||||||
|
* @apiNote Don't wrap the chunk, that should be done in {@link IQueueExtent#wrap(IChunk)}
|
||||||
* @param isFull true if a more optimized chunk should be returned
|
* @param isFull true if a more optimized chunk should be returned
|
||||||
* @return a more optimized chunk object
|
* @return a more optimized chunk object
|
||||||
*/
|
*/
|
||||||
T create(boolean isFull);
|
T create(boolean isFull);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap the chunk object (i.e., for region restrictions / limits etc.)
|
* Wrap the chunk object (i.e., for region restrictions / limits etc.).
|
||||||
*
|
*
|
||||||
* @param root
|
|
||||||
* @return wrapped chunk
|
* @return wrapped chunk
|
||||||
*/
|
*/
|
||||||
default T wrap(T root) {
|
default T wrap(T root) {
|
||||||
@ -115,15 +114,15 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush all changes to the world - Best to call this async so it doesn't hang the server
|
* Flush all changes to the world.
|
||||||
|
* @apiNote Best to call this async, so it doesn't hang the server.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A filter block is used to iterate over blocks / positions
|
* A filter block is used to iterate over blocks / positions. Essentially combines BlockVector3,
|
||||||
* - Essentially combines BlockVector3, Extent and BlockState functions in a way that avoids lookups
|
* Extent and BlockState functions in a way that avoids lookups.
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
ChunkFilterBlock initFilterBlock();
|
ChunkFilterBlock initFilterBlock();
|
||||||
|
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
package com.boydti.fawe.beta;
|
package com.boydti.fawe.beta;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for objects that can be trimmed (memory related)<br> - Trimming will reduce its memory
|
* Interface for objects that can be trimmed (memory related). Trimming will reduce its memory
|
||||||
* footprint
|
* footprint.
|
||||||
*/
|
*/
|
||||||
public interface Trimable {
|
public interface Trimable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trims the object, reducing its memory footprint
|
* Trims the object, reducing its memory footprint.
|
||||||
*
|
*
|
||||||
* @param aggressive if trimming should be aggressive e.g., Not return early when the first
|
* @param aggressive if trimming should be aggressive e.g., Not returning early when the first
|
||||||
* element cannot be trimmed
|
* element cannot be trimmed
|
||||||
* @return if this object is empty at the end of the trim, and can therefore be deleted
|
* @return if this object is empty at the end of the trim, and can therefore be deleted
|
||||||
*/
|
*/
|
||||||
boolean trim(boolean aggressive);
|
boolean trim(boolean aggressive);
|
||||||
|
|
||||||
default void recycle() {}
|
default void recycle() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,19 +68,33 @@ public class BitSetBlocks implements IChunkSet {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void setBlockLight(int x, int y, int z, int value) {}
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void setSkyLight(int x, int y, int z, int value) {}
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void setHeightMap(HeightMapType type, int[] heightMap) {}
|
@Override
|
||||||
|
public void setHeightMap(HeightMapType type, int[] heightMap) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void setLightLayer(int layer, char[] toSet) {}
|
@Override
|
||||||
|
public void setLightLayer(int layer, char[] toSet) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void setSkyLightLayer(int layer, char[] toSet) {}
|
@Override
|
||||||
|
public void setSkyLightLayer(int layer, char[] toSet) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void removeSectionLighting(int layer, boolean sky) {}
|
@Override
|
||||||
|
public void removeSectionLighting(int layer, boolean sky) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override public void setFullBright(int layer) {}
|
@Override
|
||||||
|
public void setFullBright(int layer) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEntity(CompoundTag tag) {
|
public void setEntity(CompoundTag tag) {
|
||||||
@ -134,11 +148,13 @@ public class BitSetBlocks implements IChunkSet {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public char[][] getLight() {
|
@Override
|
||||||
|
public char[][] getLight() {
|
||||||
return new char[0][];
|
return new char[0][];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public char[][] getSkyLight() {
|
@Override
|
||||||
|
public char[][] getSkyLight() {
|
||||||
return new char[0][];
|
return new char[0][];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ public abstract class CharBlocks implements IBlocks {
|
|||||||
sections[layer].set(this, layer, index, value);
|
sections[layer].set(this, layer, index, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class Section {
|
public abstract static class Section {
|
||||||
|
|
||||||
public abstract char[] get(CharBlocks blocks, @Range(from = 0, to = 15) int layer);
|
public abstract char[] get(CharBlocks blocks, @Range(from = 0, to = 15) int layer);
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import java.util.stream.IntStream;
|
|||||||
|
|
||||||
public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
||||||
private static final Pool<CharSetBlocks> POOL = FaweCache.IMP.registerPool(CharSetBlocks.class, CharSetBlocks::new, Settings.IMP.QUEUE.POOL);
|
private static final Pool<CharSetBlocks> POOL = FaweCache.IMP.registerPool(CharSetBlocks.class, CharSetBlocks::new, Settings.IMP.QUEUE.POOL);
|
||||||
|
|
||||||
public static CharSetBlocks newInstance() {
|
public static CharSetBlocks newInstance() {
|
||||||
return POOL.poll();
|
return POOL.poll();
|
||||||
}
|
}
|
||||||
@ -38,7 +39,8 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
private boolean fastMode = false;
|
private boolean fastMode = false;
|
||||||
private int bitMask = -1;
|
private int bitMask = -1;
|
||||||
|
|
||||||
private CharSetBlocks() {}
|
private CharSetBlocks() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recycle() {
|
public void recycle() {
|
||||||
@ -52,7 +54,9 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiomeType(int x, int y, int z) {
|
public BiomeType getBiomeType(int x, int y, int z) {
|
||||||
if (biomes == null) return null;
|
if (biomes == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return biomes[(z << 4) | x];
|
return biomes[(z << 4) | x];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +217,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||||
return setBiome(position.getX(),position.getY(), position.getZ(), biome);
|
return setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,7 +24,8 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
public class FallbackChunkGet implements IChunkGet {
|
public class FallbackChunkGet implements IChunkGet {
|
||||||
private final int bx, bz;
|
private final int bx;
|
||||||
|
private final int bz;
|
||||||
private final Extent extent;
|
private final Extent extent;
|
||||||
|
|
||||||
public FallbackChunkGet(Extent extent, int chunkX, int chunkZ) {
|
public FallbackChunkGet(Extent extent, int chunkX, int chunkZ) {
|
||||||
@ -32,6 +33,7 @@ public class FallbackChunkGet implements IChunkGet {
|
|||||||
this.bx = chunkX << 4;
|
this.bx = chunkX << 4;
|
||||||
this.bz = chunkZ << 4;
|
this.bz = chunkZ << 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getFullBlock(int x, int y, int z) {
|
public BaseBlock getFullBlock(int x, int y, int z) {
|
||||||
return extent.getFullBlock(bx + x, y, bz + z);
|
return extent.getFullBlock(bx + x, y, bz + z);
|
||||||
|
@ -20,7 +20,7 @@ public class ChunkCache<T extends Trimable> implements IChunkCache<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get or create the IGetBlocks
|
* Get or create the IGetBlocks.
|
||||||
*
|
*
|
||||||
* @return cached IGetBlocks
|
* @return cached IGetBlocks
|
||||||
*/
|
*/
|
||||||
|
@ -45,7 +45,9 @@ public class AsyncPreloader implements Preloader, Runnable {
|
|||||||
@Override
|
@Override
|
||||||
public void update(Player player) {
|
public void update(Player player) {
|
||||||
LocalSession session = WorldEdit.getInstance().getSessionManager().getIfPresent(player);
|
LocalSession session = WorldEdit.getInstance().getSessionManager().getIfPresent(player);
|
||||||
if (session == null) return;
|
if (session == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
MutablePair<World, Set<BlockVector2>> existing = cancelAndGet(player);
|
MutablePair<World, Set<BlockVector2>> existing = cancelAndGet(player);
|
||||||
try {
|
try {
|
||||||
@ -67,7 +69,8 @@ public class AsyncPreloader implements Preloader, Runnable {
|
|||||||
update.notify();
|
update.notify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IncompleteRegionException ignore){}
|
} catch (IncompleteRegionException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,7 +28,7 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract {@link IChunk} class that implements basic get/set blocks
|
* An abstract {@link IChunk} class that implements basic get/set blocks.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
||||||
@ -189,7 +189,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFullBright(ChunkHolder chunk, int layer){
|
public void setFullBright(ChunkHolder chunk, int layer) {
|
||||||
chunk.chunkSet.setFullBright(layer);
|
chunk.chunkSet.setFullBright(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFullBright(ChunkHolder chunk, int layer){
|
public void setFullBright(ChunkHolder chunk, int layer) {
|
||||||
chunk.getOrCreateSet();
|
chunk.getOrCreateSet();
|
||||||
chunk.delegate = BOTH;
|
chunk.delegate = BOTH;
|
||||||
chunk.setFullBright(layer);
|
chunk.setFullBright(layer);
|
||||||
@ -425,7 +425,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFullBright(ChunkHolder chunk, int layer){
|
public void setFullBright(ChunkHolder chunk, int layer) {
|
||||||
chunk.chunkSet.setFullBright(layer);
|
chunk.chunkSet.setFullBright(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,7 +603,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFullBright(ChunkHolder chunk, int layer){
|
public void setFullBright(ChunkHolder chunk, int layer) {
|
||||||
chunk.getOrCreateSet();
|
chunk.getOrCreateSet();
|
||||||
chunk.delegate = SET;
|
chunk.delegate = SET;
|
||||||
chunk.setFullBright(layer);
|
chunk.setFullBright(layer);
|
||||||
@ -812,7 +812,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the extent this chunk is in
|
* Get the extent this chunk is in.
|
||||||
*/
|
*/
|
||||||
public IQueueExtent<? extends IChunk> getExtent() {
|
public IQueueExtent<? extends IChunk> getExtent() {
|
||||||
return extent;
|
return extent;
|
||||||
@ -911,6 +911,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
|||||||
|
|
||||||
public interface IBlockDelegate {
|
public interface IBlockDelegate {
|
||||||
<C extends Future<C>> IChunkGet get(ChunkHolder<C> chunk);
|
<C extends Future<C>> IChunkGet get(ChunkHolder<C> chunk);
|
||||||
|
|
||||||
IChunkSet set(ChunkHolder chunk);
|
IChunkSet set(ChunkHolder chunk);
|
||||||
|
|
||||||
boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome);
|
boolean setBiome(ChunkHolder chunk, int x, int y, int z, BiomeType biome);
|
||||||
|
@ -14,12 +14,12 @@ public final class LinkedFilter<T extends Filter, S extends Filter> extends Dele
|
|||||||
|
|
||||||
private final S child;
|
private final S child;
|
||||||
|
|
||||||
public LinkedFilter(T parent, S child){
|
public LinkedFilter(T parent, S child) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.child = child;
|
this.child = child;
|
||||||
}
|
}
|
||||||
|
|
||||||
public S getChild(){
|
public S getChild() {
|
||||||
return this.child;
|
return this.child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class MaskFilter<T extends Filter> extends DelegateFilter<T> {
|
|||||||
*
|
*
|
||||||
* @return number of blocks which passed the Mask test and were applied to
|
* @return number of blocks which passed the Mask test and were applied to
|
||||||
*/
|
*/
|
||||||
public int getBlocksApplied(){
|
public int getBlocksApplied() {
|
||||||
return this.changes.get();
|
return this.changes.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,11 +54,6 @@ public abstract class AbstractFilterBlock extends FilterBlock {
|
|||||||
return getFullBlock().toBlockState();
|
return getFullBlock().toBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBlock(BlockState state) {
|
|
||||||
setFullBlock(state.toBaseBlock(getBlock().getNbtData()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getNbtData() {
|
public CompoundTag getNbtData() {
|
||||||
return getFullBlock().getNbtData();
|
return getFullBlock().getNbtData();
|
||||||
@ -79,6 +74,11 @@ public abstract class AbstractFilterBlock extends FilterBlock {
|
|||||||
return BlockVector3.at(getX(), getY(), getZ());
|
return BlockVector3.at(getX(), getY(), getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlock(BlockState state) {
|
||||||
|
setFullBlock(state.toBaseBlock(getBlock().getNbtData()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
|
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
@ -16,8 +16,11 @@ public class ArrayFilterBlock extends AbstractExtentFilterBlock {
|
|||||||
private final char[] blocks;
|
private final char[] blocks;
|
||||||
private final byte[] heights;
|
private final byte[] heights;
|
||||||
private final int yOffset;
|
private final int yOffset;
|
||||||
private final int width, length;
|
private final int width;
|
||||||
private int x, z, index;
|
private final int length;
|
||||||
|
private int x;
|
||||||
|
private int z;
|
||||||
|
private int index;
|
||||||
|
|
||||||
public ArrayFilterBlock(Extent extent, char[] blocks, byte[] heights, int width, int length,
|
public ArrayFilterBlock(Extent extent, char[] blocks, byte[] heights, int width, int length,
|
||||||
int yOffset) {
|
int yOffset) {
|
||||||
@ -51,11 +54,6 @@ public class ArrayFilterBlock extends AbstractExtentFilterBlock {
|
|||||||
return BlockTypesCache.states[getOrdinal()];
|
return BlockTypesCache.states[getOrdinal()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setBlock(BlockState state) {
|
|
||||||
blocks[index] = state.getOrdinalChar();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getFullBlock() {
|
public BaseBlock getFullBlock() {
|
||||||
return getBlock().toBaseBlock();
|
return getBlock().toBaseBlock();
|
||||||
@ -90,14 +88,19 @@ public class ArrayFilterBlock extends AbstractExtentFilterBlock {
|
|||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlock(BlockState state) {
|
||||||
|
blocks[index] = state.getOrdinalChar();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
|
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
return getExtent().setBlock(x,y, z, block);
|
return getExtent().setBlock(x, y, z, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||||
return getExtent().setBiome(x,y, z,biome);
|
return getExtent().setBiome(x, y, z, biome);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,20 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
|||||||
private CharGetBlocks get;
|
private CharGetBlocks get;
|
||||||
private IChunkSet set;
|
private IChunkSet set;
|
||||||
private char[] getArr;
|
private char[] getArr;
|
||||||
private @Nullable char[] setArr;
|
@Nullable
|
||||||
|
private char[] setArr;
|
||||||
private SetDelegate delegate;
|
private SetDelegate delegate;
|
||||||
// local
|
// local
|
||||||
private int layer, index, x, y, z, xx, yy, zz, chunkX, chunkZ;
|
private int layer;
|
||||||
|
private int index;
|
||||||
|
private int x;
|
||||||
|
private int y;
|
||||||
|
private int z;
|
||||||
|
private int xx;
|
||||||
|
private int yy;
|
||||||
|
private int zz;
|
||||||
|
private int chunkX;
|
||||||
|
private int chunkZ;
|
||||||
|
|
||||||
public CharFilterBlock(Extent extent) {
|
public CharFilterBlock(Extent extent) {
|
||||||
super(extent);
|
super(extent);
|
||||||
@ -107,8 +117,8 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void filter(Filter filter, int yStart, int yEnd) {
|
public void filter(Filter filter, int startY, int endY) {
|
||||||
for (y = yStart, index = yStart << 8; y <= yEnd; y++) {
|
for (y = startY, index = startY << 8; y <= endY; y++) {
|
||||||
for (z = 0; z < 16; z++) {
|
for (z = 0; z < 16; z++) {
|
||||||
for (x = 0; x < 16; x++, index++) {
|
for (x = 0; x < 16; x++, index++) {
|
||||||
filter.applyBlock(this);
|
filter.applyBlock(this);
|
||||||
|
@ -23,21 +23,12 @@ public abstract class ChunkFilterBlock extends AbstractExtentFilterBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize with chunk coordinates
|
* Initialize with chunk coordinates. The layer must also be initialized.
|
||||||
* - The layer must also be initialized
|
|
||||||
* @param chunkX
|
|
||||||
* @param chunkZ
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract ChunkFilterBlock initChunk(int chunkX, int chunkZ);
|
public abstract ChunkFilterBlock initChunk(int chunkX, int chunkZ);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a chunk layer
|
* Initialize a chunk layer. the Chunk coordinates need to be initialized first.
|
||||||
* - The chunk coordinates must also be initialized first
|
|
||||||
* @param iget
|
|
||||||
* @param iset
|
|
||||||
* @param layer
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public abstract ChunkFilterBlock initLayer(IBlocks iget, IChunkSet iset, int layer);
|
public abstract ChunkFilterBlock initLayer(IBlocks iget, IChunkSet iset, int layer);
|
||||||
|
|
||||||
@ -46,55 +37,33 @@ public abstract class ChunkFilterBlock extends AbstractExtentFilterBlock {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter a single block
|
* Filter a single block.
|
||||||
* @param filter
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
*/
|
*/
|
||||||
public abstract void filter(Filter filter, int x, int y, int z);
|
public abstract void filter(Filter filter, int x, int y, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter a cuboid region
|
* Filter a cuboid region.
|
||||||
* @param filter
|
|
||||||
* @param minX
|
|
||||||
* @param minY
|
|
||||||
* @param minZ
|
|
||||||
* @param maxX
|
|
||||||
* @param maxY
|
|
||||||
* @param maxZ
|
|
||||||
*/
|
*/
|
||||||
public abstract void filter(Filter filter, int minX, int minY, int minZ, int maxX, int maxY,
|
public abstract void filter(Filter filter, int minX, int minY, int minZ, int maxX, int maxY,
|
||||||
int maxZ);
|
int maxZ);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter everything in the layer
|
* Filter everything in the layer.
|
||||||
* @param filter
|
|
||||||
*/
|
*/
|
||||||
public abstract void filter(Filter filter);
|
public abstract void filter(Filter filter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter everything between y layers
|
* Filter everything between y layers.
|
||||||
* @param filter
|
|
||||||
* @param yStart
|
|
||||||
* @param yEnd
|
|
||||||
*/
|
*/
|
||||||
public abstract void filter(Filter filter, int yStart, int yEnd);
|
public abstract void filter(Filter filter, int startY, int endY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter with a region
|
* Filter with a region.
|
||||||
* @param filter
|
|
||||||
* @param region
|
|
||||||
*/
|
*/
|
||||||
public abstract void filter(Filter filter, Region region);
|
public abstract void filter(Filter filter, Region region);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter with a chunk object
|
* Filter with a chunk object.
|
||||||
* @param chunk
|
|
||||||
* @param get
|
|
||||||
* @param set
|
|
||||||
* @param filter
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public final IChunkSet filter(IChunk chunk, IChunkGet get, IChunkSet set, Filter filter) {
|
public final IChunkSet filter(IChunk chunk, IChunkGet get, IChunkSet set, Filter filter) {
|
||||||
initChunk(chunk.getX(), chunk.getZ());
|
initChunk(chunk.getX(), chunk.getZ());
|
||||||
@ -108,14 +77,7 @@ public abstract class ChunkFilterBlock extends AbstractExtentFilterBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter a chunk with a region / filter
|
* Filter a chunk with a region / filter.
|
||||||
* @param chunk
|
|
||||||
* @param get
|
|
||||||
* @param set
|
|
||||||
* @param filter
|
|
||||||
* @param region
|
|
||||||
* @param full
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public final IChunkSet filter(IChunk chunk, IChunkGet get, IChunkSet set, Filter filter, Region region, boolean full) {
|
public final IChunkSet filter(IChunk chunk, IChunkGet get, IChunkSet set, Filter filter, Region region, boolean full) {
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
|
@ -4,7 +4,9 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
|||||||
|
|
||||||
public class SingleFilterBlock extends AbstractSingleFilterBlock {
|
public class SingleFilterBlock extends AbstractSingleFilterBlock {
|
||||||
|
|
||||||
private int x, y, z;
|
private int x;
|
||||||
|
private int y;
|
||||||
|
private int z;
|
||||||
|
|
||||||
public SingleFilterBlock init(int x, int y, int z, BaseBlock block) {
|
public SingleFilterBlock init(int x, int y, int z, BaseBlock block) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
|
@ -28,6 +28,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -281,7 +282,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
}
|
}
|
||||||
int lightLevel = iChunk.getEmmittedLight(node.getX() & 15, node.getY(), node.getZ() & 15);
|
int lightLevel = iChunk.getEmmittedLight(node.getX() & 15, node.getY(), node.getZ() & 15);
|
||||||
BlockState state = this.queue.getBlock(node.getX(), node.getY(), node.getZ());
|
BlockState state = this.queue.getBlock(node.getX(), node.getY(), node.getZ());
|
||||||
String id = state.getBlockType().getId().toLowerCase();
|
String id = state.getBlockType().getId().toLowerCase(Locale.ROOT);
|
||||||
if (lightLevel <= 1) {
|
if (lightLevel <= 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -319,7 +320,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
if (!(checkStairEast(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
if (!(checkStairEast(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
||||||
break east;
|
break east;
|
||||||
}
|
}
|
||||||
if (!state.getBlockType().getId().toLowerCase().contains("stair")) {
|
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||||
this.computeSpreadBlockLight(x + 1, y, z, currentLight, queue, visited);
|
this.computeSpreadBlockLight(x + 1, y, z, currentLight, queue, visited);
|
||||||
break east;
|
break east;
|
||||||
}
|
}
|
||||||
@ -370,7 +371,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
if (!(checkStairWest(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
if (!(checkStairWest(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
||||||
break west;
|
break west;
|
||||||
}
|
}
|
||||||
if (!state.getBlockType().getId().toLowerCase().contains("stair")) {
|
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||||
this.computeSpreadBlockLight(x - 1, y, z, currentLight, queue, visited);
|
this.computeSpreadBlockLight(x - 1, y, z, currentLight, queue, visited);
|
||||||
break west;
|
break west;
|
||||||
}
|
}
|
||||||
@ -421,7 +422,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
if (!(checkStairSouth(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
if (!(checkStairSouth(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
||||||
break south;
|
break south;
|
||||||
}
|
}
|
||||||
if (!state.getBlockType().getId().toLowerCase().contains("stair")) {
|
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||||
this.computeSpreadBlockLight(x, y, z + 1, currentLight, queue, visited);
|
this.computeSpreadBlockLight(x, y, z + 1, currentLight, queue, visited);
|
||||||
break south;
|
break south;
|
||||||
}
|
}
|
||||||
@ -472,7 +473,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
if (!(checkStairNorth(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
if (!(checkStairNorth(state) && isStairOrTrueTop(state, top) && isSlabOrTrueValue(state, top ? "top" : "bottom"))) {
|
||||||
break north;
|
break north;
|
||||||
}
|
}
|
||||||
if (!state.getBlockType().getId().toLowerCase().contains("stair")) {
|
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||||
this.computeSpreadBlockLight(x, y, z - 1, currentLight, queue, visited);
|
this.computeSpreadBlockLight(x, y, z - 1, currentLight, queue, visited);
|
||||||
break north;
|
break north;
|
||||||
}
|
}
|
||||||
@ -611,7 +612,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkStairNorth(BlockState state) {
|
private boolean checkStairNorth(BlockState state) {
|
||||||
if (!state.getBlockType().getId().toLowerCase().contains("stair")) {
|
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Direction direction = getStairDir(state);
|
Direction direction = getStairDir(state);
|
||||||
@ -629,7 +630,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkStairSouth(BlockState state) {
|
private boolean checkStairSouth(BlockState state) {
|
||||||
if (!state.getBlockType().getId().toLowerCase().contains("stair")) {
|
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Direction direction = getStairDir(state);
|
Direction direction = getStairDir(state);
|
||||||
@ -647,7 +648,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkStairEast(BlockState state) {
|
private boolean checkStairEast(BlockState state) {
|
||||||
if (!state.getBlockType().getId().toLowerCase().contains("stair")) {
|
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Direction direction = getStairDir(state);
|
Direction direction = getStairDir(state);
|
||||||
@ -665,7 +666,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkStairWest(BlockState state) {
|
private boolean checkStairWest(BlockState state) {
|
||||||
if (!state.getBlockType().getId().toLowerCase().contains("stair")) {
|
if (!state.getBlockType().getId().toLowerCase(Locale.ROOT).contains("stair")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Direction direction = getStairDir(state);
|
Direction direction = getStairDir(state);
|
||||||
@ -687,7 +688,7 @@ public class NMSRelighter implements Relighter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getStairShape(BlockState state) {
|
private String getStairShape(BlockState state) {
|
||||||
return state.getState(stairShape).toLowerCase();
|
return state.getState(stairShape).toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isStairOrTrueTop(BlockState state, boolean top) {
|
private boolean isStairOrTrueTop(BlockState state, boolean top) {
|
||||||
@ -784,8 +785,9 @@ public class NMSRelighter implements Relighter {
|
|||||||
|
|
||||||
public void fixBlockLighting() {
|
public void fixBlockLighting() {
|
||||||
synchronized (lightQueue) {
|
synchronized (lightQueue) {
|
||||||
while (!lightLock.compareAndSet(false, true))
|
while (!lightLock.compareAndSet(false, true)) {
|
||||||
;
|
;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
updateBlockLight(this.lightQueue);
|
updateBlockLight(this.lightQueue);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -3,7 +3,7 @@ package com.boydti.fawe.beta.implementation.lighting;
|
|||||||
public interface Relighter {
|
public interface Relighter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a chunk to be relit when {@link Relighter#removeLighting} etc are called
|
* Add a chunk to be relit when {@link Relighter#removeLighting} etc are called.
|
||||||
*
|
*
|
||||||
* @param cx chunk x
|
* @param cx chunk x
|
||||||
* @param cz chunk z
|
* @param cz chunk z
|
||||||
@ -14,7 +14,7 @@ public interface Relighter {
|
|||||||
boolean addChunk(int cx, int cz, byte[] skipReason, int bitmask);
|
boolean addChunk(int cx, int cz, byte[] skipReason, int bitmask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a block to be relit
|
* Add a block to be relit.
|
||||||
*
|
*
|
||||||
* @param x block x
|
* @param x block x
|
||||||
* @param y block y
|
* @param y block y
|
||||||
@ -23,14 +23,14 @@ public interface Relighter {
|
|||||||
void addLightUpdate(int x, int y, int z);
|
void addLightUpdate(int x, int y, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Safely? Fix block lighting
|
* Safely? Fix block lighting.
|
||||||
*
|
*
|
||||||
* @param sky whether to also relight sky light values
|
* @param sky whether to also relight sky light values
|
||||||
*/
|
*/
|
||||||
void fixLightingSafe(boolean sky);
|
void fixLightingSafe(boolean sky);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove lighting and then relight safely
|
* Remove lighting and then relight safely.
|
||||||
*
|
*
|
||||||
* @param sky whether to also relight sky light values
|
* @param sky whether to also relight sky light values
|
||||||
*/
|
*/
|
||||||
@ -40,33 +40,33 @@ public interface Relighter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all chunks and blocks to be relit
|
* Clear all chunks and blocks to be relit.
|
||||||
*/
|
*/
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all block and sky light values (set to 0 light) in all chunks added to relighter
|
* Remove all block and sky light values (set to 0 light) in all chunks added to relighter.
|
||||||
*/
|
*/
|
||||||
void removeLighting();
|
void removeLighting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix block light values in all chunks added to relighter
|
* Fix block light values in all chunks added to relighter.
|
||||||
*/
|
*/
|
||||||
void fixBlockLighting();
|
void fixBlockLighting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix sky light values in all chunks added to relighter
|
* Fix sky light values in all chunks added to relighter.
|
||||||
*/
|
*/
|
||||||
void fixSkyLighting();
|
void fixSkyLighting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Are there any block or chunk added to be relit
|
* Are there any block or chunk added to be relit.
|
||||||
*
|
*
|
||||||
* @return is the relight stuff to be relit empty
|
* @return is the relight stuff to be relit empty
|
||||||
*/
|
*/
|
||||||
boolean isEmpty();
|
boolean isEmpty();
|
||||||
|
|
||||||
public static class SkipReason {
|
class SkipReason {
|
||||||
public static final byte NONE = 0;
|
public static final byte NONE = 0;
|
||||||
public static final byte AIR = 1;
|
public static final byte AIR = 1;
|
||||||
public static final byte SOLID = 2;
|
public static final byte SOLID = 2;
|
||||||
|
@ -116,8 +116,8 @@ public class ChunkPacket implements Function<byte[], byte[]>, Supplier<byte[]> {
|
|||||||
fos.writeVarInt(sectionBytes.length);
|
fos.writeVarInt(sectionBytes.length);
|
||||||
fos.write(sectionBytes);
|
fos.write(sectionBytes);
|
||||||
// TODO entities / NBT
|
// TODO entities / NBT
|
||||||
// Set<CompoundTag> entities = chunk.getEntities();
|
//Set<CompoundTag> entities = chunk.getEntities();
|
||||||
// Map<BlockVector3, CompoundTag> tiles = chunk.getTiles();
|
//Map<BlockVector3, CompoundTag> tiles = chunk.getTiles();
|
||||||
fos.writeVarInt(0); // (Entities / NBT)
|
fos.writeVarInt(0); // (Entities / NBT)
|
||||||
return baos.toByteArray();
|
return baos.toByteArray();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -573,7 +573,9 @@ public class LimitExtent extends AbstractDelegateExtent {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
|
||||||
limit.THROW_MAX_CHANGES();
|
limit.THROW_MAX_CHANGES();
|
||||||
if (block.hasNbtData()) limit.MAX_BLOCKSTATES();
|
if (block.hasNbtData()) {
|
||||||
|
limit.MAX_BLOCKSTATES();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return super.setBlock(position, block);
|
return super.setBlock(position, block);
|
||||||
} catch (FaweException e) {
|
} catch (FaweException e) {
|
||||||
@ -587,7 +589,9 @@ public class LimitExtent extends AbstractDelegateExtent {
|
|||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
|
||||||
limit.THROW_MAX_CHANGES();
|
limit.THROW_MAX_CHANGES();
|
||||||
if (block.hasNbtData()) limit.MAX_BLOCKSTATES();
|
if (block.hasNbtData()) {
|
||||||
|
limit.MAX_BLOCKSTATES();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return super.setBlock(x, y, z, block);
|
return super.setBlock(x, y, z, block);
|
||||||
} catch (FaweException e) {
|
} catch (FaweException e) {
|
||||||
|
@ -33,7 +33,7 @@ public class MultiBatchProcessor implements IBatchProcessor {
|
|||||||
for (IBatchProcessor processor : processors) {
|
for (IBatchProcessor processor : processors) {
|
||||||
if (processor instanceof MultiBatchProcessor) {
|
if (processor instanceof MultiBatchProcessor) {
|
||||||
list.addAll(Arrays.asList(((MultiBatchProcessor) processor).processors));
|
list.addAll(Arrays.asList(((MultiBatchProcessor) processor).processors));
|
||||||
} else if (!(processor instanceof EmptyBatchProcessor)){
|
} else if (!(processor instanceof EmptyBatchProcessor)) {
|
||||||
list.add(processor);
|
list.add(processor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +154,9 @@ public class MultiBatchProcessor implements IBatchProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void flush() {
|
public void flush() {
|
||||||
for (IBatchProcessor processor : this.processors) processor.flush();
|
for (IBatchProcessor processor : this.processors) {
|
||||||
|
processor.flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,7 +44,9 @@ public class PersistentChunkSendProcessor extends ChunkSendProcessor {
|
|||||||
current.put(pair, (Character) bitMask);
|
current.put(pair, (Character) bitMask);
|
||||||
if (previous != null) {
|
if (previous != null) {
|
||||||
Character lastValue = previous.remove(pair);
|
Character lastValue = previous.remove(pair);
|
||||||
if (lastValue != null) bitMask |= lastValue;
|
if (lastValue != null) {
|
||||||
|
bitMask |= lastValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new CombinedBlocks(get, set, bitMask);
|
return new CombinedBlocks(get, set, bitMask);
|
||||||
@ -56,7 +58,9 @@ public class PersistentChunkSendProcessor extends ChunkSendProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
if (queue == null) throw new IllegalStateException("Queue is not provided");
|
if (queue == null) {
|
||||||
|
throw new IllegalStateException("Queue is not provided");
|
||||||
|
}
|
||||||
clear(current);
|
clear(current);
|
||||||
current.clear();
|
current.clear();
|
||||||
queue = null;
|
queue = null;
|
||||||
|
@ -106,7 +106,8 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
// Get the next chunk posWeakChunk
|
// Get the next chunk posWeakChunk
|
||||||
final int chunkX, chunkZ;
|
final int chunkX;
|
||||||
|
final int chunkZ;
|
||||||
synchronized (chunksIter) {
|
synchronized (chunksIter) {
|
||||||
if (!chunksIter.hasNext()) {
|
if (!chunksIter.hasNext()) {
|
||||||
break;
|
break;
|
||||||
|
@ -21,7 +21,9 @@ public class QueuePool<T> extends ConcurrentLinkedQueue<T> implements Pool<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
if (!isEmpty()) super.clear();
|
if (!isEmpty()) {
|
||||||
|
super.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
|||||||
* Resets the queue.
|
* Resets the queue.
|
||||||
*/
|
*/
|
||||||
protected synchronized void reset() {
|
protected synchronized void reset() {
|
||||||
if (!this.initialized) return;
|
if (!this.initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!this.chunks.isEmpty()) {
|
if (!this.chunks.isEmpty()) {
|
||||||
for (IChunk chunk : this.chunks.values()) {
|
for (IChunk chunk : this.chunks.values()) {
|
||||||
chunk.recycle();
|
chunk.recycle();
|
||||||
@ -175,9 +177,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
|||||||
|
|
||||||
if (Fawe.isMainThread()) {
|
if (Fawe.isMainThread()) {
|
||||||
V result = (V)chunk.call();
|
V result = (V)chunk.call();
|
||||||
if (result == null){
|
if (result == null) {
|
||||||
return (V) (Future) Futures.immediateFuture(null);
|
return (V) (Future) Futures.immediateFuture(null);
|
||||||
}else{
|
} else {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,7 +287,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
|||||||
while (!submissions.isEmpty()) {
|
while (!submissions.isEmpty()) {
|
||||||
Future future = submissions.poll();
|
Future future = submissions.poll();
|
||||||
try {
|
try {
|
||||||
while (future != null) future = (Future) future.get();
|
while (future != null) {
|
||||||
|
future = (Future) future.get();
|
||||||
|
}
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -294,7 +298,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
|||||||
for (int i = 0; i < overflow; i++) {
|
for (int i = 0; i < overflow; i++) {
|
||||||
Future first = submissions.poll();
|
Future first = submissions.poll();
|
||||||
try {
|
try {
|
||||||
while (first != null) first = (Future) first.get();
|
while (first != null) {
|
||||||
|
first = (Future) first.get();
|
||||||
|
}
|
||||||
} catch (InterruptedException | ExecutionException e) {
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -158,13 +158,15 @@ public class AnvilCommands {
|
|||||||
name = "deleteallunvisited",
|
name = "deleteallunvisited",
|
||||||
aliases = {"delunvisited" },
|
aliases = {"delunvisited" },
|
||||||
desc = "Delete all chunks which haven't been occupied",
|
desc = "Delete all chunks which haven't been occupied",
|
||||||
descFooter = "occupied for `age-ticks` (20t = 1s) and \n" +
|
descFooter = "occupied for `age-ticks` (20t = 1s) and \n"
|
||||||
"Have not been accessed since `file-duration` (ms) after creation and\n" +
|
+ "Have not been accessed since `file-duration` (ms) after creation and\n"
|
||||||
"Have not been used in the past `chunk-inactivity` (ms)" +
|
+ "Have not been used in the past `chunk-inactivity` (ms)"
|
||||||
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
|
+ "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.deleteallunvisited")
|
@CommandPermissions("worldedit.anvil.deleteallunvisited")
|
||||||
public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks, @Arg(desc = "int", def = "60000") int fileDurationMillis) throws WorldEditException {
|
public void deleteAllUnvisited(Player player, String folder, int inhabitedTicks,
|
||||||
|
@Arg(desc = "int", def = "60000")
|
||||||
|
int fileDurationMillis) throws WorldEditException {
|
||||||
// DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
|
// DeleteUninhabitedFilter filter = new DeleteUninhabitedFilter(fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
|
||||||
// DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
|
// DeleteUninhabitedFilter result = runWithWorld(player, folder, filter, true);
|
||||||
// if (result != null) {
|
// if (result != null) {
|
||||||
@ -176,14 +178,18 @@ public class AnvilCommands {
|
|||||||
name = "deleteallunclaimed",
|
name = "deleteallunclaimed",
|
||||||
aliases = {"delallunclaimed" },
|
aliases = {"delallunclaimed" },
|
||||||
desc = "Delete all chunks which haven't been occupied",
|
desc = "Delete all chunks which haven't been occupied",
|
||||||
descFooter = "Supports: WG, P2, GP:\n" +
|
descFooter = "Supports: WorldGuard, PlotSquared, GriefPrevention:\n"
|
||||||
"Delete all chunks which aren't claimed AND haven't been occupied for `age-ticks` (20t = 1s) and \n" +
|
+ "Delete all chunks which aren't claimed AND haven't been occupied for `age-ticks` (20t = 1s) and \n"
|
||||||
"Have not been accessed since `file-duration` (ms) after creation and\n" +
|
+ "Have not been accessed since `file-duration` (ms) after creation and\n"
|
||||||
"Have not been used in the past `chunk-inactivity` (ms)" +
|
+ "Have not been used in the past `chunk-inactivity` (ms)"
|
||||||
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
|
+ "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.deleteallunclaimed")
|
@CommandPermissions("worldedit.anvil.deleteallunclaimed")
|
||||||
public void deleteAllUnclaimed(Player player, int inhabitedTicks, @Arg(desc = "int", def = "60000") int fileDurationMillis, @Switch(name = 'd', desc = "TODO") boolean debug) throws WorldEditException {
|
public void deleteAllUnclaimed(Player player, int inhabitedTicks,
|
||||||
|
@Arg(desc = "int", def = "60000")
|
||||||
|
int fileDurationMillis,
|
||||||
|
@Switch(name = 'd', desc = "The flag will debug the task")
|
||||||
|
boolean debug) throws WorldEditException {
|
||||||
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
|
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
|
||||||
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
|
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis);
|
||||||
// if (debug) {
|
// if (debug) {
|
||||||
@ -198,15 +204,19 @@ public class AnvilCommands {
|
|||||||
@Command(
|
@Command(
|
||||||
name = "deleteunclaimed",
|
name = "deleteunclaimed",
|
||||||
desc = "Delete all chunks which haven't been occupied",
|
desc = "Delete all chunks which haven't been occupied",
|
||||||
descFooter = "(Supports: WG, P2, GP):\n" +
|
descFooter = "(Supports: WorldGuard, PlotSquared, GriefPrevention):\n"
|
||||||
"Is not claimed\n" +
|
+ "Is not claimed\n"
|
||||||
"Has not been occupied for `age-ticks` (20t = 1s) and \n" +
|
+ "Has not been occupied for `age-ticks` (20t = 1s) and \n"
|
||||||
"Have not been accessed since `file-duration` (ms) after creation and\n" +
|
+ "Have not been accessed since `file-duration` (ms) after creation and\n"
|
||||||
"Have not been used in the past `chunk-inactivity` (ms)" +
|
+ "Have not been used in the past `chunk-inactivity` (ms)"
|
||||||
"The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
|
+ "The auto-save interval is the recommended value for `file-duration` and `chunk-inactivity`"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.deleteunclaimed")
|
@CommandPermissions("worldedit.anvil.deleteunclaimed")
|
||||||
public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks, @Arg(desc = "int", def = "60000") int fileDurationMillis, @Switch(name = 'd', desc = "TODO") boolean debug) throws WorldEditException {
|
public void deleteUnclaimed(Player player, EditSession editSession, @Selection Region selection, int inhabitedTicks,
|
||||||
|
@Arg(desc = "int", def = "60000")
|
||||||
|
int fileDurationMillis,
|
||||||
|
@Switch(name = 'd', desc = "The flag will debug the task")
|
||||||
|
boolean debug) throws WorldEditException {
|
||||||
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
|
// DeleteUnclaimedFilter filter = new DeleteUnclaimedFilter(player.getWorld(), fileDurationMillis, inhabitedTicks, fileDurationMillis); TODO NOT IMPLEMENTED
|
||||||
// if (debug) {
|
// if (debug) {
|
||||||
// filter.enableDebug();
|
// filter.enableDebug();
|
||||||
@ -221,8 +231,8 @@ public class AnvilCommands {
|
|||||||
name = "deletealloldregions",
|
name = "deletealloldregions",
|
||||||
aliases = {"deloldreg" },
|
aliases = {"deloldreg" },
|
||||||
desc = "Delete regions which haven't been accessed in a certain amount of time",
|
desc = "Delete regions which haven't been accessed in a certain amount of time",
|
||||||
descFooter = "You can use seconds (s), minutes (m), hours (h), days (d), weeks (w), years (y)\n" +
|
descFooter = "You can use seconds (s), minutes (m), hours (h), days (d), weeks (w), years (y)\n"
|
||||||
"(months are not a unit of time) e.g., 8h5m12s\n"
|
+ "(months are not a unit of time) e.g., 8h5m12s\n"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.deletealloldregions")
|
@CommandPermissions("worldedit.anvil.deletealloldregions")
|
||||||
public void deleteAllOldRegions(Player player, String folder, String time) throws WorldEditException {
|
public void deleteAllOldRegions(Player player, String folder, String time) throws WorldEditException {
|
||||||
@ -236,12 +246,13 @@ public class AnvilCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "trimallplots",
|
name = "trimallplots",
|
||||||
|
|
||||||
desc = "Trim chunks in a Plot World",
|
desc = "Trim chunks in a Plot World",
|
||||||
descFooter = "Unclaimed chunks will be deleted\nUnmodified chunks will be deleted\n"
|
descFooter = "Unclaimed chunks will be deleted\nUnmodified chunks will be deleted\n"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.trimallplots")
|
@CommandPermissions("worldedit.anvil.trimallplots")
|
||||||
public void trimAllPlots(Player player, @Switch(name = 'v', desc = "Delete unvisited chunks") boolean deleteUnvisited) throws WorldEditException {
|
public void trimAllPlots(Player player,
|
||||||
|
@Switch(name = 'v', desc = "Delete unvisited chunks")
|
||||||
|
boolean deleteUnvisited) throws WorldEditException {
|
||||||
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
|
// String folder = player.getWorld().getName(); TODO NOT IMPLEMENTED
|
||||||
// int visitTime = deleteUnvisited ? 1 : -1;
|
// int visitTime = deleteUnvisited ? 1 : -1;
|
||||||
// PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000);
|
// PlotTrimFilter filter = new PlotTrimFilter(player.getWorld(), 0, visitTime, 600000);
|
||||||
@ -259,7 +270,9 @@ public class AnvilCommands {
|
|||||||
desc = "Delete chunks matching a specific biome"
|
desc = "Delete chunks matching a specific biome"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.trimallair")
|
@CommandPermissions("worldedit.anvil.trimallair")
|
||||||
public void deleteBiome(Player player, String folder, BiomeType biome, @Switch(name = 'u', desc = "TODO") boolean unsafe) {
|
public void deleteBiome(Player player, String folder, BiomeType biome,
|
||||||
|
@Switch(name = 'u', desc = "The flag will run the task unsafe")
|
||||||
|
boolean unsafe) {
|
||||||
// DeleteBiomeFilterSimple filter = new DeleteBiomeFilterSimple(biome); TODO NOT IMPLEMENTED
|
// DeleteBiomeFilterSimple filter = new DeleteBiomeFilterSimple(biome); TODO NOT IMPLEMENTED
|
||||||
// DeleteBiomeFilterSimple result = runWithWorld(player, folder, filter, true, unsafe);
|
// DeleteBiomeFilterSimple result = runWithWorld(player, folder, filter, true, unsafe);
|
||||||
// if (result != null) {
|
// if (result != null) {
|
||||||
@ -272,7 +285,9 @@ public class AnvilCommands {
|
|||||||
desc = "Trim all air in the world"
|
desc = "Trim all air in the world"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.trimallair")
|
@CommandPermissions("worldedit.anvil.trimallair")
|
||||||
public void trimAllAir(Player player, String folder, @Switch(name = 'u', desc = "TODO") boolean unsafe) throws WorldEditException {
|
public void trimAllAir(Player player, String folder,
|
||||||
|
@Switch(name = 'u', desc = "The flag will run the task unsafe")
|
||||||
|
boolean unsafe) throws WorldEditException {
|
||||||
// TrimAirFilter filter = new TrimAirFilter(); TODO NOT IMPLEMENTED
|
// TrimAirFilter filter = new TrimAirFilter(); TODO NOT IMPLEMENTED
|
||||||
// TrimAirFilter result = runWithWorld(player, folder, filter, true, unsafe);
|
// TrimAirFilter result = runWithWorld(player, folder, filter, true, unsafe);
|
||||||
// if (result != null) {
|
// if (result != null) {
|
||||||
@ -282,7 +297,6 @@ public class AnvilCommands {
|
|||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "debugfixroads",
|
name = "debugfixroads",
|
||||||
|
|
||||||
desc = "debug - do not use"
|
desc = "debug - do not use"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.debugfixroads")
|
@CommandPermissions("worldedit.anvil.debugfixroads")
|
||||||
@ -300,7 +314,13 @@ public class AnvilCommands {
|
|||||||
desc = "Replace all blocks in the selection with another"
|
desc = "Replace all blocks in the selection with another"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.replaceall")
|
@CommandPermissions("worldedit.anvil.replaceall")
|
||||||
public void replaceAllPattern(Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, Pattern toPattern, @Switch(name = 'd', desc = "TODO") boolean useData, @Switch(name = 'm', desc = "TODO") boolean useMap) throws WorldEditException {
|
public void replaceAllPattern(Player player, String folder,
|
||||||
|
@Arg(desc = "String", def = "")
|
||||||
|
String from, Pattern toPattern,
|
||||||
|
@Switch(name = 'd', desc = "The flag specifies the data to use")
|
||||||
|
boolean useData,
|
||||||
|
@Switch(name = 'm', desc = "The flag specifies the map to use")
|
||||||
|
boolean useMap) throws WorldEditException {
|
||||||
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
|
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
|
||||||
// if (useMap) {
|
// if (useMap) {
|
||||||
// if (to instanceof RandomPattern) {
|
// if (to instanceof RandomPattern) {
|
||||||
@ -329,7 +349,9 @@ public class AnvilCommands {
|
|||||||
desc = "Count all blocks in a world"
|
desc = "Count all blocks in a world"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.countall")
|
@CommandPermissions("worldedit.anvil.countall")
|
||||||
public void countAll(Player player, EditSession editSession, String folder, String argStr, @Switch(name = 'd', desc = "TODO") boolean useData) throws WorldEditException {
|
public void countAll(Player player, EditSession editSession, String folder, String argStr,
|
||||||
|
@Switch(name = 'd', desc = "The flag specifies the data to use")
|
||||||
|
boolean useData) throws WorldEditException {
|
||||||
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true);
|
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true);
|
||||||
// MCAFilterCounter filter;
|
// MCAFilterCounter filter;
|
||||||
// if (useData || arg.contains(":")) { // Optimize for both cases
|
// if (useData || arg.contains(":")) { // Optimize for both cases
|
||||||
@ -403,7 +425,9 @@ public class AnvilCommands {
|
|||||||
desc = "Count blocks in a selection"
|
desc = "Count blocks in a selection"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.count")
|
@CommandPermissions("worldedit.anvil.count")
|
||||||
public void count(Player player, EditSession editSession, @Selection Region selection, String argStr, @Switch(name = 'd', desc = "TODO") boolean useData) throws WorldEditException {
|
public void count(Player player, EditSession editSession, @Selection Region selection, String argStr,
|
||||||
|
@Switch(name = 'd', desc = "The flag specifies the data to use")
|
||||||
|
boolean useData) throws WorldEditException {
|
||||||
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true); TODO NOT IMPLEMENTED
|
// Set<BaseBlock> searchBlocks = worldEdit.getBlocks(player, arg, true); TODO NOT IMPLEMENTED
|
||||||
// MCAFilterCounter filter;
|
// MCAFilterCounter filter;
|
||||||
// if (useData || arg.contains(":")) { // Optimize for both cases
|
// if (useData || arg.contains(":")) { // Optimize for both cases
|
||||||
@ -425,7 +449,9 @@ public class AnvilCommands {
|
|||||||
desc = "Replace all blocks in the selection with another"
|
desc = "Replace all blocks in the selection with another"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.distr")
|
@CommandPermissions("worldedit.anvil.distr")
|
||||||
public void distr(Player player, EditSession editSession, @Selection Region selection, @Switch(name = 'd', desc = "TODO") boolean useData) throws WorldEditException {
|
public void distr(Player player, EditSession editSession, @Selection Region selection,
|
||||||
|
@Switch(name = 'd', desc = "The flag specifies the data to use")
|
||||||
|
boolean useData) throws WorldEditException {
|
||||||
// long total = 0; TODO NOT IMPLEMENTED
|
// long total = 0; TODO NOT IMPLEMENTED
|
||||||
// long[] count;
|
// long[] count;
|
||||||
// MCAFilter<long[]> counts;
|
// MCAFilter<long[]> counts;
|
||||||
@ -504,7 +530,11 @@ public class AnvilCommands {
|
|||||||
desc = "Replace all blocks in the selection with another"
|
desc = "Replace all blocks in the selection with another"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.replace")
|
@CommandPermissions("worldedit.anvil.replace")
|
||||||
public void replace(Player player, EditSession editSession, @Selection Region selection, @Arg(name = "from", desc = "String", def = "") String from, String toStr, @Switch(name = 'd', desc = "TODO") boolean useData) throws WorldEditException {
|
public void replace(Player player, EditSession editSession, @Selection Region selection,
|
||||||
|
@Arg(desc = "String", def = "")
|
||||||
|
String from, String toStr,
|
||||||
|
@Switch(name = 'd', desc = "The flag specifies the data to use")
|
||||||
|
boolean useData) throws WorldEditException {
|
||||||
// final FaweBlockMatcher matchFrom; TODO NOT IMPLEMENTED
|
// final FaweBlockMatcher matchFrom; TODO NOT IMPLEMENTED
|
||||||
// if (from == null) {
|
// if (from == null) {
|
||||||
// matchFrom = FaweBlockMatcher.NOT_AIR;
|
// matchFrom = FaweBlockMatcher.NOT_AIR;
|
||||||
@ -526,7 +556,13 @@ public class AnvilCommands {
|
|||||||
desc = "Replace all blocks in the selection with a pattern"
|
desc = "Replace all blocks in the selection with a pattern"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.replace")
|
@CommandPermissions("worldedit.anvil.replace")
|
||||||
public void replacePattern(Player player, EditSession editSession, @Selection Region selection, @Arg(name = "from", desc = "String", def = "") String from, final Pattern toPattern, @Switch(name = 'd', desc = "TODO") boolean useData, @Switch(name = 'm', desc = "TODO") boolean useMap) throws WorldEditException {
|
public void replacePattern(Player player, EditSession editSession, @Selection Region selection,
|
||||||
|
@Arg(desc = "String", def = "")
|
||||||
|
String from, final Pattern toPattern,
|
||||||
|
@Switch(name = 'd', desc = "The flag specifies the data to use")
|
||||||
|
boolean useData,
|
||||||
|
@Switch(name = 'm', desc = "The flag specifies the map to use")
|
||||||
|
boolean useMap) throws WorldEditException {
|
||||||
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
|
// MCAFilterCounter filter; TODO NOT IMPLEMENTED
|
||||||
// if (useMap) {
|
// if (useMap) {
|
||||||
// if (to instanceof RandomPattern) {
|
// if (to instanceof RandomPattern) {
|
||||||
@ -556,7 +592,7 @@ public class AnvilCommands {
|
|||||||
desc = "Set all blocks in the selection with a pattern"
|
desc = "Set all blocks in the selection with a pattern"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.set")
|
@CommandPermissions("worldedit.anvil.set")
|
||||||
// Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern toPattern, @Switch(name = 'd', desc = "TODO") boolean useData, @Switch(name = 'm', desc = "TODO") boolean useMap
|
// Player player, String folder, @Arg(name = "from", desc = "String", def = "") String from, final Pattern toPattern, @Switch(name = 'd', desc = "The flag specifies the data to use") boolean useData, @Switch(name = 'm', desc = "The flag specifies the map to use") boolean useMap
|
||||||
public void set(Player player, EditSession editSession, @Selection Region selection, final Pattern toPattern) throws WorldEditException {
|
public void set(Player player, EditSession editSession, @Selection Region selection, final Pattern toPattern) throws WorldEditException {
|
||||||
// MCAFilterCounter filter = new SetPatternFilter(to); TODO NOT IMPLEMENTED
|
// MCAFilterCounter filter = new SetPatternFilter(to); TODO NOT IMPLEMENTED
|
||||||
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
// MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
|
||||||
@ -602,17 +638,18 @@ public class AnvilCommands {
|
|||||||
// MCAClipboard clipboard = new MCAClipboard(queue, cuboid, origin);
|
// MCAClipboard clipboard = new MCAClipboard(queue, cuboid, origin);
|
||||||
// FawePlayer fp = FawePlayer.wrap(player);
|
// FawePlayer fp = FawePlayer.wrap(player);
|
||||||
// fp.setMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD, clipboard);
|
// fp.setMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD, clipboard);
|
||||||
// player.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy" , selection.getArea()));
|
// player.print(TranslatableComponent.of("fawe.worldedit.copy.command.copy", selection.getArea()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
name = "paste",
|
name = "paste",
|
||||||
desc = "Paste chunks from your anvil clipboard",
|
desc = "Paste chunks from your anvil clipboard",
|
||||||
descFooter = "Paste the chunks from your anvil clipboard.\n" +
|
descFooter = "Paste the chunks from your anvil clipboard."
|
||||||
"The -c flag will align the paste to the chunks."
|
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.anvil.pastechunks")
|
@CommandPermissions("worldedit.anvil.pastechunks")
|
||||||
public void paste(Player player, LocalSession session, EditSession editSession, @Switch(name = 'c', desc = "TODO") boolean alignChunk) throws WorldEditException, IOException {
|
public void paste(Player player, LocalSession session, EditSession editSession,
|
||||||
|
@Switch(name = 'c', desc = "Align to chunks")
|
||||||
|
boolean alignChunk) throws WorldEditException, IOException {
|
||||||
// FawePlayer fp = FawePlayer.wrap(player); TODO NOT IMPLEMENTED
|
// FawePlayer fp = FawePlayer.wrap(player); TODO NOT IMPLEMENTED
|
||||||
// MCAClipboard clipboard = fp.getMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD);
|
// MCAClipboard clipboard = fp.getMeta(FawePlayer.METADATA_KEYS.ANVIL_CLIPBOARD);
|
||||||
// if (clipboard == null) {
|
// if (clipboard == null) {
|
||||||
@ -639,6 +676,6 @@ public class AnvilCommands {
|
|||||||
// pasteQueue.pasteRegion(copyQueue, copyRegion, offset, iAnvilHistory);
|
// pasteQueue.pasteRegion(copyQueue, copyRegion, offset, iAnvilHistory);
|
||||||
// } catch (IOException e) { throw new RuntimeException(e); }
|
// } catch (IOException e) { throw new RuntimeException(e); }
|
||||||
// });
|
// });
|
||||||
// player.print(TranslatableComponent.of("fawe.worldedit.paste.command.paste" , player.getPosition().toBlockVector()));
|
// player.print(TranslatableComponent.of("fawe.worldedit.paste.command.paste", player.getPosition().toBlockVector()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@
|
|||||||
// desc = "Set the floor and main block"
|
// desc = "Set the floor and main block"
|
||||||
// )
|
// )
|
||||||
// @CommandPermissions("worldedit.anvil.cfi")
|
// @CommandPermissions("worldedit.anvil.cfi")
|
||||||
// public void column(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
// public void column(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||||
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||||
// if (image != null) {
|
// if (image != null) {
|
||||||
// gen.setColumn(load(image), pattern, !disableWhiteOnly);
|
// gen.setColumn(load(image), pattern, !disableWhiteOnly);
|
||||||
@ -264,7 +264,7 @@
|
|||||||
// desc = "Set the floor (default: grass)"
|
// desc = "Set the floor (default: grass)"
|
||||||
// )
|
// )
|
||||||
// @CommandPermissions("worldedit.anvil.cfi")
|
// @CommandPermissions("worldedit.anvil.cfi")
|
||||||
// public void floorCmd(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
// public void floorCmd(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||||
// floor(player, pattern, image, mask, disableWhiteOnly);
|
// floor(player, pattern, image, mask, disableWhiteOnly);
|
||||||
// player.print("Set floor!");
|
// player.print("Set floor!");
|
||||||
// assertSettings(player).resetComponent();
|
// assertSettings(player).resetComponent();
|
||||||
@ -287,14 +287,14 @@
|
|||||||
// desc = "Set the main block (default: stone)"
|
// desc = "Set the main block (default: stone)"
|
||||||
// )
|
// )
|
||||||
// @CommandPermissions("worldedit.anvil.cfi")
|
// @CommandPermissions("worldedit.anvil.cfi")
|
||||||
// public void mainCmd(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
// public void mainCmd(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||||
// main(player, pattern, image, maskOpt, disableWhiteOnly);
|
// main(player, pattern, image, maskOpt, disableWhiteOnly);
|
||||||
// player.print("Set main!");
|
// player.print("Set main!");
|
||||||
// assertSettings(player).resetComponent();
|
// assertSettings(player).resetComponent();
|
||||||
// component(player);
|
// component(player);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// public void main(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
// public void main(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask maskOpt, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||||
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||||
// if (image != null) {
|
// if (image != null) {
|
||||||
// gen.setMain(load(image), pattern, !disableWhiteOnly);
|
// gen.setMain(load(image), pattern, !disableWhiteOnly);
|
||||||
@ -313,7 +313,7 @@
|
|||||||
// "e.g., Tallgrass"
|
// "e.g., Tallgrass"
|
||||||
// )
|
// )
|
||||||
// @CommandPermissions("worldedit.anvil.cfi")
|
// @CommandPermissions("worldedit.anvil.cfi")
|
||||||
// public void overlay(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
// public void overlay(Player player, @Arg(desc = "Pattern") Pattern pattern, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||||
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||||
// if (image != null) {
|
// if (image != null) {
|
||||||
// gen.setOverlay(load(image), pattern, !disableWhiteOnly);
|
// gen.setOverlay(load(image), pattern, !disableWhiteOnly);
|
||||||
@ -335,13 +335,13 @@
|
|||||||
// " - A good value for radius and iterations would be 1 8."
|
// " - A good value for radius and iterations would be 1 8."
|
||||||
// )
|
// )
|
||||||
// @CommandPermissions("worldedit.anvil.cfi")
|
// @CommandPermissions("worldedit.anvil.cfi")
|
||||||
// public void smoothCmd(Player player, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
// public void smoothCmd(Player player, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||||
// smooth(player, radius, iterations, image, mask, disableWhiteOnly);
|
// smooth(player, radius, iterations, image, mask, disableWhiteOnly);
|
||||||
// assertSettings(player).resetComponent();
|
// assertSettings(player).resetComponent();
|
||||||
// component(player);
|
// component(player);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// private void smooth(Player player, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
// private void smooth(Player player, int radius, int iterations, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||||
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||||
// if (image != null) {
|
// if (image != null) {
|
||||||
// gen.smooth(load(image), !disableWhiteOnly, radius, iterations);
|
// gen.smooth(load(image), !disableWhiteOnly, radius, iterations);
|
||||||
@ -355,7 +355,7 @@
|
|||||||
// desc = "Create some snow"
|
// desc = "Create some snow"
|
||||||
// )
|
// )
|
||||||
// @CommandPermissions("worldedit.anvil.cfi")
|
// @CommandPermissions("worldedit.anvil.cfi")
|
||||||
// public void snow(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
// public void snow(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||||
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||||
// floor(player, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly);
|
// floor(player, BlockTypes.SNOW.getDefaultState().with(PropertyKey.LAYERS, 7), image, mask, disableWhiteOnly);
|
||||||
// main(player, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly);
|
// main(player, BlockTypes.SNOW_BLOCK, image, mask, disableWhiteOnly);
|
||||||
@ -422,7 +422,7 @@
|
|||||||
// Request.request().setExtent(generator);
|
// Request.request().setExtent(generator);
|
||||||
//
|
//
|
||||||
// Set<BlockType> blocks;
|
// Set<BlockType> blocks;
|
||||||
// switch (argOpt.toLowerCase()) {
|
// switch (argOpt.toLowerCase(Locale.ROOT)) {
|
||||||
// case "true":
|
// case "true":
|
||||||
// case "*": {
|
// case "*": {
|
||||||
// generator.setTextureUtil(Fawe.get().getTextureUtil());
|
// generator.setTextureUtil(Fawe.get().getTextureUtil());
|
||||||
@ -535,7 +535,7 @@
|
|||||||
// " - If a mask is used, the biome will be set anywhere the mask applies"
|
// " - If a mask is used, the biome will be set anywhere the mask applies"
|
||||||
// )
|
// )
|
||||||
// @CommandPermissions("worldedit.anvil.cfi")
|
// @CommandPermissions("worldedit.anvil.cfi")
|
||||||
// public void biome(Player player, @Arg(desc = "Biome type") BiomeType biome, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly){
|
// public void biome(Player player, @Arg(desc = "Biome type") BiomeType biome, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri image, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly) {
|
||||||
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
// HeightMapMCAGenerator gen = assertSettings(player).getGenerator();
|
||||||
// if (image != null) {
|
// if (image != null) {
|
||||||
// gen.setBiome(load(image), biome, !disableWhiteOnly);
|
// gen.setBiome(load(image), biome, !disableWhiteOnly);
|
||||||
@ -819,7 +819,7 @@
|
|||||||
// TextComponent.of("/cfi randomization " + !rand)));
|
// TextComponent.of("/cfi randomization " + !rand)));
|
||||||
// @NotNull Builder builder = TextComponent.builder(">> Current Settings <<");
|
// @NotNull Builder builder = TextComponent.builder(">> Current Settings <<");
|
||||||
// builder.append(newline());
|
// builder.append(newline());
|
||||||
// builder.append(TextComponent.of("Randomization [" + Boolean.toString(rand).toUpperCase() + "]")
|
// builder.append(TextComponent.of("Randomization [" + Boolean.toString(rand).toUpperCase(Locale.ROOT) + "]")
|
||||||
// .clickEvent(ClickEvent.runCommand(
|
// .clickEvent(ClickEvent.runCommand(
|
||||||
// "/cfi randomization " + !rand)).hoverEvent(HoverEvent.showText(
|
// "/cfi randomization " + !rand)).hoverEvent(HoverEvent.showText(
|
||||||
// TextComponent.of("/cfi randomization " + !rand))));
|
// TextComponent.of("/cfi randomization " + !rand))));
|
||||||
@ -871,7 +871,7 @@
|
|||||||
// desc = "Select a mask"
|
// desc = "Select a mask"
|
||||||
// )
|
// )
|
||||||
// @CommandPermissions("worldedit.anvil.cfi")
|
// @CommandPermissions("worldedit.anvil.cfi")
|
||||||
// public void mask(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context){
|
// public void mask(Player player, @Arg(def = "", desc = "image url or filename") ProvideBindings.ImageUri imageMask, @Arg(desc = "Mask", def = "") Mask mask, @Switch(name = 'w', desc = "TODO") boolean disableWhiteOnly, InjectedValueAccess context) {
|
||||||
// CFISettings settings = assertSettings(player);
|
// CFISettings settings = assertSettings(player);
|
||||||
// String[] split = getArguments(context).split(" ");
|
// String[] split = getArguments(context).split(" ");
|
||||||
// int index = 2;
|
// int index = 2;
|
||||||
@ -950,7 +950,7 @@
|
|||||||
// JsonObject data1 = obj.get("data").getAsJsonObject();
|
// JsonObject data1 = obj.get("data").getAsJsonObject();
|
||||||
// String link = data1.get("link").getAsString();
|
// String link = data1.get("link").getAsString();
|
||||||
// URL url = new URL(link);
|
// URL url = new URL(link);
|
||||||
// player.print(Caption.of("fawe.web.download.link" , url));
|
// player.print(Caption.of("fawe.web.download.link", url));
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// @Command(
|
// @Command(
|
||||||
|
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