13
0
geforkt von Mirrors/Paper

Update to Minecraft 1.16.4

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2020-11-03 07:00:00 +11:00
Ursprung 964cc7554a
Commit 6450eb0ab7
34 geänderte Dateien mit 374 neuen und 330 gelöschten Zeilen

Datei anzeigen

@ -15,9 +15,9 @@
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
private static final Logger LOGGER = LogManager.getLogger();
@@ -34,8 +42,10 @@
@@ -36,8 +44,10 @@
@Nullable
private ServerGUI q;
private final TextFilter r;
- public DedicatedServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- super(thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
@ -27,8 +27,8 @@
+ // CraftBukkit end
this.propertyManager = dedicatedserversettings;
this.remoteControlCommandListener = new RemoteControlCommandListener(this);
}
@@ -44,13 +54,44 @@
this.r = null;
@@ -47,13 +57,44 @@
public boolean init() throws IOException {
Thread thread = new Thread("Server console handler") {
public void run() {
@ -76,7 +76,7 @@
}
} catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
@@ -59,6 +100,27 @@
@@ -62,6 +103,27 @@
}
};
@ -104,7 +104,7 @@
thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
thread.start();
@@ -85,7 +147,7 @@
@@ -88,7 +150,7 @@
this.setForceGamemode(dedicatedserverproperties.forceGamemode);
super.setIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
this.i(dedicatedserverproperties.enforceWhitelist);
@ -113,7 +113,7 @@
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
InetAddress inetaddress = null;
@@ -110,6 +172,12 @@
@@ -112,6 +174,12 @@
return false;
}
@ -126,7 +126,7 @@
if (!this.getOnlineMode()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
@@ -124,7 +192,7 @@
@@ -126,7 +194,7 @@
if (!NameReferencingFileConverter.e(this)) {
return false;
} else {
@ -135,7 +135,7 @@
long i = SystemUtils.getMonotonicNanos();
this.c(dedicatedserverproperties.maxBuildHeight);
@@ -132,7 +200,7 @@
@@ -134,7 +202,7 @@
TileEntitySkull.a(this.getMinecraftSessionService());
UserCache.a(this.getOnlineMode());
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getWorld());
@ -144,7 +144,7 @@
long j = SystemUtils.getMonotonicNanos() - i;
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
@@ -149,6 +217,7 @@
@@ -151,6 +219,7 @@
if (dedicatedserverproperties.enableRcon) {
DedicatedServer.LOGGER.info("Starting remote control listener");
this.remoteControlListener = RemoteControlListener.a((IMinecraftServer) this);
@ -152,7 +152,7 @@
}
if (this.getMaxTickTime() > 0L) {
@@ -259,6 +328,7 @@
@@ -265,6 +334,7 @@
this.remoteStatusListener.b();
}
@ -160,7 +160,7 @@
}
@Override
@@ -287,7 +357,15 @@
@@ -293,7 +363,15 @@
while (!this.serverCommandQueue.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
@ -177,7 +177,7 @@
}
}
@@ -497,14 +575,45 @@
@@ -503,14 +581,45 @@
@Override
public String getPlugins() {
@ -225,9 +225,9 @@
});
return this.remoteControlCommandListener.getMessages();
}
@@ -540,4 +649,15 @@
public boolean isSyncChunkWrites() {
return this.propertyManager.getProperties().syncChunkWrites;
@@ -552,4 +661,15 @@
public ITextFilter a(EntityPlayer entityplayer) {
return this.r != null ? this.r.a(entityplayer.getProfile()) : null;
}
+
+ // CraftBukkit start

Datei anzeigen

@ -12,7 +12,7 @@
public final boolean onlineMode = this.getBoolean("online-mode", true);
public final boolean preventProxyConnections = this.getBoolean("prevent-proxy-connections", false);
public final String serverIp = this.getString("server-ip", "");
@@ -54,8 +56,10 @@
@@ -55,8 +57,10 @@
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
public final GeneratorSettings generatorSettings;
@ -25,7 +25,7 @@
this.difficulty = (EnumDifficulty) this.a("difficulty", a(EnumDifficulty::getById, EnumDifficulty::a), EnumDifficulty::c, EnumDifficulty.EASY);
this.gamemode = (EnumGamemode) this.a("gamemode", a(EnumGamemode::getById, EnumGamemode::a), EnumGamemode::b, EnumGamemode.SURVIVAL);
this.levelName = this.getString("level-name", "world");
@@ -105,12 +109,14 @@
@@ -107,12 +111,14 @@
this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties);
}

Datei anzeigen

@ -135,7 +135,7 @@
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
}
protected void ae() {
protected void af() {
@@ -249,6 +348,15 @@
this.entityBaseTick();
}
@ -158,8 +158,8 @@
this.lastYaw = this.yaw;
- this.doPortalTick();
+ if (this instanceof EntityPlayer) this.doPortalTick(); // CraftBukkit - // Moved up to postTick
if (this.aN()) {
this.aO();
if (this.aO()) {
this.aP();
}
@@ -325,12 +433,44 @@
@ -233,7 +233,7 @@
+ }
+ // CraftBukkit end
+
if (this.onGround && !this.bu()) {
if (this.onGround && !this.bv()) {
block.stepOn(this.world, blockposition, this);
}
@@ -700,6 +862,7 @@
@ -430,7 +430,7 @@
}
@@ -1589,10 +1851,31 @@
this.be();
this.bf();
}
- protected void addPassenger(Entity entity) {
@ -662,7 +662,7 @@
+ // CraftBukkit end
}
this.bM();
this.bN();
@@ -2012,13 +2398,18 @@
@Nullable

Datei anzeigen

@ -32,4 +32,4 @@
+ if (this.world.isClientSide || ageLocked) { // CraftBukkit
if (this.d > 0) {
if (this.d % 4 == 0) {
this.world.addParticle(Particles.HAPPY_VILLAGER, this.d(1.0D), this.cE() + 0.5D, this.g(1.0D), 0.0D, 0.0D, 0.0D);
this.world.addParticle(Particles.HAPPY_VILLAGER, this.d(1.0D), this.cF() + 0.5D, this.g(1.0D), 0.0D, 0.0D, 0.0D);

Datei anzeigen

@ -18,7 +18,7 @@
@@ -14,6 +18,12 @@
this(entitytypes, world);
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
this.ae();
this.af();
+ // CraftBukkit start - Added setDirection method
+ this.setDirection(d3, d4, d5);
+ }

Datei anzeigen

@ -8,7 +8,7 @@
public class EntityFireworks extends IProjectile {
@@ -119,7 +120,11 @@
@@ -121,7 +122,11 @@
}
if (!this.world.isClientSide && this.ticksFlown > this.expectedLifespan) {
@ -21,7 +21,7 @@
}
}
@@ -134,7 +139,11 @@
@@ -136,7 +141,11 @@
protected void a(MovingObjectPositionEntity movingobjectpositionentity) {
super.a(movingobjectpositionentity);
if (!this.world.isClientSide) {
@ -34,7 +34,7 @@
}
}
@@ -144,7 +153,11 @@
@@ -146,7 +155,11 @@
this.world.getType(blockposition).a(this.world, blockposition, (Entity) this);
if (!this.world.s_() && this.hasExplosions()) {
@ -47,7 +47,7 @@
}
super.a(movingobjectpositionblock);
@@ -170,7 +183,9 @@
@@ -172,7 +185,9 @@
if (f > 0.0F) {
if (this.ridingEntity != null) {
@ -57,7 +57,7 @@
}
double d0 = 5.0D;
@@ -197,7 +212,9 @@
@@ -199,7 +214,9 @@
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.g((Entity) entityliving)) / 5.0D);

