Update paperweight to 1.2.0 (#6901)

This commit is contained in:
Jason Penilla 2021-11-16 21:00:14 -08:00
parent 63c3c76ad0
commit a9214f2d63
13 changed files with 45 additions and 81 deletions

View File

@ -109,29 +109,3 @@ c net/minecraft/world/level/saveddata/maps/WorldMap$WorldMapHumanTracker net/min
# CraftBukkit adds a level resource key to LevelStorageSource#createAccess # CraftBukkit adds a level resource key to LevelStorageSource#createAccess
c net/minecraft/world/level/storage/Convertable net/minecraft/world/level/storage/LevelStorageSource c net/minecraft/world/level/storage/Convertable net/minecraft/world/level/storage/LevelStorageSource
m (Ljava/lang/String;Lnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/level/storage/Convertable$ConversionSession; c createAccess m (Ljava/lang/String;Lnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/level/storage/Convertable$ConversionSession; c createAccess
# Missed mappings - these should work as they are unmodified by CraftBukkit but don't for some reason
c net/minecraft/network/NetworkManager net/minecraft/network/Connection
m (Lnet/minecraft/network/protocol/Packet;Lio/netty/util/concurrent/GenericFutureListener;Lnet/minecraft/network/EnumProtocol;Lnet/minecraft/network/EnumProtocol;)V a doSendPacket
c net/minecraft/server/gui/ServerGUI net/minecraft/server/gui/MinecraftServerGui
m (Ljavax/swing/JTextArea;Ljavax/swing/JScrollPane;Ljava/lang/String;)V a print
c net/minecraft/server/level/PlayerChunk net/minecraft/server/level/ChunkHolder
m (Lnet/minecraft/world/level/World;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/world/level/block/state/IBlockData;)V a broadcastBlockEntityIfNeeded
c net/minecraft/server/level/PlayerChunkMap net/minecraft/server/level/ChunkMap
m (Lnet/minecraft/world/level/chunk/ChunkStatus;I)Lnet/minecraft/world/level/chunk/ChunkStatus; a getDependencyStatus
c net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetSet net/minecraft/world/entity/ai/behavior/StartAttacking
m (Lnet/minecraft/world/entity/EntityInsentient;Lnet/minecraft/world/entity/EntityLiving;)V a setAttackTarget
c net/minecraft/world/entity/ai/behavior/BehaviorMakeLove net/minecraft/world/entity/ai/behavior/VillagerMakeLove
m (Lnet/minecraft/world/entity/npc/EntityVillager;Lnet/minecraft/core/BlockPosition;)Z a canReach
c net/minecraft/world/level/block/MultifaceBlock net/minecraft/world/level/block/MultifaceBlock
m (Lnet/minecraft/world/level/block/state/IBlockData;Lnet/minecraft/world/level/IBlockAccess;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/core/EnumDirection;)Lnet/minecraft/world/level/block/state/IBlockData; c getStateForPlacement
c net/minecraft/server/players/UserCache net/minecraft/server/players/GameProfileCache
m (Ljava/lang/String;)Ljava/util/Optional; getProfile get
p 0 name

View File

@ -22,7 +22,3 @@ c net/minecraft/world/level/chunk/LevelChunk net/minecraft/world/level/chunk/Chu
# Paper changes type # Paper changes type
c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials
f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId bw f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId bw
# Remove streams from Mob AI System changes type from EnumSet to com.destroystokyo.paper.util.set.OptimizedSmallEnumSet
c net/minecraft/world/entity/ai/goal/Goal net/minecraft/world/entity/ai/goal/PathfinderGoal
m ()Lcom/destroystokyo/paper/util/set/OptimizedSmallEnumSet; getFlags i

View File

@ -2,7 +2,7 @@ plugins {
java java
`maven-publish` `maven-publish`
id("com.github.johnrengelman.shadow") version "7.1.0" apply false id("com.github.johnrengelman.shadow") version "7.1.0" apply false
id("io.papermc.paperweight.core") version "1.1.14" id("io.papermc.paperweight.core") version "1.2.0"
} }
allprojects { allprojects {

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -1403,21 +1403,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- // CraftBukkit start - // CraftBukkit start
+ // CraftBukkit start // Paper start - Adventure + // CraftBukkit start // Paper start - Adventure
Player player = this.player.getBukkitEntity(); Player player = this.player.getBukkitEntity();
int x = packetplayinupdatesign.getPos().getX(); int x = packet.getPos().getX();
int y = packetplayinupdatesign.getPos().getY(); int y = packet.getPos().getY();
int z = packetplayinupdatesign.getPos().getZ(); int z = packet.getPos().getZ();
- String[] lines = new String[4]; - String[] lines = new String[4];
+ List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>(); + List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < signText.size(); ++i) {
- TextFilter.FilteredText itextfilter_a = (TextFilter.FilteredText) list.get(i); - TextFilter.FilteredText itextfilter_a = (TextFilter.FilteredText) signText.get(i);
- + TextFilter.FilteredText currentLine = signText.get(i);
if (this.player.isTextFilteringEnabled()) { if (this.player.isTextFilteringEnabled()) {
- lines[i] = ChatFormatting.stripFormatting(new TextComponent(ChatFormatting.stripFormatting(itextfilter_a.getFiltered())).getString()); - lines[i] = ChatFormatting.stripFormatting(new TextComponent(ChatFormatting.stripFormatting(itextfilter_a.getFiltered())).getString());
+ lines.add(net.kyori.adventure.text.Component.text(list.get(i).getFiltered())); + lines.add(net.kyori.adventure.text.Component.text(currentLine.getFiltered()));
} else { } else {
- lines[i] = ChatFormatting.stripFormatting(new TextComponent(ChatFormatting.stripFormatting(itextfilter_a.getRaw())).getString()); - lines[i] = ChatFormatting.stripFormatting(new TextComponent(ChatFormatting.stripFormatting(itextfilter_a.getRaw())).getString());
+ lines.add(net.kyori.adventure.text.Component.text(list.get(i).getRaw())); + lines.add(net.kyori.adventure.text.Component.text(currentLine.getRaw()));
} }
} }
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines); SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);

