@@ -28,7 +28,7 @@
|
||||
public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -58,6 +79,20 @@
|
||||
@@ -60,6 +81,20 @@
|
||||
public int ping;
|
||||
public boolean viewingCredits;
|
||||
|
||||
@@ -49,10 +49,10 @@
|
||||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
|
||||
super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile);
|
||||
this.spawnDimension = World.OVERWORLD;
|
||||
@@ -68,12 +103,56 @@
|
||||
this.advancementDataPlayer = minecraftserver.getPlayerList().f(this);
|
||||
@@ -71,12 +106,56 @@
|
||||
this.G = 1.0F;
|
||||
this.c(worldserver);
|
||||
this.co = minecraftserver.a(this);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ this.displayName = this.getName();
|
||||
@@ -107,7 +107,7 @@
|
||||
int i = Math.max(0, this.server.a(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -139,11 +218,20 @@
|
||||
@@ -142,11 +221,20 @@
|
||||
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
|
||||
this.recipeBook.a(nbttagcompound.getCompound("recipeBook"), this.server.getCraftingManager());
|
||||
}
|
||||
@@ -128,7 +128,7 @@
|
||||
if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
|
||||
this.spawn = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
|
||||
this.spawnForced = nbttagcompound.getBoolean("SpawnForced");
|
||||
@@ -177,7 +265,20 @@
|
||||
@@ -180,7 +268,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -195,7 +296,7 @@
|
||||
@@ -198,7 +299,7 @@
|
||||
nbttagcompound.setInt("SpawnZ", this.spawn.getZ());
|
||||
nbttagcompound.setBoolean("SpawnForced", this.spawnForced);
|
||||
nbttagcompound.setFloat("SpawnAngle", this.spawnAngle);
|
||||
@@ -159,7 +159,7 @@
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
logger.getClass();
|
||||
@@ -203,9 +304,33 @@
|
||||
@@ -206,9 +307,33 @@
|
||||
nbttagcompound.set("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
@@ -193,7 +193,7 @@
|
||||
public void a(int i) {
|
||||
float f = (float) this.getExpToLevel();
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -259,6 +384,11 @@
|
||||
@@ -262,6 +387,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -205,7 +205,7 @@
|
||||
this.playerInteractManager.a();
|
||||
--this.invulnerableTicks;
|
||||
if (this.noDamageTicks > 0) {
|
||||
@@ -326,7 +456,7 @@
|
||||
@@ -329,7 +459,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastSentSaturationZero) {
|
||||
@@ -214,7 +214,7 @@
|
||||
this.lastHealthSent = this.getHealth();
|
||||
this.lastFoodSent = this.foodData.getFoodLevel();
|
||||
this.lastSentSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -357,6 +487,12 @@
|
||||
@@ -360,6 +490,12 @@
|
||||
this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.lastExpTotalScored));
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
if (this.expLevel != this.lastExpLevelScored) {
|
||||
this.lastExpLevelScored = this.expLevel;
|
||||
this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastExpLevelScored));
|
||||
@@ -371,6 +507,16 @@
|
||||
@@ -374,6 +510,16 @@
|
||||
CriterionTriggers.p.a(this);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
|
||||
@@ -381,7 +527,8 @@
|
||||
@@ -384,7 +530,8 @@
|
||||
}
|
||||
|
||||
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
@@ -254,7 +254,7 @@
|
||||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -389,9 +536,46 @@
|
||||
@@ -392,9 +539,46 @@
|
||||
@Override
|
||||
public void die(DamageSource damagesource) {
|
||||
boolean flag = this.world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES);
|
||||
@@ -303,9 +303,9 @@
|
||||
|
||||
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
|
||||
if (!future.isSuccess()) {
|
||||
@@ -425,12 +609,18 @@
|
||||
@@ -428,12 +612,18 @@
|
||||
if (this.world.getGameRules().getBoolean(GameRules.FORGIVE_DEAD_PLAYERS)) {
|
||||
this.eV();
|
||||
this.eW();
|
||||
}
|
||||
-
|
||||
- if (!this.isSpectator()) {
|
||||
@@ -326,7 +326,7 @@
|
||||
EntityLiving entityliving = this.getKillingEntity();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -466,10 +656,12 @@
|
||||
@@ -469,10 +659,12 @@
|
||||
String s = this.getName();
|
||||
String s1 = entity.getName();
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
} else {
|
||||
this.a(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -487,7 +679,8 @@
|
||||
@@ -490,7 +682,8 @@
|
||||
int i = scoreboardteam.getColor().b();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
@@ -351,7 +351,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,18 +724,20 @@
|
||||
@@ -534,18 +727,20 @@
|
||||
}
|
||||
|
||||
private boolean canPvP() {
|
||||
@@ -375,7 +375,7 @@
|
||||
} else {
|
||||
return shapedetectorshape;
|
||||
}
|
||||
@@ -551,11 +746,20 @@
|
||||
@@ -554,11 +749,20 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity b(WorldServer worldserver) {
|
||||
@@ -399,7 +399,7 @@
|
||||
this.decouple();
|
||||
this.getWorldServer().removePlayer(this);
|
||||
if (!this.viewingCredits) {
|
||||
@@ -566,6 +770,8 @@
|
||||
@@ -569,6 +773,8 @@
|
||||
|
||||
return this;
|
||||
} else {
|
||||
@@ -408,7 +408,7 @@
|
||||
WorldData worlddata = worldserver.getWorldData();
|
||||
|
||||
this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
|
||||
@@ -575,22 +781,52 @@
|
||||
@@ -578,22 +784,52 @@
|
||||
playerlist.d(this);
|
||||
worldserver1.removePlayer(this);
|
||||
this.dead = false;
|
||||
@@ -467,7 +467,7 @@
|
||||
worldserver1.getMethodProfiler().exit();
|
||||
this.triggerDimensionAdvancements(worldserver1);
|
||||
this.playerInteractManager.a(worldserver);
|
||||
@@ -609,12 +845,31 @@
|
||||
@@ -612,12 +848,31 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
@@ -499,7 +499,7 @@
|
||||
private void a(WorldServer worldserver, BlockPosition blockposition) {
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
|
||||
|
||||
@@ -631,17 +886,17 @@
|
||||
@@ -634,17 +889,17 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -522,7 +522,7 @@
|
||||
}
|
||||
|
||||
return optional1;
|
||||
@@ -685,10 +940,8 @@
|
||||
@@ -688,10 +943,8 @@
|
||||
this.activeContainer.c();
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@
|
||||
if (!this.isSleeping() && this.isAlive()) {
|
||||
if (!this.world.getDimensionManager().isNatural()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
||||
@@ -714,7 +967,36 @@
|
||||
@@ -717,7 +970,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@
|
||||
this.a(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.q.a(this);
|
||||
});
|
||||
@@ -723,9 +1005,8 @@
|
||||
@@ -726,9 +1008,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
@@ -584,7 +584,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -752,6 +1033,7 @@
|
||||
@@ -755,6 +1036,7 @@
|
||||
|
||||
@Override
|
||||
public void wakeup(boolean flag, boolean flag1) {
|
||||
@@ -592,7 +592,7 @@
|
||||
if (this.isSleeping()) {
|
||||
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -823,8 +1105,9 @@
|
||||
@@ -826,8 +1108,9 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||
}
|
||||
|
||||
@@ -603,7 +603,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -839,6 +1122,24 @@
|
||||
@@ -842,6 +1125,24 @@
|
||||
this.nextContainerCounter();
|
||||
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
|
||||
|
||||
@@ -628,7 +628,7 @@
|
||||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
|
||||
@@ -846,9 +1147,11 @@
|
||||
@@ -849,9 +1150,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@@ -642,7 +642,7 @@
|
||||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -861,13 +1164,24 @@
|
||||
@@ -864,13 +1167,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@@ -669,7 +669,7 @@
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
@@ -912,6 +1226,11 @@
|
||||
@@ -915,6 +1229,11 @@
|
||||
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
|
||||
@@ -681,7 +681,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -921,6 +1240,7 @@
|
||||
@@ -924,6 +1243,7 @@
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@@ -689,7 +689,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
||||
this.o();
|
||||
}
|
||||
@@ -955,7 +1275,7 @@
|
||||
@@ -958,7 +1278,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic, int i) {
|
||||
this.serverStatisticManager.b(this, statistic, i);
|
||||
@@ -698,7 +698,7 @@
|
||||
scoreboardscore.addScore(i);
|
||||
});
|
||||
}
|
||||
@@ -963,7 +1283,7 @@
|
||||
@@ -966,7 +1286,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic) {
|
||||
this.serverStatisticManager.setStatistic(this, statistic, 0);
|
||||
@@ -707,7 +707,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1012,8 +1332,17 @@
|
||||
@@ -1015,8 +1335,17 @@
|
||||
|
||||
public void triggerHealthUpdate() {
|
||||
this.lastHealthSent = -1.0E8F;
|
||||
@@ -725,7 +725,7 @@
|
||||
@Override
|
||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT, SystemUtils.b));
|
||||
@@ -1065,12 +1394,13 @@
|
||||
@@ -1068,12 +1397,13 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
@@ -740,7 +740,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1138,6 +1468,18 @@
|
||||
@@ -1141,6 +1471,18 @@
|
||||
|
||||
@Override
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
@@ -759,7 +759,7 @@
|
||||
this.playerInteractManager.setGameMode(enumgamemode);
|
||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId()));
|
||||
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
||||
@@ -1187,7 +1529,20 @@
|
||||
@@ -1190,7 +1532,20 @@
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -780,7 +780,7 @@
|
||||
this.bY = packetplayinsettings.d();
|
||||
this.bZ = packetplayinsettings.e();
|
||||
this.getDataWatcher().set(EntityPlayer.bi, (byte) packetplayinsettings.f());
|
||||
@@ -1223,13 +1578,13 @@
|
||||
@@ -1226,13 +1581,13 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
|
||||
} else {
|
||||
@@ -796,7 +796,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1253,7 +1608,7 @@
|
||||
@@ -1256,7 +1611,7 @@
|
||||
this.spectatedEntity = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.spectatedEntity) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
|
||||
@@ -805,7 +805,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1282,7 +1637,7 @@
|
||||
@@ -1285,7 +1640,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
@@ -814,7 +814,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1303,9 +1658,16 @@
|
||||
@@ -1306,9 +1661,16 @@
|
||||
return this.advancementDataPlayer;
|
||||
}
|
||||
|
||||
@@ -831,7 +831,7 @@
|
||||
if (worldserver == this.world) {
|
||||
this.playerConnection.a(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1326,6 +1688,9 @@
|
||||
@@ -1329,6 +1691,9 @@
|
||||
this.server.getPlayerList().a(this, worldserver);
|
||||
this.server.getPlayerList().updateClient(this);
|
||||
}
|
||||
@@ -841,9 +841,9 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1418,4 +1783,144 @@
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1426,4 +1791,144 @@
|
||||
public ITextFilter Q() {
|
||||
return this.co;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Add per-player time and weather.
|
||||
|
||||
Reference in New Issue
Block a user