Datei anzeigen

@ -114,7 +114,7 @@
return false;
} else {
this.ticksFarFromPlayer = 0;
if (this.dk()) {
if (this.dl()) {
return false;
} else {
- this.releaseShoulderEntities();

Datei anzeigen

@ -323,8 +323,8 @@
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
@@ -1420,6 +1538,7 @@
@Override
protected void bM() {
super.bM();
protected void bN() {
super.bN();
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(true, false);
}

Datei anzeigen

@ -45,7 +45,7 @@
}
+ // CraftBukkit end */
this.impulse |= this.aJ();
this.impulse |= this.aK();
if (!this.world.isClientSide) {
@@ -122,6 +132,12 @@
}

Datei anzeigen

@ -60,7 +60,7 @@
+ this.datawatcher.set(EntityLiving.HEALTH, (float) this.getAttributeInstance(GenericAttributes.MAX_HEALTH).getValue());
this.i = true;
this.az = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.ae();
this.af();
@@ -184,7 +222,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@ -78,7 +78,7 @@
@@ -406,7 +450,7 @@
protected void cT() {
protected void cU() {
++this.deathTicks;
- if (this.deathTicks == 20) {
+ if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
@ -345,7 +345,7 @@
return false;
} else if (this.world.isClientSide) {
return false;
- } else if (this.dk()) {
- } else if (this.dl()) {
+ } else if (this.dead || this.killed || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die
return false;
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
@ -476,7 +476,7 @@
boolean flag = this.lastDamageByPlayerTime > 0;
+ this.dropInventory(); // CraftBukkit - from below
if (this.cV() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
if (this.cW() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
this.a(damagesource, flag);
this.dropDeathLoot(damagesource, i, flag);
}
@ -757,7 +757,7 @@
+ }
+ // CraftBukkit end
+
public final int dy() {
public final int dz() {
return (Integer) this.datawatcher.get(EntityLiving.bi);
}
@@ -1816,6 +2223,7 @@

Datei anzeigen

@ -95,7 +95,7 @@
this.c(this.getType() - 1);
}
@@ -246,7 +296,7 @@
this.am();
this.an();
}
- this.doPortalTick();

Datei anzeigen

@ -2,7 +2,7 @@
+++ b/net/minecraft/server/EntityMinecartCommandBlock.java
@@ -103,5 +103,12 @@
public CommandListenerWrapper getWrapper() {
return new CommandListenerWrapper(this, EntityMinecartCommandBlock.this.getPositionVector(), EntityMinecartCommandBlock.this.bh(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this);
return new CommandListenerWrapper(this, EntityMinecartCommandBlock.this.getPositionVector(), EntityMinecartCommandBlock.this.bi(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this);
}
+
+ // CraftBukkit start

Datei anzeigen

@ -1,11 +0,0 @@
--- a/net/minecraft/server/EntityMinecartFurnace.java
+++ b/net/minecraft/server/EntityMinecartFurnace.java
@@ -3,7 +3,7 @@
public class EntityMinecartFurnace extends EntityMinecartAbstract {
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityMinecartFurnace.class, DataWatcherRegistry.i);
- private int e;
+ public int e; // CraftBukkit PAIL private -> public, RENAME fuel
public double b;
public double c;
private static final RecipeItemStack f = RecipeItemStack.a(Items.COAL, Items.CHARCOAL);

Datei anzeigen

@ -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.

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityTNTPrimed.java
+++ b/net/minecraft/server/EntityTNTPrimed.java
@@ -1,13 +1,16 @@
@@ -1,6 +1,7 @@
package net.minecraft.server;
import javax.annotation.Nullable;
@ -8,10 +8,9 @@
public class EntityTNTPrimed extends Entity {
private static final DataWatcherObject<Integer> FUSE_TICKS = DataWatcher.a(EntityTNTPrimed.class, DataWatcherRegistry.b);
@@ -8,6 +9,8 @@
@Nullable
- private EntityLiving source;
+ public EntityLiving source; // PAIL private -> public
public EntityLiving source;
private int fuseTicks;
+ public float yield = 4; // CraftBukkit - add field
+ public boolean isIncendiary = false; // CraftBukkit - add field
@ -31,7 +30,7 @@
+ this.die();
+ // CraftBukkit end
} else {
this.aJ();
this.aK();
if (this.world.isClientSide) {
@@ -71,9 +77,16 @@
}

Datei anzeigen

@ -64,7 +64,7 @@
this.a(f);
this.foodTickTimer = 0;
}
} else if (flag && this.foodLevel >= 18 && entityhuman.eI()) {
} else if (flag && this.foodLevel >= 18 && entityhuman.eJ()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
- entityhuman.heal(1.0F);

Datei anzeigen

@ -17,10 +17,10 @@
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
private final MinecraftServer b;
private final NetworkManager c;
@@ -18,6 +27,41 @@
@@ -16,6 +25,40 @@
switch (packethandshakinginsetprotocol.b()) {
case LOGIN:
this.c.setProtocol(EnumProtocol.LOGIN);
ChatMessage chatmessage;
+ // CraftBukkit start - Connection throttle
+ try {
+ long currentTime = System.currentTimeMillis();
@ -30,7 +30,7 @@
+ synchronized (throttleTracker) {
+ if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
+ throttleTracker.put(address, currentTime);
+ chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
+ ChatMessage chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
+ this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
+ this.c.close(chatmessage);
+ return;
@ -55,11 +55,10 @@
+ org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
+ }
+ // CraftBukkit end
+
if (packethandshakinginsetprotocol.c() > SharedConstants.getGameVersion().getProtocolVersion()) {
chatmessage = new ChatMessage("multiplayer.disconnect.outdated_server", new Object[]{SharedConstants.getGameVersion().getName()});
this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
@@ -28,6 +72,7 @@
if (packethandshakinginsetprotocol.c() != SharedConstants.getGameVersion().getProtocolVersion()) {
ChatMessage chatmessage;
@@ -29,6 +72,7 @@
this.c.close(chatmessage);
} else {
this.c.setPacketListener(new LoginListener(this.b, this.c));

Datei anzeigen

@ -7,5 +7,5 @@
- if (!entity1.isCollidable()) {
+ if (!entity1.canCollideWith(entity) || !entity.canCollideWith(entity1)) { // CraftBukkit - collidable API
return false;
} else if (entity.world.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).ey())) {
} else if (entity.world.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).ez())) {
return false;

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/LoginListener.java
+++ b/net/minecraft/server/LoginListener.java
@@ -17,6 +17,12 @@
@@ -18,6 +18,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -13,7 +13,7 @@
public class LoginListener implements PacketLoginInListener {
private static final AtomicInteger b = new AtomicInteger(0);
@@ -31,6 +37,7 @@
@@ -32,6 +38,7 @@
private final String j;
private SecretKey loginKey;
private EntityPlayer l;
@ -21,7 +21,7 @@
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.g = LoginListener.EnumProtocolState.HELLO;
@@ -59,6 +66,20 @@
@@ -60,6 +67,20 @@
}
@ -42,7 +42,7 @@
@Override
public NetworkManager a() {
return this.networkManager;
@@ -80,10 +101,12 @@
@@ -81,10 +102,12 @@
this.i = this.a(this.i);
}
@ -57,8 +57,8 @@
+ // CraftBukkit end
} else {
this.g = LoginListener.EnumProtocolState.ACCEPTED;
if (this.server.aw() >= 0 && !this.networkManager.isLocal()) {
@@ -97,9 +120,9 @@
if (this.server.ax() >= 0 && !this.networkManager.isLocal()) {
@@ -98,9 +121,9 @@
if (entityplayer != null) {
this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT;
@ -70,59 +70,59 @@
}
}
@@ -147,6 +170,43 @@
LoginListener.this.i = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
if (LoginListener.this.i != null) {
+ // CraftBukkit start - fire PlayerPreLoginEvent
+ if (!networkManager.isConnected()) {
@@ -158,6 +181,43 @@
try {
LoginListener.this.i = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
if (LoginListener.this.i != null) {
+ // CraftBukkit start - fire PlayerPreLoginEvent
+ if (!networkManager.isConnected()) {
+ return;
+ }
+
+ String playerName = i.getName();
+ java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
+ java.util.UUID uniqueId = i.getId();
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;
+
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
+ server.getPluginManager().callEvent(asyncEvent);
+
+ if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
+ final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
+ if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
+ event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
+ }
+ Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>() {
+ @Override
+ protected PlayerPreLoginEvent.Result evaluate() {
+ server.getPluginManager().callEvent(event);
+ return event.getResult();
+ }};
+
+ LoginListener.this.server.processQueue.add(waitable);
+ if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
+ disconnect(event.getKickMessage());
+ return;
+ }
+
+ String playerName = i.getName();
+ java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
+ java.util.UUID uniqueId = i.getId();
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;
+
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
+ server.getPluginManager().callEvent(asyncEvent);
+
+ if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
+ final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId);
+ if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
+ event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage());
+ }
+ Waitable<PlayerPreLoginEvent.Result> waitable = new Waitable<PlayerPreLoginEvent.Result>() {
+ @Override
+ protected PlayerPreLoginEvent.Result evaluate() {
+ server.getPluginManager().callEvent(event);
+ return event.getResult();
+ }};
+
+ LoginListener.this.server.processQueue.add(waitable);
+ if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) {
+ disconnect(event.getKickMessage());
+ return;
+ }
+ } else {
+ if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
+ disconnect(asyncEvent.getKickMessage());
+ return;
+ }
+ } else {
+ if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) {
+ disconnect(asyncEvent.getKickMessage());
+ return;
+ }
+ // CraftBukkit end
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId());
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else if (LoginListener.this.server.isEmbeddedServer()) {
@@ -166,6 +226,11 @@
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
}
+ // CraftBukkit start - catch all exceptions
+ } catch (Exception exception) {
+ disconnect("Failed to verify username!");
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception);
+ }
+ // CraftBukkit end
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId());
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else if (LoginListener.this.server.isEmbeddedServer()) {
@@ -177,6 +237,11 @@
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
}
+ // CraftBukkit start - catch all exceptions
+ } catch (Exception exception) {
+ disconnect("Failed to verify username!");
+ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception);
+ // CraftBukkit end
}
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -28,7 +28,8 @@
@@ -27,7 +27,8 @@
public Main() {}
@ -10,7 +10,7 @@
OptionParser optionparser = new OptionParser();
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -52,20 +53,22 @@
@@ -51,20 +52,22 @@
optionparser.printHelpOn(System.err);
return;
}
@ -35,13 +35,13 @@
Main.LOGGER.info("Initialized '{}' and '{}'", java_nio_file_path.toAbsolutePath(), java_nio_file_path1.toAbsolutePath());
return;
}
@@ -75,24 +78,42 @@
@@ -74,24 +77,42 @@
return;
}
- File file = new File((String) optionset.valueOf(optionspec9));
+ File file = (File) optionset.valueOf("universe"); // CraftBukkit
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString());
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY);
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
@ -82,7 +82,7 @@
DataPackConfiguration datapackconfiguration1 = MinecraftServer.a(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.a : datapackconfiguration, flag);
CompletableFuture completablefuture = DataPackResources.a(resourcepackrepository.f(), CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.f(), Runnable::run);
@@ -107,6 +128,7 @@
@@ -106,6 +127,7 @@
}
datapackresources.i();
@ -90,7 +90,7 @@
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, datapackresources.h(), iregistrycustom_dimension);
Object object = convertable_conversionsession.a((DynamicOps) registryreadops, datapackconfiguration1);
@@ -134,21 +156,32 @@
@@ -133,21 +155,32 @@
}
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
@ -109,7 +109,7 @@
+ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");
if (flag1 && !GraphicsEnvironment.isHeadless()) {
dedicatedserver1.bc();
dedicatedserver1.bd();
}
+ if (optionset.has("port")) {
@ -125,7 +125,7 @@
Thread thread = new Thread("Server Shutdown Thread") {
public void run() {
dedicatedserver.safeShutdown(true);
@@ -157,14 +190,15 @@
@@ -156,14 +189,15 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
Runtime.getRuntime().addShutdownHook(thread);

Datei anzeigen

@ -61,7 +61,7 @@
- public MinecraftServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
super("Server");
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ah);
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ai);
this.methodProfiler = GameProfilerDisabled.a;
this.serverPing = new ServerPing();
this.r = new Random();
@ -447,7 +447,7 @@
+ // CraftBukkit end
worldloadlistener.b();
chunkproviderserver.getLightEngine().a(5);
this.bb();
this.bc();
+
+ // CraftBukkit start
+ this.forceTicks = false;
@ -616,7 +616,7 @@
}
public CrashReport b(CrashReport crashreport) {
@@ -1214,16 +1472,17 @@
@@ -1220,16 +1478,17 @@
public CompletableFuture<Void> a(Collection<String> collection) {
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
@ -636,7 +636,7 @@
this.resourcePackRepository.a(collection);
this.saveData.a(a(this.resourcePackRepository));
datapackresources.i();
@@ -1589,6 +1848,22 @@
@@ -1595,6 +1854,22 @@
}

Datei anzeigen

@ -53,8 +53,8 @@
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
+ // CraftBukkit end
}
} else if ((this != MobEffects.HEAL || entityliving.di()) && (this != MobEffects.HARM || !entityliving.di())) {
if (this == MobEffects.HARM && !entityliving.di() || this == MobEffects.HEAL && entityliving.di()) {
} else if ((this != MobEffects.HEAL || entityliving.dj()) && (this != MobEffects.HARM || !entityliving.dj())) {
if (this == MobEffects.HARM && !entityliving.dj() || this == MobEffects.HEAL && entityliving.dj()) {
entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i));
}
} else {

Datei anzeigen

@ -7,7 +7,7 @@
- this.e.setGoalTarget(this.e.getLastDamager());
+ this.e.setGoalTarget(this.e.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
this.g = this.e.getGoalTarget();
this.c = this.e.cZ();
this.c = this.e.da();
this.h = 300;
@@ -100,6 +100,6 @@
}

Datei anzeigen

@ -6,6 +6,6 @@
if (!this.entity.isTamed()) {
- return false;
+ return this.entity.isWillSit() && this.entity.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
} else if (this.entity.aG()) {
} else if (this.entity.aH()) {
return false;
} else if (!this.entity.isOnGround()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/PlayerConnection.java
+++ b/net/minecraft/server/PlayerConnection.java
@@ -18,6 +18,48 @@
@@ -24,6 +24,48 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -49,7 +49,7 @@
public class PlayerConnection implements PacketListenerPlayIn {
private static final Logger LOGGER = LogManager.getLogger();
@@ -28,7 +70,10 @@
@@ -34,7 +76,10 @@
private long lastKeepAlive;
private boolean awaitingKeepAlive;
private long h;
@ -61,15 +61,14 @@
private int j;
private final Int2ShortMap k = new Int2ShortOpenHashMap();
private double l;
@@ -60,7 +105,33 @@
networkmanager.setPacketListener(this);
this.player = entityplayer;
entityplayer.playerConnection = this;
+
@@ -72,8 +117,33 @@
itextfilter.a();
}
+ // CraftBukkit start - add fields and methods
+ this.server = minecraftserver.server;
+ }
+
}
+ private final org.bukkit.craftbukkit.CraftServer server;
+ public boolean processedDisconnect;
+ private int lastTick = MinecraftServer.currentTick;
@ -90,12 +89,13 @@
+
+ public CraftPlayer getPlayer() {
+ return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
}
+ }
+ // CraftBukkit end
+
public void tick() {
this.syncPosition();
@@ -109,7 +180,7 @@
this.player.lastX = this.player.locX();
@@ -121,7 +191,7 @@
this.minecraftServer.getMethodProfiler().enter("keepAlive");
long i = SystemUtils.getMonotonicMillis();
@ -104,7 +104,7 @@
if (this.awaitingKeepAlive) {
this.disconnect(new ChatMessage("disconnect.timeout"));
} else {
@@ -121,15 +192,21 @@
@@ -133,15 +203,21 @@
}
this.minecraftServer.getMethodProfiler().exit();
@ -126,7 +126,7 @@
this.disconnect(new ChatMessage("multiplayer.disconnect.idling"));
}
@@ -153,16 +230,46 @@
@@ -165,16 +241,46 @@
return this.minecraftServer.a(this.player.getProfile());
}
@ -173,8 +173,17 @@
+ minecraftserver.postToMainThread(networkmanager::handleDisconnection);
}
@Override
@@ -203,7 +310,34 @@
private <T> void a(T t0, Consumer<T> consumer, BiFunction<ITextFilter, T, CompletableFuture<Optional<T>>> bifunction) {
@@ -190,7 +296,7 @@
ITextFilter itextfilter = this.player.Q();
if (itextfilter != null) {
- ((CompletableFuture) bifunction.apply(itextfilter, t0)).thenAcceptAsync((optional) -> {
+ (bifunction.apply(itextfilter, t0)).thenAcceptAsync((optional) -> { // CraftBukkit - decompile error
optional.ifPresent(consumer1);
}, iasynctaskhandler);
} else {
@@ -247,7 +353,34 @@
double d9 = entity.getMot().g();
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@ -210,7 +219,7 @@
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8);
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
return;
@@ -233,14 +367,72 @@
@@ -277,14 +410,72 @@
}
entity.setLocation(d3, d4, d5, f, f1);
@ -283,7 +292,7 @@
this.player.getWorldServer().getChunkProvider().movePlayer(this.player);
this.player.checkMovement(this.player.locX() - d0, this.player.locY() - d1, this.player.locZ() - d2);
this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && this.a(entity);
@@ -259,7 +451,7 @@
@@ -303,7 +494,7 @@
@Override
public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) {
PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer());
@ -292,7 +301,7 @@
this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
this.o = this.teleportPos.x;
this.p = this.teleportPos.y;
@@ -269,6 +461,7 @@
@@ -313,6 +504,7 @@
}
this.teleportPos = null;
@ -300,7 +309,7 @@
}
}
@@ -276,7 +469,7 @@
@@ -320,7 +512,7 @@
@Override
public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.getWorldServer());
@ -309,7 +318,7 @@
RecipeBookServer recipebookserver = this.player.getRecipeBook();
optional.ifPresent(recipebookserver::e);
@@ -305,6 +498,12 @@
@@ -349,6 +541,12 @@
@Override
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer());
@ -322,7 +331,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.c());
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -314,6 +513,7 @@
@@ -358,6 +556,7 @@
ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@ -330,7 +339,7 @@
this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
});
}
@@ -542,6 +742,7 @@
@@ -586,6 +785,7 @@
if (container instanceof ContainerMerchant) {
ContainerMerchant containermerchant = (ContainerMerchant) container;
@ -338,35 +347,49 @@
containermerchant.d(i);
containermerchant.g(i);
@@ -552,6 +753,14 @@
@@ -595,6 +795,13 @@
@Override
public void a(PacketPlayInBEdit packetplayinbedit) {
PlayerConnectionUtils.ensureMainThread(packetplayinbedit, this, this.player.getWorldServer());
+ // CraftBukkit start
+ if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
+ this.disconnect("Book edited too quickly!");
+ return;
+ }
+ this.lastBookTick = MinecraftServer.currentTick;
+ EnumItemSlot enumitemslot = packetplayinbedit.d() == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND;
+ // CraftBukkit end
ItemStack itemstack = packetplayinbedit.b();
if (!itemstack.isEmpty()) {
@@ -580,9 +789,11 @@
}
if (itemstack.getItem() == Items.WRITABLE_BOOK) {
@@ -610,13 +817,15 @@
itemstack2.a("pages", (NBTBase) nbttaglist);
- this.player.a(packetplayinbedit.d(), itemstack2);
+ this.player.a(packetplayinbedit.d(), CraftEventFactory.handleEditBookEvent(player, enumitemslot, itemstack1, itemstack2)); // CraftBukkit
} else {
+ ItemStack old = itemstack1.cloneItemStack(); // CraftBukkit
itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
+ CraftEventFactory.handleEditBookEvent(player, enumitemslot, old, itemstack1); // CraftBukkit
}
NBTTagList nbttaglist = nbttagcompound.getList("pages", 8);
- int i;
+ // CraftBukkit start - decompile error
+ // int i;
- for (i = 0; i < nbttaglist.size(); ++i) {
+ for (int i = 0; i < nbttaglist.size(); ++i) {
list.add(nbttaglist.getString(i));
}
@@ -624,7 +835,7 @@
- i = packetplayinbedit.d();
+ int i = packetplayinbedit.d();
+ // CraftBukkit end
if (PlayerInventory.d(i) || i == 40) {
this.a((List) list, flag ? (list1) -> {
this.a((String) list1.get(0), list1.subList(1, list1.size()), i);
@@ -664,7 +873,7 @@
}
itemstack1.a("pages", (NBTBase) nbttaglist);
- this.player.inventory.setItem(i, itemstack1);
+ this.player.inventory.setItem(i, CraftEventFactory.handleEditBookEvent(player, i, itemstack, itemstack1)); // CraftBukkit
}
}
@@ -702,7 +911,7 @@
} else {
WorldServer worldserver = this.player.getWorldServer();
@ -375,7 +398,7 @@
if (this.e == 0) {
this.syncPosition();
}
@@ -634,13 +845,21 @@
@@ -712,13 +921,21 @@
this.A = this.e;
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
}
@ -398,7 +421,7 @@
double d0 = this.player.locX();
double d1 = this.player.locY();
double d2 = this.player.locZ();
@@ -665,15 +884,33 @@
@@ -743,15 +960,33 @@
++this.receivedMovePackets;
int i = this.receivedMovePackets - this.processedMovePackets;
@ -434,7 +457,7 @@
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9);
this.a(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch);
return;
@@ -692,6 +929,7 @@
@@ -770,6 +1005,7 @@
}
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
@ -442,7 +465,7 @@
double d12 = d8;
d7 = d4 - this.player.locX();
@@ -713,10 +951,74 @@
@@ -791,10 +1027,74 @@
if (!this.player.noclip && !this.player.isSleeping() && (flag1 && worldserver.getCubes(this.player, axisalignedbb) || this.a((IWorldReader) worldserver, axisalignedbb))) {
this.a(d0, d1, d2, f, f1);
} else {
@ -519,7 +542,7 @@
if (flag) {
this.player.fallDistance = 0.0F;
}
@@ -745,10 +1047,66 @@
@@ -823,10 +1123,66 @@
}
public void a(double d0, double d1, double d2, float f, float f1) {
@ -587,7 +610,7 @@
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX() : 0.0D;
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY() : 0.0D;
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ() : 0.0D;
@@ -760,6 +1118,14 @@
@@ -838,6 +1194,14 @@
this.teleportAwait = 0;
}
@ -602,7 +625,7 @@
this.A = this.e;
this.player.setLocation(d0, d1, d2, f, f1);
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait));
@@ -768,6 +1134,7 @@
@@ -846,6 +1210,7 @@
@Override
public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());
@ -610,7 +633,7 @@
BlockPosition blockposition = packetplayinblockdig.b();
this.player.resetIdleTimer();
@@ -778,14 +1145,46 @@
@@ -856,14 +1221,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.b(EnumHand.OFF_HAND);
@ -659,7 +682,7 @@
this.player.dropItem(false);
}
@@ -822,6 +1221,7 @@
@@ -900,6 +1297,7 @@
@Override
public void a(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.getWorldServer());
@ -667,7 +690,7 @@
WorldServer worldserver = this.player.getWorldServer();
EnumHand enumhand = packetplayinuseitem.b();
ItemStack itemstack = this.player.b(enumhand);
@@ -832,6 +1232,14 @@
@@ -910,6 +1308,14 @@
this.player.resetIdleTimer();
if (blockposition.getY() < this.minecraftServer.getMaxBuildHeight()) {
if (this.teleportPos == null && this.player.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) {
@ -682,7 +705,7 @@
EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
if (enumdirection == EnumDirection.UP && !enuminteractionresult.a() && blockposition.getY() >= this.minecraftServer.getMaxBuildHeight() - 1 && a(this.player, itemstack)) {
@@ -855,12 +1263,51 @@
@@ -933,12 +1339,51 @@
@Override
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
@ -734,7 +757,7 @@
EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.b()) {
@@ -881,7 +1328,7 @@
@@ -959,7 +1404,7 @@
Entity entity = packetplayinspectate.a(worldserver);
if (entity != null) {
@ -743,7 +766,7 @@
return;
}
}
@@ -890,7 +1337,12 @@
@@ -968,7 +1413,12 @@
}
@Override
@ -757,7 +780,7 @@
@Override
public void a(PacketPlayInBoatMove packetplayinboatmove) {
@@ -905,11 +1357,26 @@
@@ -983,11 +1433,26 @@
@Override
public void a(IChatBaseComponent ichatbasecomponent) {
@ -782,10 +805,10 @@
+ this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage));
+ }
+ // CraftBukkit end
if (this.isExemptPlayer()) {
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
this.minecraftServer.safeShutdown(false);
@@ -935,6 +1402,15 @@
ITextFilter itextfilter = this.player.Q();
if (itextfilter != null) {
@@ -1019,6 +1484,15 @@
}
}
@ -801,7 +824,7 @@
try {
this.networkManager.sendPacket(packet, genericfuturelistener);
} catch (Throwable throwable) {
@@ -951,7 +1427,16 @@
@@ -1035,7 +1509,16 @@
@Override
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
@ -818,7 +841,7 @@
if (this.player.inventory.itemInHandIndex != packetplayinhelditemslot.b() && this.player.getRaisedHand() == EnumHand.MAIN_HAND) {
this.player.clearActiveItem();
}
@@ -960,13 +1445,24 @@
@@ -1044,65 +1527,286 @@
this.player.resetIdleTimer();
} else {
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getDisplayName().getString());
@ -828,30 +851,37 @@
@Override
public void a(PacketPlayInChat packetplayinchat) {
- PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.getWorldServer());
- if (this.player.getChatFlags() == EnumChatVisibility.HIDDEN) {
+ // CraftBukkit start - async chat
+ // SPIGOT-3638
+ if (this.minecraftServer.isStopped()) {
+ return;
+ }
+
+ boolean isSync = packetplayinchat.b().startsWith("/");
+ if (packetplayinchat.b().startsWith("/")) {
+ PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.getWorldServer());
+ }
+ // CraftBukkit end
String s = StringUtils.normalizeSpace(packetplayinchat.b());
if (s.startsWith("/")) {
PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.getWorldServer());
this.c(s);
} else {
- this.a(s, this::c);
+ this.c(s); // CraftBukkit - filter NYI
}
}
private void c(String s) {
- if (this.player.getChatFlags() == EnumChatVisibility.HIDDEN) {
+ if (this.player.dead || this.player.getChatFlags() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend")).a(EnumChatFormat.RED), ChatMessageType.SYSTEM, SystemUtils.b));
} else {
this.player.resetIdleTimer();
@@ -974,41 +1470,254 @@
+ boolean isSync = s.startsWith("/"); // CraftBukkit
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
- this.disconnect(new ChatMessage("multiplayer.disconnect.illegal_characters"));
+ // CraftBukkit start - threadsafety
+ if (!isSync) {
+ if (!s.startsWith("/")) {
+ Waitable waitable = new Waitable() {
+ @Override
+ protected Object evaluate() {
@ -1107,7 +1137,7 @@
this.player.resetIdleTimer();
IJumpable ijumpable;
@@ -1066,6 +1775,7 @@
@@ -1160,6 +1864,7 @@
@Override
public void a(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
@ -1115,7 +1145,7 @@
WorldServer worldserver = this.player.getWorldServer();
Entity entity = packetplayinuseentity.a((World) worldserver);
@@ -1079,18 +1789,72 @@
@@ -1173,18 +1878,72 @@
ItemStack itemstack = enumhand != null ? this.player.b(enumhand).cloneItemStack() : ItemStack.b;
Optional<EnumInteractionResult> optional = Optional.empty();
@ -1189,7 +1219,7 @@
}
if (optional.isPresent() && ((EnumInteractionResult) optional.get()).a()) {
@@ -1137,15 +1901,21 @@
@@ -1231,15 +1990,21 @@
@Override
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
@ -1213,7 +1243,7 @@
NonNullList<ItemStack> nonnulllist = NonNullList.a();
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
@@ -1154,8 +1924,274 @@
@@ -1248,8 +2013,274 @@
this.player.a(this.player.activeContainer, nonnulllist);
} else {
@ -1489,7 +1519,7 @@
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
this.player.e = true;
@@ -1195,6 +2231,7 @@
@@ -1289,6 +2320,7 @@
@Override
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
@ -1497,7 +1527,7 @@
this.player.resetIdleTimer();
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
this.player.activeContainer.a((EntityHuman) this.player, packetplayinenchantitem.c());
@@ -1227,6 +2264,43 @@
@@ -1321,6 +2353,43 @@
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@ -1541,7 +1571,7 @@
if (flag1 && flag2) {
if (itemstack.isEmpty()) {
@@ -1248,6 +2322,7 @@
@@ -1342,6 +2411,7 @@
@Override
public void a(PacketPlayInTransaction packetplayintransaction) {
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
@ -1549,15 +1579,15 @@
int i = this.player.activeContainer.windowId;
if (i == packetplayintransaction.b() && this.k.getOrDefault(i, (short) (packetplayintransaction.c() + 1)) == packetplayintransaction.c() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
@@ -1259,6 +2334,7 @@
@Override
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer());
@@ -1360,6 +2430,7 @@
}
private void a(PacketPlayInUpdateSign packetplayinupdatesign, List<String> list) {
+ if (this.player.isFrozen()) return; // CraftBukkit
this.player.resetIdleTimer();
WorldServer worldserver = this.player.getWorldServer();
BlockPosition blockposition = packetplayinupdatesign.b();
@@ -1275,14 +2351,30 @@
@@ -1376,12 +2447,28 @@
if (!tileentitysign.d() || tileentitysign.f() != this.player) {
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString());
@ -1565,8 +1595,6 @@
return;
}
String[] astring = packetplayinupdatesign.c();
+ // CraftBukkit start
+ Player player = this.server.getPlayer(this.player);
+ int x = packetplayinupdatesign.b().getX();
@ -1574,9 +1602,9 @@
+ int z = packetplayinupdatesign.b().getZ();
+ String[] lines = new String[4];
+
for (int i = 0; i < astring.length; ++i) {
- tileentitysign.a(i, new ChatComponentText(EnumChatFormat.a(astring[i])));
+ lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a(astring[i])).getString());
for (int i = 0; i < list.size(); ++i) {
- tileentitysign.a(i, new ChatComponentText((String) list.get(i)));
+ lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a((String) list.get(i))).getString());
}
+ SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
+ this.server.getPluginManager().callEvent(event);
@ -1589,7 +1617,7 @@
tileentitysign.update();
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
@@ -1292,6 +2384,7 @@
@@ -1391,6 +2478,7 @@
@Override
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
@ -1597,7 +1625,7 @@
if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) {
int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive);
@@ -1306,7 +2399,17 @@
@@ -1405,7 +2493,17 @@
@Override
public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
@ -1616,7 +1644,7 @@
}
@Override
@@ -1315,8 +2418,50 @@
@@ -1414,8 +2512,50 @@
this.player.a(packetplayinsettings);
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/RegionLimitedWorldAccess.java
+++ b/net/minecraft/server/RegionLimitedWorldAccess.java
@@ -234,6 +234,13 @@
@@ -236,6 +236,13 @@
@Override
public boolean addEntity(Entity entity) {

Datei anzeigen

@ -296,7 +296,7 @@
}
}
}
@@ -505,12 +694,25 @@
@@ -509,12 +698,25 @@
@Nullable
@Override
@ -322,7 +322,7 @@
TileEntity tileentity = null;
if (this.tickingTileEntities) {
@@ -545,6 +747,13 @@
@@ -549,6 +751,13 @@
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
if (!isOutsideWorld(blockposition)) {
if (tileentity != null && !tileentity.isRemoved()) {
@ -336,7 +336,7 @@
if (this.tickingTileEntities) {
tileentity.setLocation(this, blockposition);
Iterator iterator = this.tileEntityListPending.iterator();
@@ -569,7 +778,7 @@
@@ -573,7 +782,7 @@
}
public void removeTileEntity(BlockPosition blockposition) {

Datei anzeigen

@ -4,13 +4,13 @@
WorldServer getMinecraftWorld();
default void addAllEntities(Entity entity) {
- entity.co().forEach(this::addEntity);
- entity.cp().forEach(this::addEntity);
+ // CraftBukkit start
+ this.addAllEntities(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
}
+
+ default boolean addAllEntities(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
+ entity.co().forEach((e) -> this.addEntity(e, reason));
+ entity.cp().forEach((e) -> this.addEntity(e, reason));
+ return !entity.dead;
+ }
+ // CraftBukkit end

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/WorldServer.java
+++ b/net/minecraft/server/WorldServer.java
@@ -35,6 +35,18 @@
@@ -39,6 +39,18 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -19,7 +19,7 @@
public class WorldServer extends World implements GeneratorAccessSeed {
public static final BlockPosition a = new BlockPosition(100, 50, 0);
@@ -46,7 +58,7 @@
@@ -50,7 +62,7 @@
private final ChunkProviderServer chunkProvider;
boolean tickingEntities;
private final MinecraftServer server;
@ -28,7 +28,7 @@
public boolean savingDisabled;
private boolean everyoneSleeping;
private int emptyTime;
@@ -63,8 +75,23 @@
@@ -67,8 +79,23 @@
private final StructureManager structureManager;
private final boolean Q;
@ -54,7 +54,7 @@
this.nextTickListBlock = new TickListServer<>(this, (block) -> {
return block == null || block.getBlockData().isAir();
}, IRegistry.BLOCK::getKey, this::b);
@@ -76,10 +103,17 @@
@@ -80,10 +107,17 @@
this.Q = flag1;
this.server = minecraftserver;
this.mobSpawners = list;
@ -71,9 +71,9 @@
});
+ // CraftBukkit end
this.portalTravelAgent = new PortalTravelAgent(this);
this.P();
this.Q();
@@ -91,14 +125,48 @@
this.R();
@@ -95,14 +129,48 @@
iworlddataserver.setGameType(minecraftserver.getGamemode());
}
@ -124,7 +124,7 @@
public void a(int i, int j, boolean flag, boolean flag1) {
this.worldDataServer.a(i);
@@ -189,6 +257,7 @@
@@ -193,6 +261,7 @@
this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F);
}
@ -132,7 +132,7 @@
if (this.lastRainLevel != this.rainLevel) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel)), this.getDimensionKey());
}
@@ -207,18 +276,47 @@
@@ -211,18 +280,47 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
}
@ -185,8 +185,8 @@
if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) {
this.clearWeather();
}
@@ -240,7 +338,7 @@
this.aj();
@@ -244,7 +342,7 @@
this.ak();
this.ticking = false;
gameprofilerfiller.exitEnter("entities");
- boolean flag3 = !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty();
@ -194,7 +194,7 @@
if (flag3) {
this.resetEmptyTime();
@@ -259,6 +357,7 @@
@@ -263,6 +361,7 @@
Entity entity = (Entity) entry.getValue();
Entity entity1 = entity.getVehicle();
@ -202,7 +202,7 @@
if (!this.server.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die();
}
@@ -266,6 +365,7 @@
@@ -270,6 +369,7 @@
if (!this.server.getSpawnNPCs() && entity instanceof NPC) {
entity.die();
}
@ -210,7 +210,7 @@
gameprofilerfiller.enter("checkDespawn");
if (!entity.dead) {
@@ -340,7 +440,7 @@
@@ -344,7 +444,7 @@
}
private void wakeupPlayers() {
@ -219,7 +219,7 @@
entityplayer.wakeup(false, false);
});
}
@@ -367,14 +467,14 @@
@@ -371,14 +471,14 @@
entityhorseskeleton.t(true);
entityhorseskeleton.setAgeRaw(0);
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@ -236,7 +236,7 @@
}
}
@@ -385,11 +485,11 @@
@@ -389,11 +489,11 @@
BiomeBase biomebase = this.getBiome(blockposition);
if (biomebase.a(this, blockposition1)) {
@ -250,7 +250,7 @@
}
if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) {
@@ -436,7 +536,7 @@
@@ -440,7 +540,7 @@
protected BlockPosition a(BlockPosition blockposition) {
BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, blockposition);
AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockposition1, new BlockPosition(blockposition1.getX(), this.getBuildHeight(), blockposition1.getZ()))).g(3.0D);
@ -259,7 +259,7 @@
return entityliving != null && entityliving.isAlive() && this.e(entityliving.getChunkCoordinates());
});
@@ -465,7 +565,7 @@
@@ -469,7 +569,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -268,7 +268,7 @@
++i;
} else if (entityplayer.isSleeping()) {
++j;
@@ -483,10 +583,22 @@
@@ -487,10 +587,22 @@
}
private void clearWeather() {
@ -293,7 +293,7 @@
}
public void resetEmptyTime() {
@@ -527,6 +639,7 @@
@@ -531,6 +643,7 @@
});
gameprofilerfiller.c("tickNonPassenger");
entity.tick();
@ -301,7 +301,7 @@
gameprofilerfiller.exit();
}
@@ -615,6 +728,7 @@
@@ -619,6 +732,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProvider();
if (!flag1) {
@ -309,7 +309,7 @@
if (iprogressupdate != null) {
iprogressupdate.a(new ChatMessage("menu.savingLevel"));
}
@@ -626,11 +740,19 @@
@@ -630,11 +744,19 @@
chunkproviderserver.save(flag);
}
@ -323,14 +323,14 @@
+ // CraftBukkit end
}
private void ai() {
private void aj() {
if (this.dragonBattle != null) {
- this.server.getSaveData().a(this.dragonBattle.a());
+ this.worldDataServer.a(this.dragonBattle.a()); // CraftBukkit
}
this.getChunkProvider().getWorldPersistentData().a();
@@ -691,11 +813,24 @@
@@ -695,11 +817,24 @@
@Override
public boolean addEntity(Entity entity) {
@ -357,7 +357,7 @@
}
public void addEntityTeleport(Entity entity) {
@@ -745,13 +880,18 @@
@@ -749,13 +884,18 @@
this.registerEntity(entityplayer);
}
@ -378,7 +378,7 @@
IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
if (!(ichunkaccess instanceof Chunk)) {
@@ -780,7 +920,7 @@
@@ -784,7 +924,7 @@
if (entity1 == null) {
return false;
} else {
@ -387,7 +387,7 @@
return true;
}
}
@@ -809,11 +949,16 @@
@@ -813,11 +953,16 @@
}
public boolean addAllEntitiesSafely(Entity entity) {
@ -397,7 +397,7 @@
+
+ public boolean addAllEntitiesSafely(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
+ // CraftBukkit end
if (entity.co().anyMatch(this::isUUIDTaken)) {
if (entity.cp().anyMatch(this::isUUIDTaken)) {
return false;
} else {
- this.addAllEntities(entity);
@ -406,7 +406,7 @@
}
}
@@ -863,10 +1008,17 @@
@@ -867,10 +1012,17 @@
}
this.getScoreboard().a(entity);
@ -424,7 +424,7 @@
}
private void registerEntity(Entity entity) {
@@ -887,9 +1039,16 @@
@@ -891,9 +1043,16 @@
this.entitiesByUUID.put(entity.getUniqueID(), entity);
this.getChunkProvider().addEntity(entity);
@ -441,7 +441,7 @@
}
}
@@ -919,10 +1078,33 @@
@@ -923,10 +1082,33 @@
this.everyoneSleeping();
}
@ -475,7 +475,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -931,6 +1113,12 @@
@@ -935,6 +1117,12 @@
double d1 = (double) blockposition.getY() - entityplayer.locY();
double d2 = (double) blockposition.getZ() - entityplayer.locZ();
@ -488,7 +488,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -991,10 +1179,20 @@
@@ -995,10 +1183,20 @@
@Override
public Explosion createExplosion(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
@ -509,7 +509,7 @@
if (explosion_effect == Explosion.Effect.NONE) {
explosion.clearBlocks();
}
@@ -1059,13 +1257,20 @@
@@ -1063,13 +1261,20 @@
}
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
@ -532,7 +532,7 @@
++j;
}
}
@@ -1107,7 +1312,7 @@
@@ -1111,7 +1316,7 @@
@Nullable
public BlockPosition a(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
@ -541,7 +541,7 @@
}
@Nullable
@@ -1145,7 +1350,13 @@
@@ -1149,7 +1354,13 @@
@Override
public WorldMap a(String s) {
return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().b(() -> {
@ -556,7 +556,7 @@
}, s);
}
@@ -1456,6 +1667,11 @@
@@ -1460,6 +1671,11 @@
@Override
public void update(BlockPosition blockposition, Block block) {
if (!this.isDebugWorld()) {
@ -568,7 +568,7 @@
this.applyPhysics(blockposition, block);
}
@@ -1470,12 +1686,12 @@
@@ -1474,12 +1690,12 @@
}
public boolean isFlatWorld() {
@ -583,7 +583,38 @@
}
@Nullable
@@ -1494,16 +1710,32 @@
@@ -1499,9 +1715,9 @@
@VisibleForTesting
public String F() {
- return String.format("players: %s, entities: %d [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s", this.players.size(), this.entitiesById.size(), a((Collection) this.entitiesById.values(), (entity) -> {
+ return String.format("players: %s, entities: %d [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s", this.players.size(), this.entitiesById.size(), a(this.entitiesById.values(), (entity) -> { // CraftBukkit - decompile error
return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType());
- }), this.tileEntityListTick.size(), a((Collection) this.tileEntityListTick, (tileentity) -> {
+ }), this.tileEntityListTick.size(), a(this.tileEntityListTick, (tileentity) -> { // CraftBukkit - decompile error
return IRegistry.BLOCK_ENTITY_TYPE.getKey(tileentity.getTileType());
}), this.getBlockTickList().a(), this.getFluidTickList().a(), this.P());
}
@@ -1509,7 +1725,7 @@
private static <T> String a(Collection<T> collection, Function<T, MinecraftKey> function) {
try {
Object2IntOpenHashMap<MinecraftKey> object2intopenhashmap = new Object2IntOpenHashMap();
- Iterator iterator = collection.iterator();
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1518,7 +1734,8 @@
object2intopenhashmap.addTo(minecraftkey, 1);
}
- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
+ // CraftBukkit - decompile error
+ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<MinecraftKey>::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue();
}).collect(Collectors.joining(","));
} catch (Exception exception) {
@@ -1527,16 +1744,32 @@
}
public static void a(WorldServer worldserver) {

Datei anzeigen

@ -4,7 +4,7 @@
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.16.3-R0.1-SNAPSHOT</version>
<version>1.16.4-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>https://www.spigotmc.org/</url>
@ -12,8 +12,8 @@
<skipTests>true</skipTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<api.version>unknown</api.version>
<minecraft.version>1.16.3</minecraft.version>
<minecraft_version>1_16_R2</minecraft_version>
<minecraft.version>1.16.4</minecraft.version>
<minecraft_version>1_16_R3</minecraft_version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

Datei anzeigen

@ -177,11 +177,11 @@ public class Main {
useConsole = false;
}
if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
Date buildDate = new Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L);
Calendar deadline = Calendar.getInstance();
deadline.add(Calendar.DAY_OF_YEAR, -21);
deadline.add(Calendar.DAY_OF_YEAR, -7);
if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***");
System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");

