Skip to content

Commit 32c9a80

Browse files
authored
Merge branch 'v3' into feature/anvil
2 parents 688e083 + 1a7f555 commit 32c9a80

58 files changed

Lines changed: 727 additions & 996 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Label conflicting PRs"
2+
on:
3+
push:
4+
pull_request_target:
5+
types: [ synchronize ]
6+
pull_request:
7+
types: [ synchronize ]
8+
9+
permissions:
10+
pull-requests: write
11+
12+
jobs:
13+
main:
14+
if: github.event.pull_request.user.login != 'dependabot[bot]'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Label conflicting PRs
18+
uses: eps1lon/actions-label-merge-conflict@v2.1.0
19+
with:
20+
dirtyLabel: "unresolved-merge-conflict"
21+
repoToken: "${{ secrets.GITHUB_TOKEN }}"
22+
commentOnDirty: "Please take a moment and address the merge conflicts of your pull request. Thanks!"
23+
continueOnMissingPermissions: true

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ logger.lifecycle("""
3434
*******************************************
3535
""")
3636

37-
var rootVersion by extra("2.8.2")
37+
var rootVersion by extra("2.8.3")
3838
var snapshot by extra("SNAPSHOT")
3939
var revision: String by extra("")
4040
var buildNumber by extra("")

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ val properties = Properties().also { props ->
2222

2323
dependencies {
2424
implementation(gradleApi())
25-
implementation("org.ajoberstar.grgit:grgit-gradle:5.2.0")
25+
implementation("org.ajoberstar.grgit:grgit-gradle:5.2.1")
2626
implementation("com.github.johnrengelman:shadow:8.1.1")
2727
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.5")
2828
}

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ mapmanager = "1.8.0-SNAPSHOT"
1414
griefprevention = "16.18.1"
1515
griefdefender = "2.1.0-SNAPSHOT"
1616
residence = "4.5._13.1"
17-
towny = "0.99.6.0"
18-
plotsquared = "7.0.0"
17+
towny = "0.100.0.1"
18+
plotsquared = "7.1.0"
1919

2020
# Third party
2121
bstats = "3.0.2"
2222
sparsebitset = "1.3"
2323
parallelgzip = "1.0.5"
2424
adventure = "4.14.0"
2525
adventure-bukkit = "4.3.1"
26-
checkerqual = "3.39.0"
26+
checkerqual = "3.40.0"
2727
truezip = "6.8.4"
2828
auto-value = "1.10.4"
2929
findbugs = "3.0.2"
@@ -35,7 +35,7 @@ jlibnoise = "1.0.0"
3535
jchronic = "0.2.4a"
3636
lz4-java = "1.8.0"
3737
lz4-stream = "1.0.0"
38-
commons-cli = "1.5.0"
38+
commons-cli = "1.6.0"
3939
paperlib = "1.0.8"
4040
paster = "1.1.5"
4141
vault = "1.7.1"

worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@
7272
import java.util.Set;
7373
import java.util.UUID;
7474
import java.util.concurrent.Callable;
75+
import java.util.concurrent.ConcurrentHashMap;
7576
import java.util.concurrent.Future;
7677
import java.util.concurrent.Semaphore;
7778
import java.util.concurrent.locks.ReadWriteLock;
79+
import java.util.concurrent.locks.ReentrantLock;
7880
import java.util.concurrent.locks.ReentrantReadWriteLock;
7981
import java.util.function.Function;
8082
import java.util.stream.Collectors;
@@ -91,21 +93,24 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
9193
.getInstance()
9294
.getBukkitImplAdapter());
9395
private final ReadWriteLock sectionLock = new ReentrantReadWriteLock();
96+
private final ReentrantLock callLock = new ReentrantLock();
9497
private final ServerLevel serverLevel;
9598
private final int chunkX;
9699
private final int chunkZ;
97100
private final int minHeight;
98101
private final int maxHeight;
99102
private final int minSectionPosition;
100103
private final int maxSectionPosition;
104+
private final ConcurrentHashMap<Integer, PaperweightGetBlocks_Copy> copies = new ConcurrentHashMap<>();
105+
private final Object sendLock = new Object();
101106
private LevelChunkSection[] sections;
102107
private LevelChunk levelChunk;
103108
private DataLayer[] blockLight;
104109
private DataLayer[] skyLight;
105110
private boolean createCopy = false;
106-
private PaperweightGetBlocks_Copy copy = null;
107111
private boolean forceLoadSections = true;
108112
private boolean lightUpdate = false;
113+
private int copyKey = 0;
109114

