From a7287cb4c6f2d71fe8f22f8fd527c3c6a34aa86c Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Sat, 6 Dec 2014 11:16:18 +0000 Subject: [PATCH] Force the player to be saved when disconnecting duplicates Allows the current player to grab the updated file --- nms-patches/PlayerList.patch | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index ce5cc7d7bf..9595b1a520 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PlayerList.java 2014-12-03 11:08:25.244137435 +0000 -+++ src/main/java/net/minecraft/server/PlayerList.java 2014-12-03 11:08:02.624137937 +0000 +--- ../work/decompile-8eb82bde//net/minecraft/server/PlayerList.java 2014-12-06 11:15:54.648082670 +0000 ++++ src/main/java/net/minecraft/server/PlayerList.java 2014-12-06 11:13:59.976085215 +0000 @@ -18,6 +18,25 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -276,7 +276,11 @@ UUID uuid = EntityHuman.a(gameprofile); ArrayList arraylist = Lists.newArrayList(); -@@ -289,6 +403,7 @@ +@@ -286,9 +400,11 @@ + + while (iterator.hasNext()) { + entityplayer = (EntityPlayer) iterator.next(); ++ savePlayerFile(entityplayer); // CraftBukkit - Force the player's inventory to be saved entityplayer.playerConnection.disconnect("You logged in from another location"); } @@ -284,7 +288,7 @@ Object object; if (this.server.W()) { -@@ -298,17 +413,25 @@ +@@ -298,17 +414,25 @@ } return new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, (PlayerInteractManager) object); @@ -311,7 +315,7 @@ entityplayer.dimension = i; Object object; -@@ -319,80 +442,270 @@ +@@ -319,80 +443,270 @@ } EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object); @@ -618,7 +622,7 @@ if (entity.dimension == -1) { d0 = MathHelper.a(d0 / d2, worldserver1.af().b() + 16.0D, worldserver1.af().d() - 16.0D); d1 = MathHelper.a(d1 / d2, worldserver1.af().c() + 16.0D, worldserver1.af().e() - 16.0D); -@@ -411,6 +724,8 @@ +@@ -411,6 +725,8 @@ BlockPosition blockposition; if (i == 1) { @@ -627,7 +631,7 @@ blockposition = worldserver1.getSpawn(); } else { blockposition = worldserver1.getDimensionSpawn(); -@@ -424,15 +739,26 @@ +@@ -424,15 +740,26 @@ worldserver.entityJoinedWorld(entity, false); } } @@ -656,7 +660,7 @@ worldserver1.addEntity(entity); worldserver1.entityJoinedWorld(entity, false); } -@@ -441,6 +767,7 @@ +@@ -441,6 +768,7 @@ } entity.spawnIn(worldserver1); @@ -664,7 +668,7 @@ } public void tick() { -@@ -549,10 +876,24 @@ +@@ -549,10 +877,24 @@ public void addOp(GameProfile gameprofile) { this.operators.add(new OpListEntry(gameprofile, this.server.p())); @@ -689,7 +693,7 @@ } public boolean isWhitelisted(GameProfile gameprofile) { -@@ -560,7 +901,7 @@ +@@ -560,7 +902,7 @@ } public boolean isOp(GameProfile gameprofile) { @@ -698,7 +702,7 @@ } public EntityPlayer getPlayer(String s) { -@@ -587,6 +928,12 @@ +@@ -587,6 +929,12 @@ for (int j = 0; j < this.players.size(); ++j) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(j); @@ -711,7 +715,7 @@ if (entityplayer != entityhuman && entityplayer.dimension == i) { double d4 = d0 - entityplayer.locX; double d5 = d1 - entityplayer.locY; -@@ -634,21 +981,26 @@ +@@ -634,21 +982,26 @@ public void reloadWhitelist() {} public void b(EntityPlayer entityplayer, WorldServer worldserver) { @@ -743,7 +747,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); } -@@ -661,7 +1013,7 @@ +@@ -661,7 +1014,7 @@ } public String[] getSeenPlayers() { @@ -752,7 +756,7 @@ } public boolean getHasWhitelist() { -@@ -711,10 +1063,17 @@ +@@ -711,10 +1064,17 @@ public void v() { for (int i = 0; i < this.players.size(); ++i) { @@ -771,7 +775,7 @@ public void sendMessage(IChatBaseComponent ichatbasecomponent, boolean flag) { this.server.sendMessage(ichatbasecomponent); -@@ -754,11 +1113,10 @@ +@@ -754,11 +1114,10 @@ public void a(int i) { this.r = i; if (this.server.worldServer != null) {