more work work work

This commit is contained in:
Aurora 2021-06-14 12:42:08 +02:00
parent d2cb88db9c
commit 8ca5a642ef
No known key found for this signature in database
GPG Key ID: 89839F67B53656AD
32 changed files with 267 additions and 264 deletions

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add #setMaxPlayers API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 1eaf6aae1e13c48a7f911e523015cb9b8cca8638..6228d7eca85fba52296c8d63d32804f32af1b421 100644
index 26099f95d68540d4e6c54c32fd9699ff01660236..af0cf1fe3db1efd39bc06a89216413fc4415b007 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -171,6 +171,17 @@ public final class Bukkit {
@ -27,7 +27,7 @@ index 1eaf6aae1e13c48a7f911e523015cb9b8cca8638..6228d7eca85fba52296c8d63d32804f3
* Get the game port that the server runs on.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 8ee02c3d6cc8751704e5993fecd05293714e492f..6237578b373002c009efde4fb4c1864f0bf4f19e 100644
index 864211431ebfe9bb333943c31892dfcbdeb33037..64316a3bcba881f9366d9bf9e16b205e2b817707 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -144,6 +144,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View File

@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..df05153397b42930cd53d37b30824c7e
+ }
+}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 6441d4e45e5d5f008f95233cdc34048b8be38592..e20d863d1308b470a294cb7ab022aac4b9a91f71 100644
index 10c22809535b6151b45aa18a02b80b8f2e3e6dff..27d97cde0fb5f6d727656c291e34dc468200f0c0 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -70,6 +70,12 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 2530c811f52f51d6338900221b4681c952c1c752..828b2b0538d4f936bee57d9fca55774723e13970 100644
index e53f641e11dc74c99e656e985caa7c5943fb53a4..6bc4f12e4ef35979c9d99273d14d7b31833d3f75 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2044,6 +2044,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2071,6 +2071,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
// Paper end
}

View File

@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 4 Aug 2020 22:24:15 +0200
Subject: [PATCH] Optimize Pathfinder - Remove Streams / Optimized collections
1.17 Update: Please do this k thx bb
I utilized the IDE to convert streams to non streams code, so shouldn't
be any risk of behavior change. Only did minor optimization of the
generated code set to remove unnecessary things.

View File

@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Wed, 12 Aug 2020 11:33:04 +0200
Subject: [PATCH] Import fastutil classes
1.17: YEET
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
index 95e166aa63f42c675df645a56e313bdffc2e8663..05f7d4a3835536f26f741d54a0884bd43fc82967 100644

View File

@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Fri, 14 Aug 2020 23:59:26 +0200
Subject: [PATCH] Remove armour stand double add to world
1.17 Update: YEET (?)
diff --git a/src/main/java/net/minecraft/world/item/ArmorStandItem.java b/src/main/java/net/minecraft/world/item/ArmorStandItem.java
index a2dfcaac8a2a4a69e703de43be76d4fe369fd647..bed063497bb593683ea384605ae1a71a68f4fc1b 100644

View File

@ -2,6 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jmp <jasonpenilla2@me.com>
Date: Thu, 20 Aug 2020 19:24:13 -0700
Subject: [PATCH] Fix MC-99259 Wither Boss Bar doesn't update until
1.17 Update: This issue is marked as fixed on 1.17 - yeet!
invulnerability period is over

View File

@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: ishland <ishlandmc@yeah.net>
Date: Sun, 23 Aug 2020 10:57:44 +0200
Subject: [PATCH] Fix MC-197271
Update 1.17: Fixed in openj9-0.23.0-m2 release
This patch only fixes an issue for servers running OpenJ9.
diff --git a/src/main/java/net/minecraft/data/BuiltinRegistries.java b/src/main/java/net/minecraft/data/BuiltinRegistries.java

View File

@ -2,7 +2,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 21 Aug 2020 21:05:28 -0400
Subject: [PATCH] MC-197883: Bandaid decode issue
1.17 Update: Marked as fixed in 1.17 on mojira, yeet
Mojang has a mix of type and name in the data sets, but you can only
use one.

View File