110115
public PaperweightGetBlocks(World world, int chunkX, int chunkZ) {
111116
this(((CraftWorld) world).getHandle(), chunkX, chunkZ);
@@ -138,13 +143,27 @@ public boolean isCreateCopy() {
138143
}
139144

140145
@Override
141-
public void setCreateCopy(boolean createCopy) {
146+
public int setCreateCopy(boolean createCopy) {
147+
if (!callLock.isHeldByCurrentThread()) {
148+
throw new IllegalStateException("Attempting to set if chunk GET should create copy, but it is not call-locked.");
149+
}
142150
this.createCopy = createCopy;
151+
return ++this.copyKey;
152+
}
153+
154+
@Override
155+
public IChunkGet getCopy(final int key) {
156+
return copies.remove(key);
143157
}
144158

145159
@Override
146-
public IChunkGet getCopy() {
147-
return copy;
160+
public void lockCall() {
161+
this.callLock.lock();
162+
}
163+
164+
@Override
165+
public void unlockCall() {
166+
this.callLock.unlock();
148167
}
149168

150169
@Override
@@ -393,8 +412,17 @@ public LevelChunk ensureLoaded(ServerLevel nmsWorld, int chunkX, int chunkZ) {
393412
@Override
394413
@SuppressWarnings("rawtypes")
395414
public synchronized <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) {
415+
if (!callLock.isHeldByCurrentThread()) {
416+
throw new IllegalStateException("Attempted to call chunk GET but chunk was not call-locked.");
417+
}
396418
forceLoadSections = false;
397-
copy = createCopy ? new PaperweightGetBlocks_Copy(getChunk()) : null;
419+
PaperweightGetBlocks_Copy copy = createCopy ? new PaperweightGetBlocks_Copy(levelChunk) : null;
420+
if (createCopy) {
421+
if (copies.containsKey(copyKey)) {
422+
throw new IllegalStateException("Copy key already used.");
423+
}
424+
copies.put(copyKey, copy);
425+
}
398426
try {
399427
ServerLevel nmsWorld = serverLevel;
400428
LevelChunk nmsChunk = ensureLoaded(nmsWorld, chunkX, chunkZ);
@@ -831,18 +859,18 @@ private char[] loadPrivately(int layer) {
831859
if (super.sections[layer] != null) {
832860
synchronized (super.sectionLocks[layer]) {
833861
if (super.sections[layer].isFull() && super.blocks[layer] != null) {
834-
char[] blocks = new char[4096];
835-
System.arraycopy(super.blocks[layer], 0, blocks, 0, 4096);
836-
return blocks;
862+
return super.blocks[layer];
837863
}
838864
}
839865
}
840866
return PaperweightGetBlocks.this.update(layer, null, true);
841867
}
842868

843869
@Override
844-
public synchronized void send(int mask, boolean lighting) {
845-
PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting);
870+
public void send(int mask, boolean lighting) {
871+
synchronized (sendLock) {
872+
PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting);
873+
}
846874
}
847875

848876
/**
@@ -946,9 +974,7 @@ private char ordinal(net.minecraft.world.level.block.state.BlockState ibd, Paper
946974

947975
public LevelChunkSection[] getSections(boolean force) {
948976
force &= forceLoadSections;
949-
sectionLock.readLock().lock();
950977
LevelChunkSection[] tmp = sections;
951-
sectionLock.readLock().unlock();
952978
if (tmp == null || force) {
953979
try {
954980
sectionLock.writeLock().lock();

worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks_Copy.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import net.minecraft.world.level.chunk.LevelChunk;
2323

2424
import javax.annotation.Nullable;
25+
import java.util.Arrays;
2526
import java.util.HashMap;
2627
import java.util.HashSet;
2728
import java.util.Map;
@@ -99,7 +100,8 @@ public boolean isCreateCopy() {
99100
}
100101

101102
@Override
102-
public void setCreateCopy(boolean createCopy) {
103+
public int setCreateCopy(boolean createCopy) {
104+
return -1;
103105
}
104106

105107
@Override
@@ -196,6 +198,10 @@ public boolean hasSection(int layer) {
196198
@Override
197199
public char[] load(int layer) {
198200
layer -= getMinSectionPosition();
201+
if (blocks[layer] == null) {
202+
blocks[layer] = new char[4096];
203+
Arrays.fill(blocks[layer], (char) BlockTypesCache.ReservedIDs.AIR);
204+
}
199205
return blocks[layer];
200206
}
201207

0 commit comments

Comments
 (0)