Clean up duplicate PlayerInitialSpawnEvent

Confused on this one, as commit history says Spigots version is older
than our version, so i'm not sure how we ended up duplicating this when
the 2 events are 100% identical.

Subclass spigots event and rely on the inheritance system, and clean up
the duplicate event fires.

Fix Spigots setPosition to use setPositionRaw to avoid chunk load prematurely.
This commit is contained in:
Aikar 2020-04-19 03:11:02 -04:00
parent c2d022d7e7
commit f2d1b6e549
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE
20 changed files with 125 additions and 149 deletions

View file

@ -1,4 +1,4 @@
From 12b172626854e7d81822f669f23778ad946326d2 Mon Sep 17 00:00:00 2001
From 42d1bc471b8c73b4b00d236ae4e45ee6982da101 Mon Sep 17 00:00:00 2001
From: Steve Anton <anxuiz.nx@gmail.com>
Date: Mon, 29 Feb 2016 18:13:58 -0600
Subject: [PATCH] Add PlayerInitialSpawnEvent
@ -7,55 +7,24 @@ For modifying a player's initial spawn location as they join the server
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
new file mode 100644
index 000000000..8e407eff1
index 00000000..8b1fdb9d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
@@ -0,0 +1,47 @@
@@ -0,0 +1,16 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.jetbrains.annotations.NotNull;
+import org.spigotmc.event.player.PlayerSpawnLocationEvent;
+
+public class PlayerInitialSpawnEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ @NotNull private Location spawnLocation;
+/**
+ * @deprecated Use {@link PlayerSpawnLocationEvent}, Duplicate API
+ */
+public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent {
+
+ public PlayerInitialSpawnEvent(@NotNull final Player player, @NotNull final Location spawnLocation) {
+ super(player);
+ this.spawnLocation = spawnLocation;
+ }
+
+ /**
+ * Gets the current spawn location
+ *
+ * @return Location current spawn location
+ */
+ @NotNull
+ public Location getSpawnLocation() {
+ return this.spawnLocation;
+ }
+
+ /**
+ * Sets the new spawn location
+ *
+ * @param spawnLocation new location for the spawn
+ */
+ public void setSpawnLocation(@NotNull Location spawnLocation) {
+ this.spawnLocation = spawnLocation;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ public PlayerInitialSpawnEvent(@NotNull Player who, @NotNull Location spawnLocation) {
+ super(who, spawnLocation);
+ }
+}
--

View file

@ -1,35 +1,33 @@
From 4b592b7a0a297805978f5eae8345b855a79d5faa Mon Sep 17 00:00:00 2001
From 43658573d4ef19c33b422ef10666e90068267cbd Mon Sep 17 00:00:00 2001
From: Steve Anton <anxuiz.nx@gmail.com>
Date: Thu, 3 Mar 2016 00:09:38 -0600
Subject: [PATCH] Add PlayerInitialSpawnEvent
For modifying a player's initial spawn location as they join the server
This is a duplicate API from spigot, so use our duplicate subclass and
improve setPosition to use raw
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 1652a57e25..948a6e3b7a 100644
index f28be11ee..541e3ce83 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -109,7 +109,20 @@ public abstract class PlayerList {
}
// CraftBukkit end
@@ -119,14 +119,14 @@ public abstract class PlayerList {
- entityplayer.spawnIn(worldserver);
+ // Paper start - support PlayerInitialSpawnEvent
+ Location originalLoc = new Location(entityplayer.world.getWorld(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ(), entityplayer.yaw, entityplayer.pitch);
+ com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent event = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(entityplayer.getBukkitEntity(), originalLoc);
+ this.server.server.getPluginManager().callEvent(event);
+
+ Location newLoc = event.getSpawnLocation();
+ entityplayer.world = ((CraftWorld) newLoc.getWorld()).getHandle();
+ entityplayer.setPositionRaw(newLoc.getX(), newLoc.getY(), newLoc.getZ());
+ entityplayer.yaw = newLoc.getYaw();
+ entityplayer.pitch = newLoc.getPitch();
+ entityplayer.dimension = ((CraftWorld) newLoc.getWorld()).getHandle().worldProvider.getDimensionManager();
+ // Paper end
+
+ entityplayer.spawnIn(((CraftWorld) newLoc.getWorld()).getHandle());
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
String s1 = "local";
// Spigot start - spawn location event
Player bukkitPlayer = entityplayer.getBukkitEntity();
- PlayerSpawnLocationEvent ev = new PlayerSpawnLocationEvent(bukkitPlayer, bukkitPlayer.getLocation());
+ PlayerSpawnLocationEvent ev = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(bukkitPlayer, bukkitPlayer.getLocation()); // Paper use our duplicate event
Bukkit.getPluginManager().callEvent(ev);
Location loc = ev.getSpawnLocation();
worldserver = ((CraftWorld) loc.getWorld()).getHandle();
entityplayer.spawnIn(worldserver);
- entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ());
+ entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); // Paper - set raw so we aren't fully joined to the world (not added to chunk or world)
entityplayer.setYawPitch(loc.getYaw(), loc.getPitch());
// Spigot end
--
2.25.1

View file

@ -1,14 +1,14 @@
From 6239d721ea0a07c1255154119b2cc27a9a3d0197 Mon Sep 17 00:00:00 2001
From 7881228b6ff1e754c83f21baf45fc29a103a1116 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 2 Apr 2016 20:37:03 -0400
Subject: [PATCH] Fix reducedDebugInfo not initialized on client
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 948a6e3b7a..05ea0ace58 100644
index 541e3ce83..9691d84f2 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -163,6 +163,7 @@ public abstract class PlayerList {
@@ -150,6 +150,7 @@ public abstract class PlayerList {
playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()));
playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry()));

