Merge branch 'master' into pre/1.13
* master: Add some debug for entity slices Mark chunk dirty on entity changes Reduce and improve dupe uuid resolve message Add more entity debug info Bring some 1.13 authors to master Fixed more stuff Remove unsed method Extend player profile API to support skin changes Extend player profile API to support skin changes
This commit is contained in:
commit
f51ad46686
6 changed files with 166 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
|||
From 4557d91dd4ca4ccd0d1ddbb66fdde9161dc25f47 Mon Sep 17 00:00:00 2001
|
||||
From 41b4ebc08ef0a4929b0564d18d68cc105280bf85 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 18 Mar 2018 12:29:48 -0400
|
||||
Subject: [PATCH] Player.setPlayerProfile API
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Player.setPlayerProfile API
|
|||
This can be useful for changing name or skins after a player has logged in.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index d04f9b380e..5015bd0710 100644
|
||||
index d04f9b380..5015bd071 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -67,7 +67,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
@ -19,7 +19,7 @@ index d04f9b380e..5015bd0710 100644
|
|||
private final ItemCooldown ce;
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
index a721eb30e9..258bdfe66a 100644
|
||||
index a721eb30e..258bdfe66 100644
|
||||
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
@@ -38,7 +38,7 @@ public class LoginListener implements PacketLoginInListener, ITickable {
|
||||
|
@ -48,7 +48,7 @@ index a721eb30e9..258bdfe66a 100644
|
|||
uniqueId = i.getId();
|
||||
// Paper end
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 9f69000cb2..3c85d6323b 100644
|
||||
index 9f69000cb..8313c5192 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1,6 +1,8 @@
|
||||
|
@ -91,7 +91,7 @@ index 9f69000cb2..3c85d6323b 100644
|
|||
|
||||
getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
|
||||
|
||||
@@ -1191,6 +1204,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1191,6 +1204,46 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
entry.updatePlayer(getHandle());
|
||||
}
|
||||
}
|
||||
|
@ -109,10 +109,31 @@ index 9f69000cb2..3c85d6323b 100644
|
|||
+ for (EntityPlayer player : players) {
|
||||
+ player.getBukkitEntity().reregisterPlayer(self);
|
||||
+ }
|
||||
+ refreshPlayer();
|
||||
+ }
|
||||
+ public PlayerProfile getPlayerProfile() {
|
||||
+ return new CraftPlayerProfile(this).clone();
|
||||
+ }
|
||||
+
|
||||
+ private void refreshPlayer() {
|
||||
+ EntityPlayer handle = getHandle();
|
||||
+
|
||||
+ Location loc = getLocation();
|
||||
+
|
||||
+ PlayerConnection connection = handle.playerConnection;
|
||||
+ reregisterPlayer(handle);
|
||||
+
|
||||
+ //Respawn the player then update their position and selected slot
|
||||
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(handle.dimension, handle.world.getDifficulty(), handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode()));
|
||||
+ handle.updateAbilities();
|
||||
+ connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0));
|
||||
+ net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle);
|
||||
+
|
||||
+ if (this.isOp()) {
|
||||
+ this.setOp(false);
|
||||
+ this.setOp(true);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public void removeDisconnectingPlayer(Player player) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 5f354f6ae7a61b535e8d1a764b49675c944dd812 Mon Sep 17 00:00:00 2001
|
||||
From 397887e6789c73b3cee3d5fc35f7a1c5c5a4b19d Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sat, 31 Mar 2018 17:04:26 +0100
|
||||
Subject: [PATCH] Flag to disable the channel limit
|
||||
|
@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs.
|
|||
provide an optional flag to disable this check, at your own risk.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 3c85d6323b..ab9956fa24 100644
|
||||
index 8313c5192..8c1e49759 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -132,6 +132,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
@ -20,7 +20,7 @@ index 3c85d6323b..ab9956fa24 100644
|
|||
// Paper end
|
||||
|
||||
public CraftPlayer(CraftServer server, EntityPlayer entity) {
|
||||
@@ -1385,7 +1386,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1406,7 +1407,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void addChannel(String channel) {
|
||||
|
|
|
@ -1,12 +1,31 @@
|
|||
From 73e6428814b5eb1135bb45d9d3c2f30695c052e6 Mon Sep 17 00:00:00 2001
|
||||
From 50bd6c799a35435682d288098ad5a3999f888f42 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 21 Jul 2018 08:25:40 -0400
|
||||
Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
|
||||
|
||||
Add -Ddebug.entities=true to your JVM flags to gain more information
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index ea8684747..5fd0c0cf5 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -566,6 +566,14 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
+ // Paper start
|
||||
+ if (entity.getChunkX() != chunk.locX || entity.getChunkZ() != chunk.locZ) {
|
||||
+ LogManager.getLogger().error(entity + " is not actually in this chunk! Report this to https://github.com/PaperMC/Paper/issues/1223", new Throwable());
|
||||
+ }
|
||||
+ if ((int)Math.floor(entity.locX) >> 4 != chunk.locX || (int)Math.floor(entity.locZ) >> 4 != chunk.locZ) {
|
||||
+ LogManager.getLogger().error(entity + " will be leaving this chunk but saved to it. Report this to https://github.com/PaperMC/Paper/issues/1223", new Throwable());
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
if (entity.d(nbttagcompound1)) {
|
||||
chunk.f(true);
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 47ce5cda76..b308f44168 100644
|
||||
index 47ce5cda7..b308f4416 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -71,6 +71,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -18,7 +37,7 @@ index 47ce5cda76..b308f44168 100644
|
|||
if (bukkitEntity == null) {
|
||||
bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index b048343b7c..747d99dbe6 100644
|
||||
index b048343b7..747d99dbe 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -53,6 +53,10 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From ffb9e895c678e0bc8bcd62042080e712d786e6dc Mon Sep 17 00:00:00 2001
|
||||
From 7a0a0416714c5b37aebde624c0c621c0b9c5612c Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 21 Jul 2018 14:27:34 -0400
|
||||
Subject: [PATCH] Duplicate UUID Resolve Option
|
||||
|
@ -33,7 +33,7 @@ But for those who are ok with leaving this inconsistent behavior, you may use WA
|
|||
It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 7bd7aa0d94..ba6d5b7ff5 100644
|
||||
index 7bd7aa0d9..ba6d5b7ff 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -430,4 +430,40 @@ public class PaperWorldConfig {
|
||||
|
@ -78,7 +78,7 @@ index 7bd7aa0d94..ba6d5b7ff5 100644
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index b37fa3829b..c56e435b19 100644
|
||||
index b37fa3829..95c6812d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -1,5 +1,10 @@
|
||||
|
@ -108,7 +108,7 @@ index b37fa3829b..c56e435b19 100644
|
|||
}
|
||||
|
||||
int k = MathHelper.floor(entity.locY / 16.0D);
|
||||
@@ -865,6 +872,37 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -865,6 +872,35 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
List entityslice = aentityslice[j]; // Spigot
|
||||
|
@ -126,13 +126,11 @@ index b37fa3829b..c56e435b19 100644
|
|||
+ switch (mode) {
|
||||
+ case REGEN: {
|
||||
+ entity.setUUID(UUID.randomUUID());
|
||||
+ logger.error("Duplicate UUID found used by " + other);
|
||||
+ logger.error("Regenerated a new UUID for " + entity);
|
||||
+ logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
|
||||
+ break;
|
||||
+ }
|
||||
+ case DELETE: {
|
||||
+ logger.error("Duplicate UUID found used by " + other);
|
||||
+ logger.error("Deleting duplicate entity " + entity);
|
||||
+ logger.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
|
||||
+ entity.die();
|
||||
+ iterator.remove();
|
||||
+ break;
|
||||
|
@ -147,7 +145,7 @@ index b37fa3829b..c56e435b19 100644
|
|||
this.world.a((Collection) entityslice);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b308f44168..b6d6d4f378 100644
|
||||
index b308f4416..b6d6d4f37 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -2734,6 +2734,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
@ -159,7 +157,7 @@ index b308f44168..b6d6d4f378 100644
|
|||
this.uniqueID = uuid;
|
||||
this.au = this.uniqueID.toString();
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 747d99dbe6..7a9f28421b 100644
|
||||
index 747d99dbe..7a9f28421 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -40,7 +40,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
From 37d9641af77fd0ec11e932162a0125bd53f05ce3 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 23 Jul 2018 22:18:31 -0400
|
||||
Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
|
||||
saves
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 95c6812d7..aa75cc420 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -714,6 +714,7 @@ public class Chunk implements IChunkAccess {
|
||||
entity.ag = this.locZ;
|
||||
this.entitySlices[k].add(entity);
|
||||
// Paper start
|
||||
+ this.markDirty();
|
||||
if (entity instanceof EntityItem) {
|
||||
itemCounts[k]++;
|
||||
} else if (entity instanceof IInventory) {
|
||||
@@ -745,6 +746,7 @@ public class Chunk implements IChunkAccess {
|
||||
if (!this.entitySlices[i].remove(entity)) {
|
||||
return;
|
||||
}
|
||||
+ this.markDirty();
|
||||
if (entity instanceof EntityItem) {
|
||||
itemCounts[i]--;
|
||||
} else if (entity instanceof IInventory) {
|
||||
--
|
||||
2.18.0
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
From 1a1fa5156619969d65be7638a7cd2f056c9a933c Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 23 Jul 2018 22:44:23 -0400
|
||||
Subject: [PATCH] Add some Debug to Chunk Entity slices
|
||||
|
||||
If we detect unexpected state, log and try to recover
|
||||
|
||||
This should hopefully avoid duplicate entities ever being created
|
||||
if the entity was to end up in 2 different chunk slices
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index aa75cc420..56a74c606 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -712,8 +712,33 @@ public class Chunk implements IChunkAccess {
|
||||
entity.ae = this.locX;
|
||||
entity.af = k;
|
||||
entity.ag = this.locZ;
|
||||
- this.entitySlices[k].add(entity);
|
||||
+
|
||||
// Paper start
|
||||
+ List<Entity> entitySlice = this.entitySlices[k];
|
||||
+ boolean inThis = entitySlice.contains(entity);
|
||||
+ if (entity.entitySlice != null || inThis) {
|
||||
+ if (entity.entitySlice == entitySlice || inThis) {
|
||||
+ LogManager.getLogger().warn(entity + " was already in this chunk section! Report this to https://github.com/PaperMC/Paper/issues/1223");
|
||||
+ new Throwable().printStackTrace();
|
||||
+ return;
|
||||
+ } else {
|
||||
+ LogManager.getLogger().warn(entity + " is still in another ChunkSection! Report this to https://github.com/PaperMC/Paper/issues/1223");
|
||||
+
|
||||
+ Chunk chunk = entity.getCurrentChunk();
|
||||
+ if (chunk != null) {
|
||||
+ if (chunk != this) {
|
||||
+ LogManager.getLogger().warn(entity + " was in another chunk at that! " + chunk.locX + "," + chunk.locZ);
|
||||
+ }
|
||||
+ chunk.removeEntity(entity);
|
||||
+ } else {
|
||||
+ removeEntity(entity);
|
||||
+ }
|
||||
+ new Throwable().printStackTrace();
|
||||
+ }
|
||||
+ }
|
||||
+ entity.entitySlice = entitySlice;
|
||||
+ entitySlice.add(entity);
|
||||
+
|
||||
this.markDirty();
|
||||
if (entity instanceof EntityItem) {
|
||||
itemCounts[k]++;
|
||||
@@ -746,6 +771,12 @@ public class Chunk implements IChunkAccess {
|
||||
if (!this.entitySlices[i].remove(entity)) {
|
||||
return;
|
||||
}
|
||||
+ if (entitySlices[i] == entity.entitySlice) {
|
||||
+ entity.entitySlice = null;
|
||||
+ } else {
|
||||
+ LogManager.getLogger().warn(entity + " was removed from a entitySlice we did not expect. Report this to https://github.com/PaperMC/Paper/issues/1223");
|
||||
+ new Throwable().printStackTrace();
|
||||
+ }
|
||||
this.markDirty();
|
||||
if (entity instanceof EntityItem) {
|
||||
itemCounts[i]--;
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b6d6d4f37..bc4ba9f3c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -63,6 +63,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
}
|
||||
}
|
||||
};
|
||||
+ Object entitySlice = null;
|
||||
// Paper end
|
||||
static boolean isLevelAtLeast(NBTTagCompound tag, int level) {
|
||||
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
|
||||
--
|
||||
2.18.0
|
||||
|
Loading…
Reference in a new issue