View File

@ -91,11 +91,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1) { private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1) {
+ // Paper start - add flush parameter + // Paper start - add flush parameter
+ this.doSendPacket(packet, genericfuturelistener, enumprotocol, enumprotocol1, true); + this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, true);
+ } + }
+ private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) { + private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) {
+ // Paper end - add flush parameter + // Paper end - add flush parameter
if (enumprotocol != enumprotocol1) { if (enumprotocol != enumprotocol1) {
this.setProtocol(enumprotocol); this.setProtocol(enumprotocol);
@ -107,8 +107,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- ChannelFuture channelfuture = this.channel.writeAndFlush(packet); - ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
+ ChannelFuture channelfuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); // Paper - add flush parameter + ChannelFuture channelfuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); // Paper - add flush parameter
if (genericfuturelistener != null) { if (callback != null) {
channelfuture.addListener(genericfuturelistener); channelfuture.addListener(callback);
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} }
private boolean processQueue() { private boolean processQueue() {

View File

@ -2782,15 +2782,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
} }
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
+ // Paper start - add isUrgent - old sig left in place for dirty nms plugins + // Paper start - add isUrgent - old sig left in place for dirty nms plugins
+ return getChunkFutureMainThread(i, j, chunkstatus, flag, false); + return getChunkFutureMainThread(chunkX, chunkZ, leastStatus, create, false);
+ } + }
+ private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag, boolean isUrgent) { + private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create, boolean isUrgent) {
+ // Paper end + // Paper end
ChunkPos chunkcoordintpair = new ChunkPos(i, j); ChunkPos chunkcoordintpair = new ChunkPos(chunkX, chunkZ);
long k = chunkcoordintpair.toLong(); long k = chunkcoordintpair.toLong();
int l = 33 + ChunkStatus.getDistance(chunkstatus); int l = 33 + ChunkStatus.getDistance(leastStatus);
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
public boolean pollTask() { public boolean pollTask() {

View File

@ -9,14 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
TextFilter.FilteredText currentLine = signText.get(i);
for (int i = 0; i < list.size(); ++i) {
if (this.player.isTextFilteringEnabled()) { if (this.player.isTextFilteringEnabled()) {
- lines.add(net.kyori.adventure.text.Component.text(list.get(i).getFiltered())); - lines.add(net.kyori.adventure.text.Component.text(currentLine.getFiltered()));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getFiltered()))); + lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getFiltered())));
} else { } else {
- lines.add(net.kyori.adventure.text.Component.text(list.get(i).getRaw())); - lines.add(net.kyori.adventure.text.Component.text(currentLine.getRaw()));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getRaw()))); + lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getRaw())));
} }
} }
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines); SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);

