mirror of
https://github.com/YouHaveTrouble/BlockEdit.git
synced 2026-06-29 13:36:19 +00:00
technically folia is supported now
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
<description>Modern WorldEdit alternative</description>
|
||||
<properties>
|
||||
<java.version>16</java.version>
|
||||
<java.version>21</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<revision>1.0-SNAPSHOT</revision>
|
||||
</properties>
|
||||
@@ -77,7 +77,7 @@
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.19.4-R0.1-SNAPSHOT</version>
|
||||
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -32,17 +32,22 @@ public class WorkSplitter {
|
||||
protected static void runOperation(HashSet<ChunkWork> chunkWorks, Selection selection, int chunksPerTick, BlockEditOperation operation) {
|
||||
if (selection == null) return;
|
||||
Selection sel = new Selection(selection.clone().expand(0.1), selection.getWorldUuid());
|
||||
List<ChunkWork> chunkWork = new ArrayList<>(chunkWorks);
|
||||
AtomicInteger element = new AtomicInteger(chunkWork.size()-1);
|
||||
Bukkit.getScheduler().runTaskTimer(BlockEdit.getPlugin(), (task) -> {
|
||||
List<ChunkWork> chunkWorkList = new ArrayList<>(chunkWorks);
|
||||
AtomicInteger element = new AtomicInteger(chunkWorkList.size()-1);
|
||||
Bukkit.getGlobalRegionScheduler().runAtFixedRate(BlockEdit.getPlugin(), (task -> {
|
||||
if (element.get() < 0) {
|
||||
task.cancel();
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i< chunksPerTick; i++) {
|
||||
processChunkWork(chunkWork.get(element.getAndDecrement()), sel, operation);
|
||||
int chunkWorkIndex = element.getAndDecrement();
|
||||
ChunkWork chunkWork = chunkWorkList.get(chunkWorkIndex);
|
||||
Bukkit.getRegionScheduler().execute(BlockEdit.getPlugin(), selection.getWorld(), chunkWork.getX(), chunkWork.getZ(), () -> {
|
||||
processChunkWork(chunkWork, sel, operation);
|
||||
});
|
||||
}
|
||||
}, 0, 1);
|
||||
}), 0, 1);
|
||||
|
||||
}
|
||||
|
||||
private static void processChunkWork(ChunkWork chunkWork, Selection selection, BlockEditOperation operation) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
name: BlockEdit
|
||||
version: ${project.version}
|
||||
main: me.youhavetrouble.blockedit.BlockEdit
|
||||
api-version: 1.19
|
||||
api-version: "1.20"
|
||||
authors: [ YouHaveTrouble ]
|
||||
description: Modern WorldEdit alternative
|
||||
website: https://youhavetrouble.me
|
||||
folia-supported: true
|
||||
|
||||
Reference in New Issue
Block a user