View file

@ -1,4 +1,4 @@
From ac7e2a5e3c1f068bb3cf18debfefb11d9fa80d31 Mon Sep 17 00:00:00 2001
From 9d4c4eba8429847db18252ee8816ce155d6b3860 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 6 Apr 2016 01:04:23 -0500
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
@ -12,7 +12,7 @@ for this on CB at one point but I can't find it. We may need to do this
ourselves at some point in the future.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 47f5f8055e..b1d1a3c1f8 100644
index 47f5f8055..b1d1a3c1f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -252,4 +252,9 @@ public class PaperWorldConfig {
@ -26,7 +26,7 @@ index 47f5f8055e..b1d1a3c1f8 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 505189c82b..669d9a41d6 100644
index 505189c82..669d9a41d 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1648,7 +1648,16 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -48,10 +48,10 @@ index 505189c82b..669d9a41d6 100644
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
for (Object recipient : minecraftServer.getPlayerList().players) {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 05ea0ace58..94a24a49cf 100644
index 9691d84f2..9212501b8 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -178,7 +178,7 @@ public abstract class PlayerList {
@@ -165,7 +165,7 @@ public abstract class PlayerList {
}
// CraftBukkit start
chatmessage.a(EnumChatFormat.YELLOW);

View file

@ -1,11 +1,11 @@
From 478a1cb26f452aee2f9a97f6627d050c240e7f89 Mon Sep 17 00:00:00 2001
From 92338d29aa23def6ba856d3d50d70f1d4d50b76a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 13 Apr 2016 02:10:49 -0400
Subject: [PATCH] Configurable Player Collision
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index d500cd75a9..e4f0db64c0 100644
index d500cd75a..e4f0db64c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -223,4 +223,9 @@ public class PaperConfig {
@ -19,7 +19,7 @@ index d500cd75a9..e4f0db64c0 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3094f763ba..deffa2ddbd 100644
index 1d3f1be24..f82be54cc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -454,6 +454,20 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -44,7 +44,7 @@ index 3094f763ba..deffa2ddbd 100644
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
this.serverConnection.acceptConnections();
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
index b0740965a4..6b1a914d2f 100644
index b0740965a..6b1a914d2 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java
@@ -96,7 +96,7 @@ public class PacketPlayOutScoreboardTeam implements Packet<PacketListenerPlayOut
@ -57,7 +57,7 @@ index b0740965a4..6b1a914d2f 100644
packetdataserializer.a(this.c);
packetdataserializer.a(this.d);
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 94a24a49cf..b7012b5b64 100644
index 9212501b8..643e58839 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -72,6 +72,7 @@ public abstract class PlayerList {
@ -68,7 +68,7 @@ index 94a24a49cf..b7012b5b64 100644
public PlayerList(MinecraftServer minecraftserver, int i) {
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
@@ -287,6 +288,13 @@ public abstract class PlayerList {
@@ -274,6 +275,13 @@ public abstract class PlayerList {
}
entityplayer.syncInventory();
@ -82,7 +82,7 @@ index 94a24a49cf..b7012b5b64 100644
// CraftBukkit - Moved from above, added world
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
}
@@ -405,6 +413,16 @@ public abstract class PlayerList {
@@ -392,6 +400,16 @@ public abstract class PlayerList {
entityplayer.playerTick();// SPIGOT-924
// CraftBukkit end
@ -99,7 +99,7 @@ index 94a24a49cf..b7012b5b64 100644
this.savePlayerFile(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle();
@@ -1029,6 +1047,13 @@ public abstract class PlayerList {
@@ -1016,6 +1034,13 @@ public abstract class PlayerList {
}
// CraftBukkit end

View file

@ -1,4 +1,4 @@
From e211184dc4675d9e49aad3a32e0b2a832ec50040 Mon Sep 17 00:00:00 2001
From 37df96a0b9a2dac98753370a77dc1a9af7980f8d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 7 Jan 2017 15:41:58 -0500
Subject: [PATCH] Enforce Sync Player Saves
@ -7,10 +7,10 @@ Saving players async is extremely dangerous. This will force it to main
the same way we handle async chunk loads.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index b7012b5b64..ce5bd2229e 100644
index 643e58839..293251988 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -931,11 +931,13 @@ public abstract class PlayerList {
@@ -918,11 +918,13 @@ public abstract class PlayerList {
}
public void savePlayers() {

View file

@ -1,4 +1,4 @@
From b6ef70a89bd5c1d6f2d7178583bd3a9e70855fb6 Mon Sep 17 00:00:00 2001
From c611f29665a3b57b937b835fe497e4a774f7ae38 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 12 May 2017 23:34:11 -0500
Subject: [PATCH] Properly handle async calls to restart the server
@ -30,7 +30,7 @@ will have plugins and worlds saving to the disk has a high potential to result
in corruption/dataloss.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bdc98d12c6..e41352681a 100644
index ebb41f788..af2fa93d4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -88,6 +88,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -73,10 +73,10 @@ index bdc98d12c6..e41352681a 100644
// Spigot Start
private static double calcTps(double avg, double exp, double tps)
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index ce5bd2229e..1eb53f67ef 100644
index 293251988..56266a772 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1042,10 +1042,15 @@ public abstract class PlayerList {
@@ -1029,10 +1029,15 @@ public abstract class PlayerList {
entityplayer.playerInteractManager.b(generatoraccess.getWorldData().getGameType());
}
@ -93,7 +93,7 @@ index ce5bd2229e..1eb53f67ef 100644
}
// CraftBukkit end
@@ -1057,6 +1062,7 @@ public abstract class PlayerList {
@@ -1044,6 +1049,7 @@ public abstract class PlayerList {
}
// Paper end
}
@ -102,7 +102,7 @@ index ce5bd2229e..1eb53f67ef 100644
// CraftBukkit start
public void sendMessage(IChatBaseComponent[] iChatBaseComponents) {
diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
index ccea803f58..aefea3a9a8 100644
index ccea803f5..aefea3a9a 100644
--- a/src/main/java/org/spigotmc/RestartCommand.java
+++ b/src/main/java/org/spigotmc/RestartCommand.java
@@ -46,86 +46,134 @@ public class RestartCommand extends Command

View file

@ -1,14 +1,14 @@
From 58c8c7d8a9a9aae224e14fa54c4a63157d06ba4e Mon Sep 17 00:00:00 2001
From 1d9d4821b898167d2b6ea80a9655c6838eecf706 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 3 Jul 2017 18:11:10 -0500
Subject: [PATCH] ProfileWhitelistVerifyEvent
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 308bc3baf2..002f7e844a 100644
index 77f1ddc8a..a61815c79 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -522,9 +522,9 @@ public abstract class PlayerList {
@@ -509,9 +509,9 @@ public abstract class PlayerList {
// return chatmessage;
if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot
@ -20,7 +20,7 @@ index 308bc3baf2..002f7e844a 100644
} else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
IpBanEntry ipbanentry = this.l.get(socketaddress);
@@ -893,9 +893,25 @@ public abstract class PlayerList {
@@ -880,9 +880,25 @@ public abstract class PlayerList {
this.server.getCommandDispatcher().a(entityplayer);
}

View file

@ -1,4 +1,4 @@
From 71e4e853de74df2ea993a4ff280d857578435133 Mon Sep 17 00:00:00 2001
From e3d5a0f193a22a02bff9129d888715337abe45cd Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 3 Jul 2018 21:56:23 -0400
Subject: [PATCH] InventoryCloseEvent Reason API
@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 4721c288ba..36748ccb73 100644
index 4721c288b..36748ccb7 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -164,7 +164,7 @@ public abstract class EntityHuman extends EntityLiving {
@ -34,7 +34,7 @@ index 4721c288ba..36748ccb73 100644
this.activeContainer = this.defaultContainer;
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 625b684287..f849dba215 100644
index 625b68428..f849dba21 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -368,7 +368,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -88,7 +88,7 @@ index 625b684287..f849dba215 100644
this.m();
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 4a0a847944..8eb12e89ea 100644
index 4a0a84794..8eb12e89e 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2040,7 +2040,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -101,10 +101,10 @@ index 4a0a847944..8eb12e89ea 100644
this.player.m();
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index f863ab7426..442673b13f 100644
index a61815c79..5ae0927c1 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -403,7 +403,7 @@ public abstract class PlayerList {
@@ -390,7 +390,7 @@ public abstract class PlayerList {
entityplayer.a(StatisticList.LEAVE_GAME);
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
@ -114,7 +114,7 @@ index f863ab7426..442673b13f 100644
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
cserver.getPluginManager().callEvent(playerQuitEvent);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index da391e945c..c5b4218b44 100644
index da391e945..c5b4218b4 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1051,7 +1051,7 @@ public class WorldServer extends World {
@ -136,7 +136,7 @@ index da391e945c..c5b4218b44 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index d5f5550350..1c88eacea9 100644
index d5f555035..1c88eacea 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -467,8 +467,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -155,7 +155,7 @@ index d5f5550350..1c88eacea9 100644
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 25c80a40d8..91ad5776c8 100644
index 25c80a40d..91ad5776c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -785,7 +785,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -168,7 +168,7 @@ index 25c80a40d8..91ad5776c8 100644
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index caf277439a..f931fa48b4 100644
index caf277439..f931fa48b 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1293,8 +1293,19 @@ public class CraftEventFactory {

View file

@ -1,14 +1,14 @@
From 8664a8652bac4d62e50a42117d2f61c4caa5ece8 Mon Sep 17 00:00:00 2001
From ff414a1ec9636eefbb5e0c6cf55c51150885a0c4 Mon Sep 17 00:00:00 2001
From: Mystiflow <mystiflow@gmail.com>
Date: Fri, 6 Jul 2018 13:21:30 +0100
Subject: [PATCH] Send nearby packets from world player list not server list
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 442673b13..36d31d271 100644
index 5ae0927c1..6b6720185 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -923,8 +923,25 @@ public abstract class PlayerList {
@@ -910,8 +910,25 @@ public abstract class PlayerList {
}
public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, DimensionManager dimensionmanager, Packet<?> packet) {
@ -36,7 +36,7 @@ index 442673b13..36d31d271 100644
// CraftBukkit start - Test if player receiving packet can see the source of the packet
if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) {
@@ -932,7 +949,7 @@ public abstract class PlayerList {
@@ -919,7 +936,7 @@ public abstract class PlayerList {
}
// CraftBukkit end

View file

@ -1,4 +1,4 @@
From 77559ec5ca428a33d370386d46d80248c0513047 Mon Sep 17 00:00:00 2001
From 1d088d17e9e9e57ed6e7b53b0d076d37f8f64229 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 2 Mar 2019 16:12:35 -0500
Subject: [PATCH] MC-145260: Fix Whitelist On/Off inconsistency
@ -11,7 +11,7 @@ everything to the Whitelist object.
https://github.com/PaperMC/Paper/issues/1880
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
index 8570e38f42..c97be42dd7 100644
index 8570e38f4..c97be42dd 100644
--- a/src/main/java/net/minecraft/server/JsonList.java
+++ b/src/main/java/net/minecraft/server/JsonList.java
@@ -64,6 +64,7 @@ public class JsonList<K, V extends JsonListEntry<K>> {
@ -23,7 +23,7 @@ index 8570e38f42..c97be42dd7 100644
this.e = flag;
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 4d6ac8f85c..89d34716fe 100644
index e148940ab..f71c9f4a8 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -62,7 +62,7 @@ public abstract class PlayerList {
@ -35,7 +35,7 @@ index 4d6ac8f85c..89d34716fe 100644
protected final int maxPlayers;
private int viewDistance;
private EnumGamemode t;
@@ -900,9 +900,9 @@ public abstract class PlayerList {
@@ -887,9 +887,9 @@ public abstract class PlayerList {
}
public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) {
boolean isOp = this.operators.d(gameprofile);
@ -47,7 +47,7 @@ index 4d6ac8f85c..89d34716fe 100644
event.callEvent();
if (!event.isWhitelisted()) {
if (loginEvent != null) {
@@ -1031,11 +1031,11 @@ public abstract class PlayerList {
@@ -1018,11 +1018,11 @@ public abstract class PlayerList {
}
public boolean getHasWhitelist() {

View file

@ -1,14 +1,14 @@
From 2faf410dd3c2a1b07dad08bffb642784b10df72b Mon Sep 17 00:00:00 2001
From 7f579601fff507e69ba5af5cf92a42a4c882f8e3 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
Date: Wed, 13 Mar 2019 20:08:09 +0200
Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 89d34716fe..4b3083499b 100644
index f71c9f4a8..e9908cd01 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1035,6 +1035,7 @@ public abstract class PlayerList {
@@ -1022,6 +1022,7 @@ public abstract class PlayerList {
}
public void setHasWhitelist(boolean flag) {

View file

@ -1,4 +1,4 @@
From 585d008042ae90e61944244bb3715fa4e8272f44 Mon Sep 17 00:00:00 2001
From 493d4f36505b5c70909429472e606f468ffdc0d8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 24 Mar 2019 00:24:52 -0400
Subject: [PATCH] Entity#getEntitySpawnReason
@ -10,7 +10,7 @@ persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 427d66ed01..bb1fd6e46c 100644
index 427d66ed0..bb1fd6e46 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -72,6 +72,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -59,10 +59,10 @@ index 427d66ed01..bb1fd6e46c 100644
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 4b3083499b..d726cefe1a 100644
index e9908cd01..7745e70d2 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -251,7 +251,7 @@ public abstract class PlayerList {
@@ -238,7 +238,7 @@ public abstract class PlayerList {
// CraftBukkit start
WorldServer finalWorldServer = worldserver;
Entity entity = EntityTypes.a(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
@ -72,7 +72,7 @@ index 4b3083499b..d726cefe1a 100644
});
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 7364f48210..64bd41f1e3 100644
index 43565dd92..f7a1fad9c 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1001,6 +1001,7 @@ public class WorldServer extends World {
@ -84,7 +84,7 @@ index 7364f48210..64bd41f1e3 100644
if (entity.valid) {
MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 915ccb1807..dfa15372b8 100644
index 915ccb180..dfa15372b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1051,5 +1051,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View file

@ -1,14 +1,14 @@
From 16943450aa9676846eb8d7ce6d609583e9e320fc Mon Sep 17 00:00:00 2001
From 00d7e661a3d63f623484a36ba413fc4e2e9d0454 Mon Sep 17 00:00:00 2001
From: MisterVector <whizkid3000@hotmail.com>
Date: Fri, 26 Oct 2018 21:31:00 -0700
Subject: [PATCH] Implement PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index d726cefe1a..752d45e5bd 100644
index 7745e70d2..765ebe2cc 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -638,9 +638,14 @@ public abstract class PlayerList {
@@ -625,9 +625,14 @@ public abstract class PlayerList {
// this.a(entityplayer1, entityplayer, worldserver); // CraftBukkit - removed
@ -24,7 +24,7 @@ index d726cefe1a..752d45e5bd 100644
CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
if (cworld != null && blockposition != null) {
Optional<Vec3D> optional = EntityHuman.getBed(cworld.getHandle(), blockposition, flag1);
@@ -673,6 +678,7 @@ public abstract class PlayerList {
@@ -660,6 +665,7 @@ public abstract class PlayerList {
location = respawnEvent.getRespawnLocation();
if (!flag) entityplayer.reset(); // SPIGOT-4785
@ -32,7 +32,7 @@ index d726cefe1a..752d45e5bd 100644
} else {
location.setWorld(server.getWorldServer(dimensionmanager).getWorld());
}
@@ -734,6 +740,13 @@ public abstract class PlayerList {
@@ -721,6 +727,13 @@ public abstract class PlayerList {
if (entityplayer.playerConnection.isDisconnected()) {
this.savePlayerFile(entityplayer);
}

View file

@ -1,4 +1,4 @@
From ac5d3d0a349ea262929aba1502a14a07f9f0b052 Mon Sep 17 00:00:00 2001
From 08f3fda4bdeb4d4ef372f3bc092a72443ef2f2d0 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Tue, 13 Aug 2019 06:35:17 -0700
Subject: [PATCH] Fix MC-158900
@ -7,10 +7,10 @@ The problem was we were checking isExpired() on the entry, but if it
was expired at that point, then it would be null.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 752d45e5bd..9a33045e03 100644
index 765ebe2cc..0ccfd8de0 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -513,8 +513,10 @@ public abstract class PlayerList {
@@ -500,8 +500,10 @@ public abstract class PlayerList {
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress());

View file

@ -1,11 +1,11 @@
From 631ad401d7370f5c8adff5fc9bfc27ef0df910ed Mon Sep 17 00:00:00 2001
From ab3c0acbf1f8ad5d37e9c5ed724b31293eb46c8a Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Wed, 9 Oct 2019 21:51:43 -0500
Subject: [PATCH] Fix stuck in sneak when changing worlds (MC-10657)
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 07a2310b18..cb795aa733 100644
index 07a2310b1..cb795aa73 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -982,6 +982,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -18,10 +18,10 @@ index 07a2310b18..cb795aa733 100644
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver.getWorld());
this.world.getServer().getPluginManager().callEvent(changeEvent);
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 9a33045e03..f37be4b76b 100644
index 0ccfd8de0..01345a62b 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -729,6 +729,8 @@ public abstract class PlayerList {
@@ -716,6 +716,8 @@ public abstract class PlayerList {
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
}

View file

@ -1,4 +1,4 @@
From 32a7fbdd5eb09cbfb7138e95e1510318b8f3685c Mon Sep 17 00:00:00 2001
From cd3141f70b485987b353d976c2e10a2d662b4d42 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 9 Apr 2020 21:20:33 -0400
Subject: [PATCH] Don't move existing players to world spawn
@ -10,7 +10,7 @@ larger than the keep loaded range.
By skipping this, we avoid potential for a large spike on server start.
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index f44825090f..fb38975830 100644
index f44825090..4625d11a1 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -118,7 +118,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -30,8 +30,17 @@ index f44825090f..fb38975830 100644
private void a(WorldServer worldserver) {
BlockPosition blockposition = worldserver.getSpawn();
@@ -306,7 +307,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
position = new Vec3D(world.getSpawn());
}
this.world = world;
- this.setPosition(position.getX(), position.getY(), position.getZ());
+ this.setPositionRaw(position.getX(), position.getY(), position.getZ()); // Paper - don't register to chunks yet
}
this.dimension = ((WorldServer) this.world).getWorldProvider().getDimensionManager();
this.playerInteractManager.a((WorldServer) world);
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index f37be4b76b..6d6fbf2f50 100644
index 01345a62b..dfe625157 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -108,6 +108,7 @@ public abstract class PlayerList {
@ -41,7 +50,7 @@ index f37be4b76b..6d6fbf2f50 100644
+ if (nbttagcompound == null) entityplayer.moveToSpawn(worldserver); // Paper - only move to spawn on first login, otherwise, stay where you are....
// CraftBukkit end
// Paper start - support PlayerInitialSpawnEvent
entityplayer.spawnIn(worldserver);
--
2.25.1

View file

@ -1,4 +1,4 @@
From dcc37cb0137276aedac50c019b6558ec03cbb7b6 Mon Sep 17 00:00:00 2001
From 56cf2c65fae1c0492da6b10644525a083050343b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 12 Apr 2020 15:50:48 -0400
Subject: [PATCH] Forced Watchdog Crash support and Improve Async Shutdown
@ -167,10 +167,10 @@ index 3dbd75ad0..a386c1ab4 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 6d6fbf2f5..0e1703c9d 100644
index dfe625157..160476fa2 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -411,7 +411,7 @@ public abstract class PlayerList {
@@ -398,7 +398,7 @@ public abstract class PlayerList {
cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());

View file

@ -1,14 +1,14 @@
From 715b2b69a3b073eb5859ed7954e7c3cff55c661a Mon Sep 17 00:00:00 2001
From a1774c817091f8447b3f5e9f7f88f2244c4fe52d Mon Sep 17 00:00:00 2001
From: AvrooVulcan <avrovulcan.programming@gmail.com>
Date: Fri, 17 Apr 2020 00:15:23 +0100
Subject: [PATCH] Broadcast join message to console
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 0e1703c9d..72ca7f706 100644
index 160476fa2..7403be0b2 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -199,9 +199,9 @@ public abstract class PlayerList {
@@ -186,9 +186,9 @@ public abstract class PlayerList {
joinMessage = playerJoinEvent.getJoinMessage();
if (joinMessage != null && joinMessage.length() > 0) {

View file

@ -1,4 +1,4 @@
From 71067736c5517211f7e9991cf940b49c220b5e84 Mon Sep 17 00:00:00 2001
From 72ebe0e580f444f77811a5526d36343b3173a962 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 19 Apr 2020 00:05:46 -0400
Subject: [PATCH] Fix Longstanding Broken behavior of PlayerJoinEvent
@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick
delays anymore.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 72ca7f706..3dae96b66 100644
index 7403be0b2..e737381b3 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -188,6 +188,11 @@ public abstract class PlayerList {
@@ -175,6 +175,11 @@ public abstract class PlayerList {
this.j.put(entityplayer.getUniqueID(), entityplayer);
// this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below
@ -43,7 +43,7 @@ index 72ca7f706..3dae96b66 100644
// CraftBukkit start
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage);
cserver.getPluginManager().callEvent(playerJoinEvent);
@@ -219,7 +224,7 @@ public abstract class PlayerList {
@@ -206,7 +211,7 @@ public abstract class PlayerList {
continue;
}
@ -52,7 +52,7 @@ index 72ca7f706..3dae96b66 100644
}
entityplayer.sentListPacket = true;
// CraftBukkit end
@@ -228,8 +233,8 @@ public abstract class PlayerList {
@@ -215,8 +220,8 @@ public abstract class PlayerList {
// CraftBukkit start - Only add if the player wasn't moved in the event
if (entityplayer.world == worldserver && !worldserver.getPlayers().contains(entityplayer)) {
@ -63,7 +63,7 @@ index 72ca7f706..3dae96b66 100644
}
worldserver = server.getWorldServer(entityplayer.dimension); // CraftBukkit - Update in case join event changed it
@@ -247,6 +252,11 @@ public abstract class PlayerList {
@@ -234,6 +239,11 @@ public abstract class PlayerList {
playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
}
@ -75,7 +75,7 @@ index 72ca7f706..3dae96b66 100644
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
// CraftBukkit start
@@ -288,6 +298,10 @@ public abstract class PlayerList {
@@ -275,6 +285,10 @@ public abstract class PlayerList {
}
}