View File

@ -1040,7 +1040,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1; return ichunkaccess1;
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
if (flag && !currentlyUnloading) { if (create && !currentlyUnloading) {
// CraftBukkit end // CraftBukkit end
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair); this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
+ if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority + if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority
@ -1053,13 +1053,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
playerchunk = this.getVisibleChunkIfPresent(k); playerchunk = this.getVisibleChunkIfPresent(k);
gameprofilerfiller.pop(); gameprofilerfiller.pop();
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
}
} }
} }
-
- return this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(chunkstatus, this.chunkMap); - return this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(leastStatus, this.chunkMap);
+ // Paper start - Chunk priority + // Paper start - Chunk priority
+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(chunkstatus, this.chunkMap); + CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(leastStatus, this.chunkMap);
+ if (isUrgent) { + if (isUrgent) {
+ future.thenAccept(either -> this.distanceManager.clearUrgent(chunkcoordintpair)); + future.thenAccept(either -> this.distanceManager.clearUrgent(chunkcoordintpair));
+ } + }

View File

@ -34,25 +34,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < signText.size(); ++i) {
TextFilter.FilteredText currentLine = signText.get(i);
+ // Paper start - cap line length - modified clients can send longer data than normal + // Paper start - cap line length - modified clients can send longer data than normal
+ net.minecraft.server.network.TextFilter.FilteredText currentLine = list.get(i);
+ if (MAX_SIGN_LINE_LENGTH > 0 && currentLine.getRaw().length() > MAX_SIGN_LINE_LENGTH) { + if (MAX_SIGN_LINE_LENGTH > 0 && currentLine.getRaw().length() > MAX_SIGN_LINE_LENGTH) {
+ // This handles multibyte characters as 1 + // This handles multibyte characters as 1
+ int offset = currentLine.getRaw().codePoints().limit(MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum(); + int offset = currentLine.getRaw().codePoints().limit(MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum();
+ if (offset < currentLine.getRaw().length()) { + if (offset < currentLine.getRaw().length()) {
+ list.set(i, currentLine = net.minecraft.server.network.TextFilter.FilteredText.passThrough(currentLine.getRaw().substring(0, offset))); // this will break any filtering, but filtering is NYI as of 1.17 + signText.set(i, currentLine = net.minecraft.server.network.TextFilter.FilteredText.passThrough(currentLine.getRaw().substring(0, offset))); // this will break any filtering, but filtering is NYI as of 1.17
+ } + }
+ } + }
+ // Paper end + // Paper end
if (this.player.isTextFilteringEnabled()) { if (this.player.isTextFilteringEnabled()) {
- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getFiltered()))); lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getFiltered())));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getFiltered())));
} else {
- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getRaw())));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getRaw())));
}
}
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);

View File