@ -1,94 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Mon, 13 Jul 2020 06:22:54 -0700
Subject: [PATCH] Fix AdvancementDataPlayer leak due from quitting early in
login
Move the criterion storage to the AdvancementDataPlayer object
itself, so the criterion object stores no references - and thus
needs no cleanup.
diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
index 31650e41b37e322d2e8a4d4a3deec95851e72675..a645c79af856d2484a4ce7aa2885a32358b9a480 100644
--- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
+++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
@@ -16,25 +16,25 @@ import net.minecraft.world.level.storage.loot.LootContext;
public abstract class SimpleCriterionTrigger<T extends AbstractCriterionTriggerInstance> implements CriterionTrigger<T> {
- private final Map<PlayerAdvancements, Set<CriterionTrigger.Listener<T>>> a = Maps.newIdentityHashMap();
+ //private final Map<AdvancementDataPlayer, Set<CriterionTrigger.a<T>>> a = Maps.newIdentityHashMap(); // Paper - moved into AdvancementDataPlayer to fix memory leak
public SimpleCriterionTrigger() {}
@Override
public final void a(PlayerAdvancements advancementdataplayer, CriterionTrigger.Listener<T> criteriontrigger_a) {
- ((Set) this.a.computeIfAbsent(advancementdataplayer, (advancementdataplayer1) -> {
+ (advancementdataplayer.criterionData.computeIfAbsent(this, (advancementdataplayer1) -> { // Paper - fix AdvancementDataPlayer leak
return Sets.newHashSet();
})).add(criteriontrigger_a);
}
@Override
public final void b(PlayerAdvancements advancementdataplayer, CriterionTrigger.Listener<T> criteriontrigger_a) {
- Set<CriterionTrigger.Listener<T>> set = (Set) this.a.get(advancementdataplayer);
+ Set<CriterionTrigger.Listener<T>> set = (Set) advancementdataplayer.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak
if (set != null) {
set.remove(criteriontrigger_a);
if (set.isEmpty()) {
- this.a.remove(advancementdataplayer);
+ advancementdataplayer.criterionData.remove(this); // Paper - fix AdvancementDataPlayer leak
}
}
@@ -42,7 +42,7 @@ public abstract class SimpleCriterionTrigger<T extends AbstractCriterionTriggerI
@Override
public final void removePlayerListeners(PlayerAdvancements tracker) {
- this.a.remove(tracker);
+ advancementdataplayer.criterionData.remove(this); // Paper - fix AdvancementDataPlayer leak
}
protected abstract T createInstance(JsonObject obj, EntityPredicate.Composite playerPredicate, DeserializationContext predicateDeserializer);
@@ -56,7 +56,7 @@ public abstract class SimpleCriterionTrigger<T extends AbstractCriterionTriggerI
protected void trigger(ServerPlayer player, Predicate<T> tester) {
PlayerAdvancements advancementdataplayer = player.getAdvancements();
- Set<CriterionTrigger.Listener<T>> set = (Set) this.a.get(advancementdataplayer);
+ Set<CriterionTrigger.Listener<T>> set = (Set) advancementdataplayer.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak
if (set != null && !set.isEmpty()) {
LootContext loottableinfo = EntityPredicate.createContext(player, player);
@@ -67,7 +67,7 @@ public abstract class SimpleCriterionTrigger<T extends AbstractCriterionTriggerI
while (iterator.hasNext()) {
criteriontrigger_a = (CriterionTrigger.Listener) iterator.next();
- T t0 = (AbstractCriterionTriggerInstance) criteriontrigger_a.a();
+ T t0 = (T) criteriontrigger_a.a(); // Paper - decompile fix
if (t0.getPlayerPredicate().matches(loottableinfo) && tester.test(t0)) {
if (list == null) {
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index af8553f1b22e24fbeb732937fbbffc95cb9dfe90..acb41cc3965154c5b515cd8e808bf2cf5dc850e4 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -39,6 +39,7 @@ import net.minecraft.advancements.Criterion;
import net.minecraft.advancements.CriterionProgress;
import net.minecraft.advancements.CriterionTrigger;
import net.minecraft.advancements.CriterionTriggerInstance;
+import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.protocol.game.ClientboundSelectAdvancementsTabPacket;
@@ -69,6 +70,10 @@ public class PlayerAdvancements {
private Advancement lastSelectedTab;
private boolean isFirstPacket = true;
+ // Paper start - fix advancement data player leakage
+ public final Map<SimpleCriterionTrigger, Set<CriterionTrigger.Listener>> criterionData = Maps.newIdentityHashMap();
+ // Paper end - fix advancement data player leakage
+
public PlayerAdvancements(DataFixer datafixer, PlayerList playerlist, ServerAdvancementManager advancementdataworld, File file, ServerPlayer entityplayer) {
this.dataFixer = datafixer;
this.playerList = playerlist;

View File

@ -1,45 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 15 Aug 2020 08:04:49 -0500
Subject: [PATCH] Fix MC-187716 Use configured height
diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java
index 3f297ef7bde4159c77681574966446a0eba03f25..ff17c76f341028dd6d17f4c1f13f442c2e404532 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java
@@ -44,7 +44,7 @@ public abstract class NetherCappedSurfaceBuilder extends SurfaceBuilder<SurfaceB
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
BlockState iblockdata4 = chunk.getBlockState(blockposition_mutableblockposition.set(k1, 128, l1));
- for (int k2 = 127; k2 >= 0; --k2) {
+ for (int k2 = height; k2 >= 0; --k2) { // Paper - fix MC-187716 - use configured height
blockposition_mutableblockposition.set(k1, k2, l1);
BlockState iblockdata5 = chunk.getBlockState(blockposition_mutableblockposition);
int l2;
diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java
index 4d6c03048022442dea467e1d9d018f150adc62c7..f64671b7359fb71e8af578d48d0a3c211e315057 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java
@@ -34,7 +34,7 @@ public class NetherForestSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBas
int j2 = -1;
BlockState iblockdata2 = surfaceBlocks.getUnderMaterial();
- for (int k2 = 127; k2 >= 0; --k2) {
+ for (int k2 = height; k2 >= 0; --k2) { // Paper - fix MC-187716 - use configured height
blockposition_mutableblockposition.set(k1, k2, l1);
BlockState iblockdata3 = surfaceBlocks.getTopMaterial();
BlockState iblockdata4 = chunk.getBlockState(blockposition_mutableblockposition);
diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java
index c1e0fd7813786bf1cc03b08b204007711575f144..b222890e7bdff2c1470841677a99d4423f9c9d7f 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java
@@ -36,7 +36,7 @@ public class NetherSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBaseConfi
BlockState iblockdata2 = surfaceBlocks.getTopMaterial();
BlockState iblockdata3 = surfaceBlocks.getUnderMaterial();
- for (int k2 = 127; k2 >= 0; --k2) {
+ for (int k2 = height; k2 >= 0; --k2) { // Paper - fix MC-187716 - use configured height
blockposition_mutableblockposition.set(k1, k2, l1);
BlockState iblockdata4 = chunk.getBlockState(blockposition_mutableblockposition);

View File

@ -10,10 +10,10 @@ This fixes that by checking if the modified spawn location is
still at a respawn anchor.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa62846922ab531f 100644
index 66735bbc2528c5812c9df14ef7cd91cb69d903b2..9c594c0f142ca10b7c1df50faf45ccb3f7468ba9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -84,6 +84,7 @@ import net.minecraft.world.level.GameType;
@@ -77,6 +77,7 @@ import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.Blocks;
@ -21,7 +21,7 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.border.BorderChangeListener;
import net.minecraft.world.level.border.WorldBorder;
@@ -846,6 +847,7 @@ public abstract class PlayerList {
@@ -821,6 +822,7 @@ public abstract class PlayerList {
// Paper start
boolean isBedSpawn = false;
boolean isRespawn = false;
@ -29,7 +29,7 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469
// Paper end
// CraftBukkit start - fire PlayerRespawnEvent
@@ -856,7 +858,7 @@ public abstract class PlayerList {
@@ -831,7 +833,7 @@ public abstract class PlayerList {
Optional optional;
if (blockposition != null) {
@ -38,7 +38,7 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469
} else {
optional = Optional.empty();
}
@@ -899,7 +901,12 @@ public abstract class PlayerList {
@@ -874,7 +876,12 @@ public abstract class PlayerList {
}
// Spigot End
@ -52,7 +52,7 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469
if (!flag) entityplayer.reset(); // SPIGOT-4785
isRespawn = true; // Paper
} else {
@@ -937,8 +944,12 @@ public abstract class PlayerList {
@@ -911,8 +918,12 @@ public abstract class PlayerList {
}
// entityplayer1.syncInventory();
entityplayer1.setHealth(entityplayer1.getHealth());
@ -66,4 +66,4 @@ index f36c92e42300c2056075610caf63f8bef0e7edda..882cd25c9610f0b995c27291aa628469
+ // Paper end
}
// Added from changeDimension
sendAllPlayerInfo(entityplayer); // Update health, etc...
this.sendAllPlayerInfo(entityplayer); // Update health, etc...

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 855b3b4c90d84d4efa8395a76010b4b194591cbc..4e353432281a6dbbb49eaa4a6cb4eb051d1a08c5 100644
index 7ce854edba32ffcafaa5268d4bb2822a5233e40b..3d6e09a3f028e50c08cbbb6b426f5b044c7b9e67 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -124,11 +124,20 @@ public class Main {
@@ -129,11 +129,20 @@ public class Main {
return;
}
@ -29,5 +29,5 @@ index 855b3b4c90d84d4efa8395a76010b4b194591cbc..4e353432281a6dbbb49eaa4a6cb4eb05
- GameProfileCache usercache = new GameProfileCache(gameprofilerepository, new File(file, MinecraftServer.USERID_CACHE_FILE.getName()));
+ GameProfileCache usercache = new GameProfileCache(gameprofilerepository, userCacheFile); // Paper - only move usercache.json into folder if --universe is used, not world-container
// CraftBukkit start
String s = (String) Optional.ofNullable(optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 4e353432281a6dbbb49eaa4a6cb4eb051d1a08c5..9dc9a5e6ad7f23c8bf3553c765ceeecd67a49ac1 100644
index 3d6e09a3f028e50c08cbbb6b426f5b044c7b9e67..ea136b9ad3a2a07076e12b8656c68f63aa4718c8 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -124,6 +124,7 @@ public class Main {
@@ -129,6 +129,7 @@ public class Main {
return;
}

View File

@ -0,0 +1,82 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Mon, 13 Jul 2020 06:22:54 -0700
Subject: [PATCH] Fix AdvancementDataPlayer leak due from quitting early in
login
Move the criterion storage to the AdvancementDataPlayer object
itself, so the criterion object stores no references - and thus
needs no cleanup.
diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
index 584f48aba7bfec07a75b5a37da4ba7439610543c..c25c1cfca010ed625b6faf310be2edeccd6667bc 100644
--- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
+++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
@@ -14,22 +14,24 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.storage.loot.LootContext;
public abstract class SimpleCriterionTrigger<T extends AbstractCriterionTriggerInstance> implements CriterionTrigger<T> {
- private final Map<PlayerAdvancements, Set<CriterionTrigger.Listener<T>>> players = Maps.newIdentityHashMap();
+ //private final Map<PlayerAdvancements, Set<CriterionTrigger.Listener<T>>> players = Maps.newIdentityHashMap(); // Paper - moved into AdvancementDataPlayer to fix memory leak
+
+ public SimpleCriterionTrigger() {}
@Override
public final void addPlayerListener(PlayerAdvancements manager, CriterionTrigger.Listener<T> conditions) {
- this.players.computeIfAbsent(manager, (managerx) -> {
+ manager.criterionData.computeIfAbsent(this, (managerx) -> { // Paper - fix AdvancementDataPlayer leak
return Sets.newHashSet();
}).add(conditions);
}
@Override
public final void removePlayerListener(PlayerAdvancements manager, CriterionTrigger.Listener<T> conditions) {
- Set<CriterionTrigger.Listener<T>> set = this.players.get(manager);
+ Set<CriterionTrigger.Listener<T>> set = (Set) manager.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak
if (set != null) {
set.remove(conditions);
if (set.isEmpty()) {
- this.players.remove(manager);
+ manager.criterionData.remove(this); // Paper - fix AdvancementDataPlayer leak
}
}
@@ -37,7 +39,7 @@ public abstract class SimpleCriterionTrigger<T extends AbstractCriterionTriggerI
@Override
public final void removePlayerListeners(PlayerAdvancements tracker) {
- this.players.remove(tracker);
+ tracker.criterionData.remove(this); // Paper - fix AdvancementDataPlayer leak
}
protected abstract T createInstance(JsonObject obj, EntityPredicate.Composite playerPredicate, DeserializationContext predicateDeserializer);
@@ -50,7 +52,7 @@ public abstract class SimpleCriterionTrigger<T extends AbstractCriterionTriggerI
protected void trigger(ServerPlayer player, Predicate<T> tester) {
PlayerAdvancements playerAdvancements = player.getAdvancements();
- Set<CriterionTrigger.Listener<T>> set = this.players.get(playerAdvancements);
+ Set<CriterionTrigger.Listener<T>> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak
if (set != null && !set.isEmpty()) {
LootContext lootContext = EntityPredicate.createContext(player, player);
List<CriterionTrigger.Listener<T>> list = null;
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index ce02a467c1c3434f2cdb112ceb9794196069a820..e05e5710c81b7dbb648afbfe16f843e7ae310752 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -39,6 +39,7 @@ import net.minecraft.advancements.Criterion;
import net.minecraft.advancements.CriterionProgress;
import net.minecraft.advancements.CriterionTrigger;
import net.minecraft.advancements.CriterionTriggerInstance;
+import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.protocol.game.ClientboundSelectAdvancementsTabPacket;
@@ -70,6 +71,8 @@ public class PlayerAdvancements {
private Advancement lastSelectedTab;
private boolean isFirstPacket = true;
+ public final Map<SimpleCriterionTrigger, Set<CriterionTrigger.Listener>> criterionData = Maps.newIdentityHashMap(); // Paper - fix advancement data player leakage
+
public PlayerAdvancements(DataFixer dataFixer, PlayerList playerManager, ServerAdvancementManager advancementLoader, File advancementFile, ServerPlayer owner) {
this.dataFixer = dataFixer;
this.playerList = playerManager;

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add missing strikeLighting call to
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 4436b3d23dc8f33925da1ec539ea16307e0785b9..793b1309528671ce822d5a484ff9e40d6eba4e9d 100644
index f72471ac82907a0d5112598b3289689495285944..d79a711d4080ad8acb2c240870be9d99a0b84cea 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2609,6 +2609,7 @@ public class CraftWorld implements World {
@@ -2623,6 +2623,7 @@ public class CraftWorld implements World {
lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() );
lightning.visualOnly = true;
lightning.isSilent = isSilent;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix some rails connecting improperly
diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
index 1a44c8b41928a83a22b53d1b6f45ce39b4caf2b2..7cef6d1fc2045c62d4e96a0fd0a311d089cb1406 100644
index 41c23abf78c2ca95c26633860adb9360139b3ceb..1242eb55996bca8a63bd7b95d01d0299fb36d105 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
@@ -62,6 +62,7 @@ public abstract class BaseRailBlock extends Block {
@@ -65,6 +65,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl
state = this.updateDir(world, pos, state, true);
if (this.isStraight) {
state.neighborChanged(world, pos, this, pos, notify);
@ -17,7 +17,7 @@ index 1a44c8b41928a83a22b53d1b6f45ce39b4caf2b2..7cef6d1fc2045c62d4e96a0fd0a311d0
return state;
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
index 0ab1e15d8575c3e90a10b80b94030e15a01faac9..1854809e045300e84a713dc7c3a8264f53ec6c0f 100644
index 2335e7af6bc16a0d65c7818c316f3194c680c69d..63c7f2cf530ac9562960ae5a3cbc6e511a009377 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -70,6 +70,7 @@ public class DetectorRailBlock extends BaseRailBlock {
@ -27,15 +27,15 @@ index 0ab1e15d8575c3e90a10b80b94030e15a01faac9..1854809e045300e84a713dc7c3a8264f
+ if (state.getBlock() != this) { return; } // Paper - not our block, don't do anything
boolean flag = (Boolean) state.getValue(DetectorRailBlock.POWERED);
boolean flag1 = false;
List<AbstractMinecart> list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (Predicate) null);
List<AbstractMinecart> list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> {
diff --git a/src/main/java/net/minecraft/world/level/block/RailState.java b/src/main/java/net/minecraft/world/level/block/RailState.java
index 0d824ab98dcdd6ea9dac025c37970fb4ec464131..4c17bec369fb19f47760e30b391b2128cee6b276 100644
index a205e04bce8706302e4a077646749d05dee98251..0f24187dc3f1340d142f88cbac64c4f5c333e5b8 100644
--- a/src/main/java/net/minecraft/world/level/block/RailState.java
+++ b/src/main/java/net/minecraft/world/level/block/RailState.java
@@ -12,13 +12,19 @@ import net.minecraft.world.level.block.state.properties.RailShape;
@@ -10,13 +10,19 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.RailShape;
public class RailState {
- private final Level level;
- private final BlockPos pos;
+ private final Level level; public final Level getWorld() { return this.level; } // Paper - OBFHELPER
@ -55,7 +55,7 @@ index 0d824ab98dcdd6ea9dac025c37970fb4ec464131..4c17bec369fb19f47760e30b391b2128
public RailState(Level world, BlockPos pos, BlockState state) {
this.level = world;
this.pos = pos;
@@ -153,6 +159,11 @@ public class RailState {
@@ -143,6 +149,11 @@ public class RailState {
}
private void connectTo(RailState placementHelper) {
@ -65,10 +65,10 @@ index 0d824ab98dcdd6ea9dac025c37970fb4ec464131..4c17bec369fb19f47760e30b391b2128
+ }
+ // Paper end - prevent desync
this.connections.add(placementHelper.pos);
BlockPos blockposition = this.pos.north();
BlockPos blockposition1 = this.pos.south();
@@ -347,11 +358,16 @@ public class RailState {
this.state = (BlockState) this.state.setValue(this.block.getShapeProperty(), blockpropertytrackposition1);
BlockPos blockPos = this.pos.north();
BlockPos blockPos2 = this.pos.south();
@@ -333,10 +344,15 @@ public class RailState {
this.state = this.state.setValue(this.block.getShapeProperty(), railShape2);
if (forceUpdate || this.level.getBlockState(this.pos) != this.state) {
this.level.setBlock(this.pos, this.state, 3);
+ // Paper start - prevent desync
@ -77,15 +77,14 @@ index 0d824ab98dcdd6ea9dac025c37970fb4ec464131..4c17bec369fb19f47760e30b391b2128
+ }
+ // Paper end - prevent desync
for (int i = 0; i < this.connections.size(); ++i) {
RailState minecarttracklogic = this.getRail((BlockPos) this.connections.get(i));
- if (minecarttracklogic != null) {
+ if (minecarttracklogic != null && minecarttracklogic.isValid()) { // Paper - prevent desync
minecarttracklogic.removeSoftConnections();
if (minecarttracklogic.canConnectTo(this)) {
minecarttracklogic.connectTo(this);
@@ -364,6 +380,6 @@ public class RailState {
for(int i = 0; i < this.connections.size(); ++i) {
RailState railState = this.getRail(this.connections.get(i));
- if (railState != null) {
+ if (railState != null && railState.isValid()) { // Paper - prevent desync
railState.removeSoftConnections();
if (railState.canConnectTo(this)) {
railState.connectTo(this);
@@ -349,6 +365,6 @@ public class RailState {
}
public BlockState getState() {

View File

@ -25,44 +25,52 @@ index b67ba8f75e4a3358d7c2462918b85b0bf9b5a922..fdbd8b89bb8bf3b61f60b812b90483c9
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 19544b794b5a46c129016172798ff7294fcfed33..735c3c983e96e4e6f36de0975909fc48cb042081 100644
index 1feda8b44364c748497174944b26abc4f058f354..1889de77a5e3d9371005b6bd451e2c0e57e96a93 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1347,9 +1347,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
//if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit // Paper - move down
//MinecraftServer.LOGGER.debug("Autosave started"); // Paper
serverAutoSave = (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0); // Paper
+ // Paper start
+ int playerSaveInterval = com.destroystokyo.paper.PaperConfig.playerAutoSaveRate;
+ if (playerSaveInterval < 0) {
+ playerSaveInterval = autosavePeriod;
+ }
+ // Paper end
this.profiler.push("save");
- if (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0) { // Paper
@@ -955,7 +955,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.playerList != null) {
MinecraftServer.LOGGER.info("Saving players");
- this.playerList.saveAll();
+ if (playerSaveInterval > 0) { // Paper
this.playerList.removeAll(this.isRestarting); // Paper
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
@@ -1415,9 +1414,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit // Paper - move down
// MinecraftServer.LOGGER.debug("Autosave started"); // Paper
serverAutoSave = (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0); // Paper
+ // Paper start
+ int playerSaveInterval = com.destroystokyo.paper.PaperConfig.playerAutoSaveRate;
+ if (playerSaveInterval < 0) {
+ playerSaveInterval = autosavePeriod;
+ }
+ // Paper end
this.profiler.push("save");
- if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // Paper - moved from above
- this.playerList.saveAll();
+ if (playerSaveInterval > 0) { // Paper
+ this.playerList.savePlayers(playerSaveInterval); // Paper
}// Paper
// Paper start
for (ServerLevel world : getAllLevels()) {
// this.saveAllChunks(true, false, false); // Paper - saved incrementally below
} // Paper start
for (ServerLevel level : this.getAllLevels()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c5717f45a0110492aad41f21cc06fb8cbeb1f791..bd4d4ace35e966e819aa461d3962fe06ff402be7 100644
index cd34b5aa61c78d8138500a93f0a9714bedd7ed86..b49fa995973f860a95d937c98e2821435262ce25 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -173,6 +173,7 @@ import org.bukkit.inventory.MainHand;
public class ServerPlayer extends Player implements ContainerListener {
@@ -169,6 +169,7 @@ public class ServerPlayer extends Player {
public final int getViewDistance() { return this.getLevel().getChunkSource().chunkMap.viewDistance - 1; } // Paper - placeholder
private static final Logger LOGGER = LogManager.getLogger();
+ public long lastSave = MinecraftServer.currentTick; // Paper
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32;
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
public ServerGamePacketListenerImpl connection;
public Connection networkManager; // Paper
public final MinecraftServer server;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 882cd25c9610f0b995c27291aa62846922ab531f..b76735531ef96f9d4c870a5107feea01524a7670 100644
index 9c594c0f142ca10b7c1df50faf45ccb3f7468ba9..8c62367888af566dd9be4bb5cd301c26e0248e46 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -559,6 +559,7 @@ public abstract class PlayerList {
@@ -561,6 +561,7 @@ public abstract class PlayerList {
protected void save(ServerPlayer player) {
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
if (!player.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug)
@ -70,20 +78,21 @@ index 882cd25c9610f0b995c27291aa62846922ab531f..b76735531ef96f9d4c870a5107feea01
this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@@ -1218,10 +1219,21 @@ public abstract class PlayerList {
@@ -1198,10 +1199,21 @@ public abstract class PlayerList {
}
public void saveAll() {
- net.minecraft.server.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
+ // Paper start - incremental player saving
+ savePlayers(null);
+ }
+ public void savePlayers(Integer interval) {
MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
+ MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
MinecraftTimings.savePlayers.startTiming(); // Paper
+ int numSaved = 0;
+ long now = MinecraftServer.currentTick;
for (int i = 0; i < this.players.size(); ++i) {
- this.save((ServerPlayer) this.players.get(i));
- this.save(this.players.get(i));
+ ServerPlayer entityplayer = this.players.get(i);
+ if (interval == null || now - entityplayer.lastSave >= interval) {
+ this.save(entityplayer);

View File

@ -5,13 +5,13 @@ Subject: [PATCH] Don't mark null chunk sections for block updates
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 9e3629884709126574a52ad44fe7523f01dbcce9..82205ad13ef0e987bd83979d06331545efe0a60a 100644
index 1f67c9c5f7161ea687983e7ae0ec7d259da9acd3..32bcc55ce15d832e2182d89acecd715947b1667d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -449,6 +449,7 @@ public class ChunkHolder {
this.broadcastBlockEntityIfNeeded(world, blockposition, iblockdata);
@@ -315,6 +315,7 @@ public class ChunkHolder {
this.a(world, blockposition, iblockdata);
} else {
LevelChunkSection chunksection = chunk.getSections()[sectionposition.getY()];
LevelChunkSection chunksection = chunk.getSections()[j];
+ if (chunksection == null) chunksection = new LevelChunkSection(sectionposition.getY(), chunk, world, true); // Paper - make a new chunk section if none was found
ClientboundSectionBlocksUpdatePacket packetplayoutmultiblockchange = new ClientboundSectionBlocksUpdatePacket(sectionposition, shortset, chunksection, this.resendLight);

View File

@ -0,0 +1,51 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 15 Aug 2020 08:04:49 -0500
Subject: [PATCH] Fix MC-187716 Use configured height
diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java
index 5ad6e0ef718a1775a2310925b8273120687230b1..88fbd8a925d84184116051082514ef4d45c98acf 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherCappedSurfaceBuilder.java
@@ -1,4 +1,5 @@
package net.minecraft.world.level.levelgen.surfacebuilders;
+<<<<<<< found
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -42,7 +43,7 @@ public abstract class NetherCappedSurfaceBuilder extends SurfaceBuilder<SurfaceB
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
BlockState blockState3 = chunk.getBlockState(mutableBlockPos.set(k, 128, m));
- for(int p = 127; p >= i; --p) {
+ for(int p = height; p >= i; --p) { // Paper - fix MC-187716 - use configured height
mutableBlockPos.set(k, p, m);
BlockState blockState4 = chunk.getBlockState(mutableBlockPos);
if (blockState3.is(defaultBlock.getBlock()) && (blockState4.isAir() || blockState4 == defaultFluid)) {
diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java
index fbb756504609285d96e01c4079be06561f75331e..aa6be90ac272c7e1186d177768230b7f52371e68 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherForestSurfaceBuilder.java
@@ -34,7 +34,7 @@ public class NetherForestSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBas
int o = -1;
BlockState blockState = surfaceBuilderBaseConfiguration.getUnderMaterial();
- for(int p = 127; p >= i; --p) {
+ for(int p = height; p >= i; --p) { // Paper - fix MC-187716 - use configured height
mutableBlockPos.set(k, p, m);
BlockState blockState2 = surfaceBuilderBaseConfiguration.getTopMaterial();
BlockState blockState3 = chunk.getBlockState(mutableBlockPos);
diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java
index 0cdb3a1ca76375fc69d1709cdd34d4176a99a617..206f74305a01604892ff98ece0c8344cc5582d14 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/NetherSurfaceBuilder.java
@@ -36,7 +36,7 @@ public class NetherSurfaceBuilder extends SurfaceBuilder<SurfaceBuilderBaseConfi
BlockState blockState = surfaceBuilderBaseConfiguration.getTopMaterial();
BlockState blockState2 = surfaceBuilderBaseConfiguration.getUnderMaterial();
- for(int p = 127; p >= i; --p) {
+ for(int p = height; p >= i; --p) { // Paper - fix MC-187716 - use configured height
mutableBlockPos.set(k, p, m);
BlockState blockState3 = chunk.getBlockState(mutableBlockPos);
if (blockState3.isAir()) {

View File

@ -13,7 +13,7 @@ This commit forces numbers to be present prior to the ending "i"
letter.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java
index 94d46bc56b3bc4c4750fcfb1732eea0e49a04195..8ec09ff3b5aae4267b753bd715f0a9d4ef0381bd 100644
index a7f4054002bd176fccf8357e9a23de66dd9e0dc5..207e4302161b3abe2ade56c9dc9c31820010fa42 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java
@@ -19,7 +19,7 @@ import net.minecraft.nbt.TagParser;

View File

@ -9,25 +9,26 @@ the game, immediately stop the server to prevent data corruption.
You can override this functionality at your own peril.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 0adf14af9841cd3a20a8b2c0c320eb06794ef261..f6a814f9305813eaafa56baa0327e0111cd4e38c 100644
index b4246524dd11ad1e1dc94c56eee966c5a54d9ecc..fad795c67829f89b21d78e822c7b15f2ea560184 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -95,10 +95,24 @@ public class ChunkSerializer {
@@ -98,10 +98,25 @@ public class ChunkSerializer {
holder.tasks.forEach(Runnable::run);
return holder.protoChunk;
}
+
+ // Paper start
+ private static final int CURRENT_DATA_VERSION = SharedConstants.getCurrentVersion().getWorldVersion();
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion");
+ // Paper end
+
public static InProgressChunkHolder loadChunk(ServerLevel worldserver, StructureManager definedstructuremanager, PoiManager villageplace, ChunkPos chunkcoordintpair, CompoundTag nbttagcompound, boolean distinguish) {
ArrayDeque<Runnable> tasksToExecuteOnMain = new ArrayDeque<>();
public static InProgressChunkHolder loadChunk(ServerLevel world, StructureManager structureManager, PoiManager poiStorage, ChunkPos pos, CompoundTag nbt, boolean distinguish) {
java.util.ArrayDeque<Runnable> tasksToExecuteOnMain = new java.util.ArrayDeque<>();
// Paper end
ChunkGenerator chunkgenerator = worldserver.getChunkSource().getGenerator();
ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator();
+ // Paper start - Do NOT attempt to load chunks saved with newer versions
+ if (nbttagcompound.contains("DataVersion", 99)) {
+ int dataVersion = nbttagcompound.getInt("DataVersion");
+ if (nbt.contains("DataVersion", 99)) {
+ int dataVersion = nbt.getInt("DataVersion");
+ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) {
+ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace();
+ System.exit(1);
@ -35,5 +36,5 @@ index 0adf14af9841cd3a20a8b2c0c320eb06794ef261..f6a814f9305813eaafa56baa0327e011
+ }
+ // Paper end
BiomeSource worldchunkmanager = chunkgenerator.getBiomeSource();
CompoundTag nbttagcompound1 = nbttagcompound.getCompound("Level"); // Paper - diff on change, see ChunkRegionLoader#getChunkCoordinate
ChunkPos chunkcoordintpair1 = new ChunkPos(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos")); // Paper - diff on change, see ChunkRegionLoader#getChunkCoordinate
CompoundTag nbttagcompound1 = nbt.getCompound("Level"); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate
ChunkPos chunkcoordintpair1 = new ChunkPos(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate

View File

@ -5,18 +5,18 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d9257786f61e 100644
index 99a16a2f0c2dc227dd45db1964c2d47ffdcda73e..0176b85a031b33cb2a12bb75079f5e3111f4f2b7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -5,6 +5,7 @@ import com.google.common.primitives.Doubles;
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.google.common.primitives.Floats;
import com.mojang.brigadier.ParseResults;
import com.mojang.brigadier.StringReader;
+import io.netty.buffer.Unpooled;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import it.unimi.dsi.fastutil.ints.Int2ShortMap;
@@ -37,6 +38,7 @@ import net.minecraft.nbt.ListTag;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry;
@@ -38,6 +39,7 @@ import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.Connection;
@ -24,7 +24,7 @@ index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d925
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
@@ -258,6 +260,8 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -259,6 +261,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80);
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
@ -33,7 +33,7 @@ index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d925
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.server = server;
this.connection = connection;
@@ -2998,6 +3002,8 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -3000,6 +3004,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
@ -42,24 +42,23 @@ index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d925
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -3025,6 +3031,16 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -3027,6 +3033,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
try {
byte[] data = new byte[packet.data.readableBytes()];
packet.data.readBytes(data);
+
+ // Paper start - Brand support
+ if (packet.identifier.equals(MINECRAFT_BRAND)) {
+ try {
+ this.clientBrandName = new FriendlyByteBuf(Unpooled.copiedBuffer(data)).readUTF(256);
+ this.clientBrandName = new FriendlyByteBuf(Unpooled.copiedBuffer(data)).readUtf(256);
+ } catch (StringIndexOutOfBoundsException ex) {
+ this.clientBrandName = "illegal";
+ }
+ }
+ // Paper end
craftServer.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet.identifier.toString(), data);
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -3034,6 +3050,12 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
@@ -3036,6 +3051,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
@ -73,10 +72,10 @@ index d264fca2737f83a0860394f7bb6b269ffe669594..ab6494f5a872bba5398bef0367b4d925
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 610eabd2e93f9efccee810c3b5a314bc3cc649d8..7aae63d22167dc1b3ec7e8bc8672855c2038007e 100644
index 0a6d6ea67eaf8b2a59ec45fb3ffb85096f509997..b277c87c0834ddcefcfaebd85c9e69d8d389b59e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2385,6 +2385,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2386,6 +2386,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
};
@ -89,4 +88,4 @@ index 610eabd2e93f9efccee810c3b5a314bc3cc649d8..7aae63d22167dc1b3ec7e8bc8672855c
+
public Player.Spigot spigot()
{
return spigot;
return this.spigot;

View File

@ -5,24 +5,24 @@ Subject: [PATCH] Add #setMaxPlayers API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index b76735531ef96f9d4c870a5107feea01524a7670..7e44c911f4abc5c7d0e89513bf2cfc3516f13492 100644
index 8c62367888af566dd9be4bb5cd301c26e0248e46..2f73f1f770e5e1fa422bec9c27e5bd10e86b7538 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -141,7 +141,7 @@ public abstract class PlayerList {
@@ -142,7 +142,7 @@ public abstract class PlayerList {
public final PlayerDataStorage playerIo;
private boolean doWhiteList;
private final RegistryAccess.RegistryHolder registryHolder;
- protected final int maxPlayers;
+ protected int maxPlayers; public final void setMaxPlayers(int maxPlayers) { this.maxPlayers = maxPlayers; } // Paper - remove final and add setter
private int viewDistance;
private GameType overrideGameMode;
private boolean allowCheatsForAllPlayers;
private static final boolean ALLOW_LOGOUTIVATOR = false;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e301aee53b19fc3f93a36d0ed03a649741123bfa..e599be15af17e5e45d2b694c30140cc4a787a7f5 100644
index df2c41d18377d8519d5537186d529ecc1901f58a..74de169828d7e1e55d15546eb637a87268610700 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -613,6 +613,13 @@ public final class CraftServer implements Server {
return playerList.getMaxPlayers();
@@ -616,6 +616,13 @@ public final class CraftServer implements Server {
return this.playerList.getMaxPlayers();
}
+ // Paper start

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add playPickupItemAnimation to LivingEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 067eaf1e05ced344eb168431403f3fe786eafddf..eb136af0f99f5d7520ceabb98cefd5a01122872c 100644
index a7a6757b83c94a0c0926097021015815f8f18b8e..c01eae70fe12970e9f617bf14e542b33572bcf4c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -806,5 +806,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Don't require FACING data
diff --git a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
index f7e60cdfa0b3f5970a897b5d52aaa72210f2fa57..ab8e69f9fc38012844ce01bd0cc5be8de2fcf4ab 100644
index 0c286d7254f653bc855b1cb329fa76e3c1669b3c..05c0f0049421bc897f8e722331e30a6756ebbeea 100644
--- a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
@@ -14,20 +14,22 @@ import org.bukkit.event.block.BlockDispenseEvent;

View File

@ -5,17 +5,17 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 61aee2c109614a014149ae5a15ad2a28c796cb9d..22266fda4de9b5fbace3b8e55ce390b8d7e75a65 100644
index bdabcdb60dbfb803ead13c42c8dd5e100b37dc00..4ae56444d258cdf44a02256315d6aae84e2f53be 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1981,12 +1981,14 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
@@ -1679,12 +1679,14 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
}
// Paper end
+ public final void setSpawn(BlockPos blockposition, float f) { this.setDefaultSpawnPos(blockposition, f); } // Paper - OBFHELPER
public void setDefaultSpawnPos(BlockPos pos, float angle) {
// Paper - configurable spawn radius
BlockPos prevSpawn = this.getSpawn();
BlockPos prevSpawn = this.getSharedSpawnPos();
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
this.levelData.setSpawn(pos, angle);
@ -24,20 +24,20 @@ index 61aee2c109614a014149ae5a15ad2a28c796cb9d..22266fda4de9b5fbace3b8e55ce390b8
// if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add
this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 793b1309528671ce822d5a484ff9e40d6eba4e9d..37513a1774f5a6611338c1b90018b974238ddbf6 100644
index d79a711d4080ad8acb2c240870be9d99a0b84cea..4ca674fac0e1ed354a0c49284c21ca2b117dd852 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -371,11 +371,13 @@ public class CraftWorld implements World {
@@ -386,11 +386,13 @@ public class CraftWorld implements World {
public boolean setSpawnLocation(int x, int y, int z, float angle) {
try {
Location previousLocation = getSpawnLocation();
Location previousLocation = this.getSpawnLocation();
- world.levelData.setSpawn(new BlockPos(x, y, z), angle);
+ world.setSpawn(new BlockPos(x, y, z), angle); // Paper - use WorldServer#setSpawn
+ // Paper start - move to nms.World
// Notify anyone who's listening.
- SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
- server.getPluginManager().callEvent(event);
- this.server.getPluginManager().callEvent(event);
+ // SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
+ // server.getPluginManager().callEvent(event);
+ // Paper end

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Add moon phase API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 37513a1774f5a6611338c1b90018b974238ddbf6..28bf53bc9fca21f57cd4851adf508d833ecdd33b 100644
index 4ca674fac0e1ed354a0c49284c21ca2b117dd852..d0b2de0f0a37554eb812aa8c7c20f1067807dc40 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -310,6 +310,11 @@ public class CraftWorld implements World {
@@ -325,6 +325,11 @@ public class CraftWorld implements World {
public int getPlayerCount() {
return world.players.size();
return world.players().size();
}
+
+ @Override

View File

@ -23,7 +23,7 @@ index fdbd8b89bb8bf3b61f60b812b90483c98a3d5ccb..faa1b775e45563b93ac1d5b904938b1f
public static int maxPlayerAutoSavePerTick = 10;
private static void playerAutoSaveRate() {
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 0f0a5fa2be5a7c69291b593a04cad83e069ba5b1..f7ca5294fe571770e3b0036e92563c5a099f76b1 100644
index a12af10e28f2d023ba6f916b5e7a53539416713f..822a8dbfaea0a312c4eb2849f2386ecd401b13e9 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -15,6 +15,7 @@ import java.util.Random;
@ -41,11 +41,11 @@ index 0f0a5fa2be5a7c69291b593a04cad83e069ba5b1..f7ca5294fe571770e3b0036e92563c5a
+import net.minecraft.world.level.block.piston.PistonHeadBlock;
+import net.minecraft.world.level.block.piston.PistonMovingBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.storage.loot.LootContext;
@@ -161,6 +164,15 @@ public class Explosion {
@@ -189,6 +192,15 @@ public class Explosion {
if (f > 0.0F && this.damageCalculator.a(this, this.level, blockposition, iblockdata, f) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions
if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions
set.add(blockposition);
+ // Paper start - prevent headless pistons from forming
+ if (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
@ -60,10 +60,10 @@ index 0f0a5fa2be5a7c69291b593a04cad83e069ba5b1..f7ca5294fe571770e3b0036e92563c5a
d4 += d0 * 0.30000001192092896D;
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index 001e90da8b09e16b6df4849a5bac4f4821000c94..81f3c6fb7bab9de364537d3f3b2ea0f32795e5f1 100644
index 87bedba9ab495edcce289c6665271d92b7165944..985f1112963c3b644a88788a6b4f8a9bd5f5c11a 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -65,6 +65,8 @@ public class PistonMovingBlockEntity extends BlockEntity implements TickableBloc
@@ -66,6 +66,8 @@ public class PistonMovingBlockEntity extends BlockEntity {
return this.direction;
}