Datei anzeigen

@ -19,13 +19,13 @@ public class CraftMinecartFurnace extends CraftMinecart implements PoweredMineca
@Override
public int getFuel() {
return getHandle().e;
return getHandle().fuel;
}
@Override
public void setFuel(int fuel) {
Preconditions.checkArgument(fuel >= 0, "ticks cannot be negative");
getHandle().e = fuel;
getHandle().fuel = fuel;
}
@Override

Datei anzeigen

@ -1279,9 +1279,7 @@ public class CraftEventFactory {
human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity());
}
public static ItemStack handleEditBookEvent(EntityPlayer player, EnumItemSlot slot, ItemStack itemInHand, ItemStack newBookItem) {
int itemInHandIndex = (slot == EnumItemSlot.MAINHAND) ? player.inventory.itemInHandIndex : -1;
public static ItemStack handleEditBookEvent(EntityPlayer player, int itemInHandIndex, ItemStack itemInHand, ItemStack newBookItem) {
PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), itemInHandIndex, (BookMeta) CraftItemStack.getItemMeta(itemInHand), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK);
player.world.getServer().getPluginManager().callEvent(editBookEvent);

Datei anzeigen

@ -224,7 +224,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
* @return string
*/
public String getMappingsVersion() {
return "09f04031f41cb54f1077c6ac348cc220";
return "da85101b34b252659e3ddf10c0c57cc9";
}
@Override