@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (nbt.contains("SpawnPotentials", 9)) { if (nbt.contains("SpawnPotentials", 9)) {
@@ -0,0 +0,0 @@ public abstract class BaseSpawner { @@ -0,0 +0,0 @@ public abstract class BaseSpawner {
this.setSpawnData(world, pos, mobspawnerdata); this.setNextSpawnData(world, pos, mobspawnerdata);
}); });
} }
- -
@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ entity.put("Item", item.save(new net.minecraft.nbt.CompoundTag())); + entity.put("Item", item.save(new net.minecraft.nbt.CompoundTag()));
+ compound.put("Entity", entity); + compound.put("Entity", entity);
+ compound.putInt("Weight", this.getSnapshotNBT().contains("Weight", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_ANY_NUMBER) ? this.getSnapshotNBT().getInt("Weight") : 1); + compound.putInt("Weight", this.getSnapshotNBT().contains("Weight", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_ANY_NUMBER) ? this.getSnapshotNBT().getInt("Weight") : 1);
+ this.getSnapshot().getSpawner().setSpawnData(world.getHandle(), getPosition(), new net.minecraft.world.level.SpawnData(compound)); + this.getSnapshot().getSpawner().setNextSpawnData(world.getHandle(), getPosition(), new net.minecraft.world.level.SpawnData(compound));
+ this.getSnapshot().getSpawner().spawnPotentials= net.minecraft.world.level.BaseSpawner.EMPTY_POTENTIALS; + this.getSnapshot().getSpawner().spawnPotentials= net.minecraft.world.level.BaseSpawner.EMPTY_POTENTIALS;
+ } + }
+ // Paper end + // Paper end

View File

@ -157,8 +157,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
ChannelFuture channelfuture = this.channel.writeAndFlush(packet); ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
if (genericfuturelistener != null) { if (callback != null) {
channelfuture.addListener(genericfuturelistener); channelfuture.addListener(callback);
} }
+ // Paper start + // Paper start
+ if (packet.hasFinishListener()) { + if (packet.hasFinishListener()) {

View File

@ -14,15 +14,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private long syncLoadCounter; // Paper - prevent plugin unloads from removing our ticket + private long syncLoadCounter; // Paper - prevent plugin unloads from removing our ticket
+ +
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
// Paper start - add isUrgent - old sig left in place for dirty nms plugins // Paper start - add isUrgent - old sig left in place for dirty nms plugins
return getChunkFutureMainThread(i, j, chunkstatus, flag, false); return getChunkFutureMainThread(chunkX, chunkZ, leastStatus, create, false);
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
ChunkHolder.FullChunkStatus currentChunkState = ChunkHolder.getFullChunkStatus(playerchunk.getTicketLevel()); ChunkHolder.FullChunkStatus currentChunkState = ChunkHolder.getFullChunkStatus(playerchunk.getTicketLevel());
currentlyUnloading = (oldChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !currentChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)); currentlyUnloading = (oldChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !currentChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER));
} }
+ final Long identifier; // Paper - prevent plugin unloads from removing our ticket + final Long identifier; // Paper - prevent plugin unloads from removing our ticket
if (flag && !currentlyUnloading) { if (create && !currentlyUnloading) {
// CraftBukkit end // CraftBukkit end
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair); this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
+ identifier = Long.valueOf(this.syncLoadCounter++); // Paper - prevent plugin unloads from removing our ticket + identifier = Long.valueOf(this.syncLoadCounter++); // Paper - prevent plugin unloads from removing our ticket
@ -39,11 +39,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
} }
- } - }
+ } else { identifier = null; } // Paper - prevent plugin unloads from removing our ticket + } else { identifier = null; } // Paper - prevent plugin unloads from removing our ticket
// Paper start - Chunk priority // Paper start - Chunk priority
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(chunkstatus, this.chunkMap); CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(leastStatus, this.chunkMap);
+ // Paper start - prevent plugin unloads from removing our ticket + // Paper start - prevent plugin unloads from removing our ticket
+ if (flag && !currentlyUnloading) { + if (create && !currentlyUnloading) {
+ future.thenAcceptAsync((either) -> { + future.thenAcceptAsync((either) -> {
+ ServerChunkCache.this.distanceManager.removeTicketAtLevel(TicketType.REQUIRED_LOAD, chunkcoordintpair, l, identifier); + ServerChunkCache.this.distanceManager.removeTicketAtLevel(TicketType.REQUIRED_LOAD, chunkcoordintpair, l, identifier);
+ }, ServerChunkCache.this.mainThreadProcessor); + }, ServerChunkCache.this.mainThreadProcessor);