3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-02 17:40:09 +01:00

use paper writeLock

Dieser Commit ist enthalten in:
Jesse Boyd 2019-05-02 04:30:32 +10:00
Ursprung adb2c37a02
Commit 18e6c09fdd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F

Datei anzeigen

@ -125,12 +125,20 @@ public class BukkitQueue extends SimpleCharQueueExtent {
fieldNonEmptyBlockCount = ChunkSection.class.getDeclaredField("nonEmptyBlockCount");
fieldNonEmptyBlockCount.setAccessible(true);
fieldLock = DataPaletteBlock.class.getDeclaredField("j");
fieldLock.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
int modifiers = modifiersField.getInt(fieldLock);
modifiers &= ~Modifier.FINAL;
modifiersField.setInt(fieldLock, modifiers);
{
Field tmp = null;
try {
tmp = DataPaletteBlock.class.getDeclaredField("j");
} catch (NoSuchFieldException paper) {
tmp = DataPaletteBlock.class.getDeclaredField("writeLock");
}
fieldLock = tmp;
fieldLock.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
int modifiers = modifiersField.getInt(fieldLock);
int newModifiers = modifiers & (~Modifier.FINAL);
if (newModifiers != modifiers) modifiersField.setInt(fieldLock, newModifiers);
}
Unsafe unsafe = UnsafeUtils.getUNSAFE();
CHUNKSECTION_BASE = unsafe.arrayBaseOffset(ChunkSection[].class);