2
0
mirror of https://github.com/PaperMC/Paper.git synced 2024-12-15 07:01:36 +08:00

Make setPersistent also control player saving

This commit is contained in:
Ugleh 2018-10-02 11:41:47 -04:00 committed by md_5
parent 68588dac4f
commit 02518f92ab

View File

@ -162,9 +162,11 @@
}
public void b(WorldBorder worldborder, double d0) {}
@@ -254,13 +302,13 @@
@@ -253,14 +301,15 @@
}
protected void savePlayerFile(EntityPlayer entityplayer) {
+ if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit
this.playerFileData.save(entityplayer);
- ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) this.o.get(entityplayer.getUniqueID());
+ ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit
@ -178,7 +180,7 @@
if (advancementdataplayer != null) {
advancementdataplayer.c();
@@ -268,29 +316,80 @@
@@ -268,29 +317,80 @@
}
@ -266,7 +268,7 @@
this.savePlayerFile(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle();
@@ -321,18 +420,68 @@
@@ -321,18 +421,68 @@
if (entityplayer1 == entityplayer) {
this.j.remove(uuid);
@ -341,7 +343,7 @@
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile);
chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[] { gameprofilebanentry.getReason()});
@@ -340,10 +489,12 @@
@@ -340,10 +490,12 @@
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[] { PlayerList.g.format(gameprofilebanentry.getExpires())}));
}
@ -357,7 +359,7 @@
IpBanEntry ipbanentry = this.l.get(socketaddress);
chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[] { ipbanentry.getReason()});
@@ -351,13 +502,25 @@
@@ -351,13 +503,25 @@
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[] { PlayerList.g.format(ipbanentry.getExpires())}));
}
@ -386,7 +388,7 @@
UUID uuid = EntityHuman.a(gameprofile);
ArrayList arraylist = Lists.newArrayList();
@@ -392,17 +555,27 @@
@@ -392,17 +556,27 @@
}
return new EntityPlayer(this.server, this.server.getWorldServer(DimensionManager.OVERWORLD), gameprofile, (PlayerInteractManager) object);
@ -415,7 +417,7 @@
entityplayer.dimension = dimensionmanager;
Object object;
@@ -413,6 +586,11 @@
@@ -413,6 +587,11 @@
}
EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object);
@ -427,7 +429,7 @@
entityplayer1.playerConnection = entityplayer.playerConnection;
entityplayer1.copyFrom(entityplayer, flag);
@@ -426,43 +604,160 @@
@@ -426,43 +605,160 @@
entityplayer1.addScoreboardTag(s);
}
@ -605,7 +607,7 @@
public void f(EntityPlayer entityplayer) {
GameProfile gameprofile = entityplayer.getProfile();
int i = this.server.a(gameprofile);
@@ -499,42 +794,69 @@
@@ -499,42 +795,69 @@
}
public void changeWorld(Entity entity, DimensionManager dimensionmanager, WorldServer worldserver, WorldServer worldserver1) {
@ -678,7 +680,7 @@
}
worldserver.methodProfiler.e();
@@ -542,22 +864,119 @@
@@ -542,22 +865,119 @@
worldserver.methodProfiler.a("placing");
d0 = (double) MathHelper.clamp((int) d0, -29999872, 29999872);
d1 = (double) MathHelper.clamp((int) d1, -29999872, 29999872);
@ -799,7 +801,7 @@
this.v = 0;
}
@@ -570,6 +989,25 @@
@@ -570,6 +990,25 @@
}
@ -825,7 +827,7 @@
public void a(Packet<?> packet, DimensionManager dimensionmanager) {
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@@ -670,6 +1108,7 @@
@@ -670,6 +1109,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
}
@ -833,7 +835,7 @@
this.server.getCommandDispatcher().a(entityplayer);
}
@@ -702,6 +1141,12 @@
@@ -702,6 +1142,12 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@ -846,7 +848,7 @@
if (entityplayer != entityhuman && entityplayer.dimension == dimensionmanager) {
double d4 = d0 - entityplayer.locX;
double d5 = d1 - entityplayer.locY;
@@ -741,7 +1186,7 @@
@@ -741,7 +1187,7 @@
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
@ -855,7 +857,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE));
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
@@ -749,16 +1194,21 @@
@@ -749,16 +1195,21 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition));
if (worldserver.isRaining()) {
@ -881,7 +883,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
}
@@ -820,26 +1270,39 @@
@@ -820,26 +1271,39 @@
}
public void u() {
@ -926,7 +928,7 @@
if (serverstatisticmanager == null) {
File file = new File(this.server.getWorldServer(DimensionManager.OVERWORLD).getDataManager().getDirectory(), "stats");
@@ -854,7 +1317,7 @@
@@ -854,7 +1318,7 @@
}
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
@ -935,7 +937,7 @@
}
return serverstatisticmanager;
@@ -862,14 +1325,14 @@
@@ -862,14 +1326,14 @@
public AdvancementDataPlayer h(EntityPlayer entityplayer) {
UUID uuid = entityplayer.getUniqueID();
@ -952,7 +954,7 @@
}
advancementdataplayer.a(entityplayer);
@@ -905,13 +1368,20 @@
@@ -905,13 +1369,20 @@
}
public void reload() {