Repackage NMS

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-03-16 09:00:00 +11:00
parent 18496e998f
commit 9da047989c
968 changed files with 5448 additions and 5050 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/AdvancementDataPlayer.java
+++ b/net/minecraft/server/AdvancementDataPlayer.java
@@ -163,7 +163,11 @@
@@ -181,7 +181,11 @@
Advancement advancement = advancementdataworld.a((MinecraftKey) entry.getKey());
if (advancement == null) {
@@ -13,7 +13,7 @@
} else {
this.a(advancement, (AdvancementProgress) entry.getValue());
}
@@ -278,6 +282,7 @@
@@ -296,6 +300,7 @@
this.j.add(advancement);
flag = true;
if (!flag1 && advancementprogress.isDone()) {

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/server/CustomFunctionData.java
+++ b/net/minecraft/server/CustomFunctionData.java
@@ -30,7 +30,7 @@
@@ -36,7 +36,7 @@
}
public com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> getCommandDispatcher() {
public CommandDispatcher<CommandListenerWrapper> getCommandDispatcher() {
- return this.server.getCommandDispatcher().a();
+ return this.server.vanillaCommandDispatcher.a(); // CraftBukkit
}

View File

@@ -1,6 +1,19 @@
--- a/net/minecraft/server/DispenserRegistry.java
+++ b/net/minecraft/server/DispenserRegistry.java
@@ -31,6 +31,69 @@
@@ -26,6 +26,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.util.datafix.fixes.DataConverterFlattenData;
+import net.minecraft.util.datafix.fixes.DataConverterMaterialId;
+import net.minecraft.util.datafix.fixes.DataConverterSpawnEgg;
+// CraftBukkit end
+
public class DispenserRegistry {
public static final PrintStream a = System.out;
@@ -50,6 +56,69 @@
TagStatic.b();
d();
}

View File

@@ -1,6 +1,18 @@
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -27,7 +27,8 @@
@@ -54,13 +54,20 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.SharedConstants;
+import net.minecraft.world.level.dimension.DimensionManager;
+import net.minecraft.world.level.dimension.WorldDimension;
+// CraftBukkit end
+
public class Main {
private static final Logger LOGGER = LogManager.getLogger();
public Main() {}
@@ -10,7 +22,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");
@@ -51,20 +52,22 @@
@@ -84,21 +91,23 @@
optionparser.printHelpOn(System.err);
return;
}
@@ -22,20 +34,25 @@
DispenserRegistry.c();
SystemUtils.l();
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.b();
java.nio.file.Path java_nio_file_path = Paths.get("server.properties");
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, java_nio_file_path);
- Path path = Paths.get("server.properties");
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, path);
+ java.nio.file.Path java_nio_file_path = Paths.get("server.properties");
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, optionset); // CraftBukkit - CLI argument support
dedicatedserversettings.save();
java.nio.file.Path java_nio_file_path1 = Paths.get("eula.txt");
EULA eula = new EULA(java_nio_file_path1);
- Path path1 = Paths.get("eula.txt");
- EULA eula = new EULA(path1);
+ java.nio.file.Path java_nio_file_path1 = Paths.get("eula.txt");
+ EULA eula = new EULA(java_nio_file_path1);
- if (optionset.has(optionspec1)) {
- Main.LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath());
+ if (optionset.has("initSettings")) { // CraftBukkit
Main.LOGGER.info("Initialized '{}' and '{}'", java_nio_file_path.toAbsolutePath(), java_nio_file_path1.toAbsolutePath());
+ Main.LOGGER.info("Initialized '{}' and '{}'", java_nio_file_path.toAbsolutePath(), java_nio_file_path1.toAbsolutePath());
return;
}
@@ -74,24 +77,42 @@
@@ -107,24 +116,42 @@
return;
}
@@ -82,7 +99,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);
@@ -106,6 +127,7 @@
@@ -139,6 +166,7 @@
}
datapackresources.i();
@@ -90,7 +107,7 @@
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, datapackresources.h(), iregistrycustom_dimension);
Object object = convertable_conversionsession.a((DynamicOps) registryreadops, datapackconfiguration1);
@@ -133,21 +155,32 @@
@@ -166,21 +194,32 @@
}
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
@@ -125,7 +142,7 @@
Thread thread = new Thread("Server Shutdown Thread") {
public void run() {
dedicatedserver.safeShutdown(true);
@@ -156,14 +189,15 @@
@@ -189,14 +228,15 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
Runtime.getRuntime().addShutdownHook(thread);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -55,6 +55,18 @@
@@ -155,6 +155,25 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -10,6 +10,13 @@
+import com.google.common.collect.ImmutableSet;
+import jline.console.ConsoleReader;
+import joptsimple.OptionSet;
+import net.minecraft.nbt.DynamicOpsNBT;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.resources.RegistryReadOps;
+import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.server.dedicated.DedicatedServerProperties;
+import net.minecraft.util.datafix.DataConverterRegistry;
+import net.minecraft.world.level.storage.WorldDataServer;
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.Main;
@@ -19,7 +26,7 @@
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
public static final Logger LOGGER = LogManager.getLogger();
@@ -124,6 +136,20 @@
@@ -224,6 +243,20 @@
private final DefinedStructureManager ak;
protected SaveData saveData;
@@ -40,7 +47,7 @@
public static <S extends MinecraftServer> S a(Function<Thread, S> function) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new Thread(() -> {
@@ -133,21 +159,21 @@
@@ -233,21 +266,21 @@
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
MinecraftServer.LOGGER.error(throwable);
});
@@ -65,7 +72,7 @@
this.isRunning = true;
this.h = new long[100];
this.K = "";
@@ -173,7 +199,34 @@
@@ -273,7 +306,34 @@
this.ak = new DefinedStructureManager(datapackresources.h(), convertable_conversionsession, datafixer);
this.serverThread = thread;
this.executorService = SystemUtils.f();
@@ -100,7 +107,7 @@
private void initializeScoreboards(WorldPersistentData worldpersistentdata) {
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) worldpersistentdata.a(PersistentScoreboard::new, "scoreboard");
@@ -186,7 +239,7 @@
@@ -286,7 +346,7 @@
public static void convertWorld(Convertable.ConversionSession convertable_conversionsession) {
if (convertable_conversionsession.isConvertable()) {
@@ -109,7 +116,7 @@
convertable_conversionsession.convert(new IProgressUpdate() {
private long a = SystemUtils.getMonotonicMillis();
@@ -209,45 +262,184 @@
@@ -309,45 +369,184 @@
}
@@ -325,7 +332,7 @@
WorldBorder worldborder = worldserver.getWorldBorder();
worldborder.a(iworlddataserver.r());
@@ -272,31 +464,8 @@
@@ -372,31 +571,8 @@
iworlddataserver.c(true);
}
@@ -358,7 +365,7 @@
private static void a(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1, boolean flag2) {
ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator();
@@ -312,6 +481,21 @@
@@ -412,6 +588,21 @@
return biomebase.b().b();
}, random);
ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
@@ -380,7 +387,7 @@
if (blockposition == null) {
MinecraftServer.LOGGER.warn("Unable to find spawn biome");
@@ -378,8 +562,15 @@
@@ -478,8 +669,15 @@
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
}
@@ -398,7 +405,7 @@
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a());
BlockPosition blockposition = worldserver.getSpawn();
@@ -392,17 +583,21 @@
@@ -492,17 +690,21 @@
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
while (chunkproviderserver.b() != 441) {
@@ -429,7 +436,7 @@
if (forcedchunk != null) {
LongIterator longiterator = forcedchunk.a().iterator();
@@ -416,11 +611,18 @@
@@ -516,11 +718,18 @@
}
}
@@ -451,7 +458,7 @@
}
protected void loadResourcesZip() {
@@ -465,12 +667,16 @@
@@ -565,12 +774,16 @@
worldserver.save((IProgressUpdate) null, flag1, worldserver.savingDisabled && !flag2);
}
@@ -468,7 +475,7 @@
return flag3;
}
@@ -479,8 +685,29 @@
@@ -579,8 +792,29 @@
this.stop();
}
@@ -498,7 +505,7 @@
if (this.getServerConnection() != null) {
this.getServerConnection().b();
}
@@ -489,6 +716,7 @@
@@ -589,6 +823,7 @@
MinecraftServer.LOGGER.info("Saving players");
this.playerList.savePlayers();
this.playerList.shutdown();
@@ -506,7 +513,7 @@
}
MinecraftServer.LOGGER.info("Saving worlds");
@@ -566,14 +794,16 @@
@@ -666,14 +901,16 @@
while (this.isRunning) {
long i = SystemUtils.getMonotonicMillis() - this.nextTick;
@@ -524,7 +531,7 @@
this.nextTick += 50L;
GameProfilerTick gameprofilertick = GameProfilerTick.a("Server");
@@ -619,6 +849,12 @@
@@ -719,6 +956,12 @@
} catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally {
@@ -537,7 +544,7 @@
this.exit();
}
@@ -627,8 +863,15 @@
@@ -727,8 +970,15 @@
}
private boolean canSleepForTick() {
@@ -554,7 +561,7 @@
protected void sleepForTick() {
this.executeAll();
@@ -734,7 +977,7 @@
@@ -834,7 +1084,7 @@
this.serverPing.b().a(agameprofile);
}
@@ -563,7 +570,7 @@
MinecraftServer.LOGGER.debug("Autosave started");
this.methodProfiler.enter("save");
this.playerList.savePlayers();
@@ -764,22 +1007,39 @@
@@ -864,22 +1114,39 @@
}
protected void b(BooleanSupplier booleansupplier) {
@@ -603,7 +610,7 @@
this.methodProfiler.enter("tick");
@@ -863,7 +1123,7 @@
@@ -963,7 +1230,7 @@
}
public String getServerModName() {
@@ -612,7 +619,7 @@
}
public CrashReport b(CrashReport crashreport) {
@@ -1220,16 +1480,17 @@
@@ -1320,16 +1587,17 @@
public CompletableFuture<Void> a(Collection<String> collection) {
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
@@ -632,7 +639,7 @@
this.resourcePackRepository.a(collection);
this.saveData.a(a(this.resourcePackRepository));
datapackresources.i();
@@ -1595,6 +1856,22 @@
@@ -1695,6 +1963,22 @@
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ScoreboardServer.java
+++ b/net/minecraft/server/ScoreboardServer.java
@@ -22,7 +22,7 @@
@@ -32,7 +32,7 @@
public void handleScoreChanged(ScoreboardScore scoreboardscore) {
super.handleScoreChanged(scoreboardscore);
if (this.b.contains(scoreboardscore.getObjective())) {
@@ -9,7 +9,7 @@
}
this.b();
@@ -31,7 +31,7 @@
@@ -41,7 +41,7 @@
@Override
public void handlePlayerRemoved(String s) {
super.handlePlayerRemoved(s);
@@ -18,7 +18,7 @@
this.b();
}
@@ -39,7 +39,7 @@
@@ -49,7 +49,7 @@
public void a(String s, ScoreboardObjective scoreboardobjective) {
super.a(s, scoreboardobjective);
if (this.b.contains(scoreboardobjective)) {
@@ -27,7 +27,7 @@
}
this.b();
@@ -52,7 +52,7 @@
@@ -62,7 +62,7 @@
super.setDisplaySlot(i, scoreboardobjective);
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
if (this.h(scoreboardobjective1) > 0) {
@@ -36,7 +36,7 @@
} else {
this.g(scoreboardobjective1);
}
@@ -60,7 +60,7 @@
@@ -70,7 +70,7 @@
if (scoreboardobjective != null) {
if (this.b.contains(scoreboardobjective)) {
@@ -45,7 +45,7 @@
} else {
this.e(scoreboardobjective);
}
@@ -72,7 +72,7 @@
@@ -82,7 +82,7 @@
@Override
public boolean addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) {
if (super.addPlayerToTeam(s, scoreboardteam)) {
@@ -54,7 +54,7 @@
this.b();
return true;
} else {
@@ -83,7 +83,7 @@
@@ -93,7 +93,7 @@
@Override
public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) {
super.removePlayerFromTeam(s, scoreboardteam);
@@ -63,7 +63,7 @@
this.b();
}
@@ -97,7 +97,7 @@
@@ -107,7 +107,7 @@
public void handleObjectiveChanged(ScoreboardObjective scoreboardobjective) {
super.handleObjectiveChanged(scoreboardobjective);
if (this.b.contains(scoreboardobjective)) {
@@ -72,7 +72,7 @@
}
this.b();
@@ -116,21 +116,21 @@
@@ -126,21 +126,21 @@
@Override
public void handleTeamAdded(ScoreboardTeam scoreboardteam) {
super.handleTeamAdded(scoreboardteam);
@@ -97,7 +97,7 @@
this.b();
}
@@ -179,6 +179,7 @@
@@ -189,6 +189,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -105,7 +105,7 @@
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
@@ -211,6 +212,7 @@
@@ -221,6 +222,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -113,7 +113,7 @@
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
@@ -235,6 +237,16 @@
@@ -245,6 +247,16 @@
return i;
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/BossBattleCustom.java
+++ b/net/minecraft/server/BossBattleCustom.java
@@ -6,12 +6,27 @@
import java.util.Set;
import java.util.UUID;
--- a/net/minecraft/server/bossevents/BossBattleCustom.java
+++ b/net/minecraft/server/bossevents/BossBattleCustom.java
@@ -18,12 +18,27 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.BossBattle;
+// CraftBukkit start
+import org.bukkit.boss.KeyedBossBar;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandEffect.java
+++ b/net/minecraft/server/CommandEffect.java
@@ -62,7 +62,7 @@
--- a/net/minecraft/server/commands/CommandEffect.java
+++ b/net/minecraft/server/commands/CommandEffect.java
@@ -71,7 +71,7 @@
if (entity instanceof EntityLiving) {
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
@@ -9,7 +9,7 @@
++j;
}
}
@@ -88,7 +88,7 @@
@@ -97,7 +97,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -18,7 +18,7 @@
++i;
}
}
@@ -113,7 +113,7 @@
@@ -122,7 +122,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();

View File

@@ -1,12 +1,12 @@
--- a/net/minecraft/server/CommandGamemode.java
+++ b/net/minecraft/server/CommandGamemode.java
@@ -55,6 +55,12 @@
--- a/net/minecraft/server/commands/CommandGamemode.java
+++ b/net/minecraft/server/commands/CommandGamemode.java
@@ -63,6 +63,12 @@
if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
entityplayer.a(enumgamemode);
+ // CraftBukkit start - handle event cancelling the change
+ if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
+ commandcontext.getSource().sendFailureMessage(new ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
+ commandcontext.getSource().sendFailureMessage(new net.minecraft.network.chat.ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
+ continue;
+ }
+ // CraftBukkit end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandGamerule.java
+++ b/net/minecraft/server/CommandGamerule.java
@@ -25,7 +25,7 @@
--- a/net/minecraft/server/commands/CommandGamerule.java
+++ b/net/minecraft/server/commands/CommandGamerule.java
@@ -29,7 +29,7 @@
private static <T extends GameRules.GameRuleValue<T>> int b(CommandContext<CommandListenerWrapper> commandcontext, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) commandcontext.getSource();
@@ -9,7 +9,7 @@
t0.b(commandcontext, "value");
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), true);
@@ -33,7 +33,7 @@
@@ -37,7 +37,7 @@
}
private static <T extends GameRules.GameRuleValue<T>> int b(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandReload.java
+++ b/net/minecraft/server/CommandReload.java
@@ -36,6 +36,16 @@
--- a/net/minecraft/server/commands/CommandReload.java
+++ b/net/minecraft/server/commands/CommandReload.java
@@ -42,6 +42,16 @@
return collection1;
}
@@ -14,6 +14,6 @@
+ }
+ // CraftBukkit end
+
public static void a(com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> com_mojang_brigadier_commanddispatcher) {
com_mojang_brigadier_commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) CommandDispatcher.a("reload").requires((commandlistenerwrapper) -> {
public static void a(CommandDispatcher<CommandListenerWrapper> commanddispatcher) {
commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.CommandDispatcher.a("reload").requires((commandlistenerwrapper) -> {
return commandlistenerwrapper.hasPermission(2);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandSpreadPlayers.java
+++ b/net/minecraft/server/CommandSpreadPlayers.java
@@ -61,7 +61,7 @@
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
@@ -77,7 +77,7 @@
if (entity instanceof EntityHuman) {
set.add(entity.getScoreboardTeam());
} else {
@@ -9,7 +9,7 @@
}
}
@@ -270,7 +270,7 @@
@@ -286,7 +286,7 @@
for (boolean flag2 = iblockaccess.getType(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > 0; flag2 = flag1) {
blockposition_mutableblockposition.c(EnumDirection.DOWN);
@@ -18,7 +18,7 @@
if (!flag1 && flag2 && flag) {
return blockposition_mutableblockposition.getY() + 1;
}
@@ -283,7 +283,7 @@
@@ -299,7 +299,7 @@
public boolean b(IBlockAccess iblockaccess, int i) {
BlockPosition blockposition = new BlockPosition(this.a, (double) (this.a(iblockaccess, i) - 1), this.b);
@@ -27,7 +27,7 @@
Material material = iblockdata.getMaterial();
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
@@ -293,5 +293,12 @@
@@ -309,5 +309,12 @@
this.a = MathHelper.a(random, d0, d2);
this.b = MathHelper.a(random, d1, d3);
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/CommandTeleport.java
+++ b/net/minecraft/server/CommandTeleport.java
@@ -13,6 +13,12 @@
import java.util.Set;
import javax.annotation.Nullable;
--- a/net/minecraft/server/commands/CommandTeleport.java
+++ b/net/minecraft/server/commands/CommandTeleport.java
@@ -35,6 +35,12 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.Location;
@@ -13,7 +13,7 @@
public class CommandTeleport {
private static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("commands.teleport.invalidPosition"));
@@ -128,9 +134,9 @@
@@ -150,9 +156,9 @@
}
if (worldserver == entity.world) {
@@ -25,7 +25,7 @@
}
entity.setHeadRotation(f);
@@ -139,6 +145,21 @@
@@ -161,6 +167,21 @@
float f3 = MathHelper.g(f1);
f3 = MathHelper.a(f3, -90.0F, 90.0F);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/CommandTime.java
+++ b/net/minecraft/server/CommandTime.java
@@ -5,6 +5,11 @@
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import java.util.Iterator;
--- a/net/minecraft/server/commands/CommandTime.java
+++ b/net/minecraft/server/commands/CommandTime.java
@@ -10,6 +10,11 @@
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.server.level.WorldServer;
+// CraftBukkit start
+import org.bukkit.Bukkit;
@@ -11,8 +11,8 @@
+
public class CommandTime {
public static void a(com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> com_mojang_brigadier_commanddispatcher) {
@@ -46,7 +51,13 @@
public static void a(CommandDispatcher<CommandListenerWrapper> commanddispatcher) {
@@ -51,7 +56,13 @@
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
@@ -27,7 +27,7 @@
}
commandlistenerwrapper.sendMessage(new ChatMessage("commands.time.set", new Object[]{i}), true);
@@ -59,7 +70,13 @@
@@ -64,7 +75,13 @@
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();

View File

@@ -1,10 +1,11 @@
--- a/net/minecraft/server/DedicatedServer.java
+++ b/net/minecraft/server/DedicatedServer.java
@@ -22,6 +22,14 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -60,6 +60,15 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.DataPackConfiguration;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.io.IoBuilder;
+import org.bukkit.command.CommandSender;
@@ -15,7 +16,7 @@
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
private static final Logger LOGGER = LogManager.getLogger();
@@ -36,8 +44,10 @@
@@ -74,8 +83,10 @@
@Nullable
private final TextFilter r;
@@ -28,7 +29,7 @@
this.propertyManager = dedicatedserversettings;
this.remoteControlCommandListener = new RemoteControlCommandListener(this);
this.r = null;
@@ -47,13 +57,44 @@
@@ -85,13 +96,44 @@
public boolean init() throws IOException {
Thread thread = new Thread("Server console handler") {
public void run() {
@@ -76,7 +77,7 @@
}
} catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
@@ -62,6 +103,27 @@
@@ -100,6 +142,27 @@
}
};
@@ -104,7 +105,7 @@
thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
thread.start();
@@ -88,7 +150,7 @@
@@ -126,7 +189,7 @@
this.setForceGamemode(dedicatedserverproperties.forceGamemode);
super.setIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
this.i(dedicatedserverproperties.enforceWhitelist);
@@ -113,7 +114,7 @@
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
InetAddress inetaddress = null;
@@ -112,6 +174,12 @@
@@ -150,6 +213,12 @@
return false;
}
@@ -126,7 +127,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.");
@@ -126,7 +194,7 @@
@@ -164,7 +233,7 @@
if (!NameReferencingFileConverter.e(this)) {
return false;
} else {
@@ -135,7 +136,7 @@
long i = SystemUtils.getMonotonicNanos();
this.c(dedicatedserverproperties.maxBuildHeight);
@@ -134,7 +202,7 @@
@@ -172,7 +241,7 @@
TileEntitySkull.a(this.getMinecraftSessionService());
UserCache.a(this.getOnlineMode());
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getWorld());
@@ -144,7 +145,7 @@
long j = SystemUtils.getMonotonicNanos() - i;
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
@@ -151,6 +219,7 @@
@@ -189,6 +258,7 @@
if (dedicatedserverproperties.enableRcon) {
DedicatedServer.LOGGER.info("Starting remote control listener");
this.remoteControlListener = RemoteControlListener.a((IMinecraftServer) this);
@@ -152,7 +153,7 @@
}
if (this.getMaxTickTime() > 0L) {
@@ -265,6 +334,7 @@
@@ -303,6 +373,7 @@
this.remoteStatusListener.b();
}
@@ -160,7 +161,7 @@
}
@Override
@@ -293,7 +363,15 @@
@@ -331,7 +402,15 @@
while (!this.serverCommandQueue.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
@@ -177,7 +178,7 @@
}
}
@@ -503,14 +581,45 @@
@@ -541,14 +620,45 @@
@Override
public String getPlugins() {
@@ -225,7 +226,7 @@
});
return this.remoteControlCommandListener.getMessages();
}
@@ -552,4 +661,15 @@
@@ -590,4 +700,15 @@
public ITextFilter a(EntityPlayer entityplayer) {
return this.r != null ? this.r.a(entityplayer.getProfile()) : null;
}

View File

@@ -1,12 +1,12 @@
--- a/net/minecraft/server/DedicatedServerProperties.java
+++ b/net/minecraft/server/DedicatedServerProperties.java
@@ -3,8 +3,14 @@
import java.util.Properties;
import java.util.concurrent.TimeUnit;
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -9,8 +9,14 @@
import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.level.levelgen.GeneratorSettings;
+// CraftBukkit start
+import joptsimple.OptionSet;
+import net.minecraft.server.PropertyManager.EditableProperty;
+import net.minecraft.server.dedicated.PropertyManager.EditableProperty;
+// CraftBukkit end
+
public class DedicatedServerProperties extends PropertyManager<DedicatedServerProperties> {
@@ -15,7 +15,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", "");
@@ -55,8 +61,10 @@
@@ -61,8 +67,10 @@
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
public final GeneratorSettings generatorSettings;
@@ -28,15 +28,15 @@
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");
@@ -107,12 +115,14 @@
@@ -113,12 +121,14 @@
this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties);
}
- public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, java.nio.file.Path java_nio_file_path) {
- return new DedicatedServerProperties(loadPropertiesFile(java_nio_file_path), iregistrycustom);
- public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, Path path) {
- return new DedicatedServerProperties(loadPropertiesFile(path), iregistrycustom);
+ // CraftBukkit start
+ public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, java.nio.file.Path java_nio_file_path, OptionSet optionset) {
+ return new DedicatedServerProperties(loadPropertiesFile(java_nio_file_path), iregistrycustom, optionset);
+ public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, Path path, OptionSet optionset) {
+ return new DedicatedServerProperties(loadPropertiesFile(path), iregistrycustom, optionset);
}
@Override

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/DedicatedServerSettings.java
+++ b/net/minecraft/server/DedicatedServerSettings.java
@@ -2,14 +2,21 @@
--- a/net/minecraft/server/dedicated/DedicatedServerSettings.java
+++ b/net/minecraft/server/dedicated/DedicatedServerSettings.java
@@ -4,14 +4,21 @@
import java.util.function.UnaryOperator;
import net.minecraft.core.IRegistryCustom;
+// CraftBukkit start
+import java.io.File;
@@ -11,12 +11,12 @@
+
public class DedicatedServerSettings {
private final java.nio.file.Path path;
private final Path path;
private DedicatedServerProperties properties;
- public DedicatedServerSettings(IRegistryCustom iregistrycustom, java.nio.file.Path java_nio_file_path) {
- this.path = java_nio_file_path;
- this.properties = DedicatedServerProperties.load(iregistrycustom, java_nio_file_path);
- public DedicatedServerSettings(IRegistryCustom iregistrycustom, Path path) {
- this.path = path;
- this.properties = DedicatedServerProperties.load(iregistrycustom, path);
+ // CraftBukkit start
+ public DedicatedServerSettings(IRegistryCustom iregistrycustom, OptionSet optionset) {
+ this.path = ((File) optionset.valueOf("config")).toPath();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PropertyManager.java
+++ b/net/minecraft/server/PropertyManager.java
@@ -15,15 +15,30 @@
--- a/net/minecraft/server/dedicated/PropertyManager.java
+++ b/net/minecraft/server/dedicated/PropertyManager.java
@@ -17,15 +17,30 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -29,22 +29,22 @@
+ }
+ // CraftBukkit end
+
public static Properties loadPropertiesFile(java.nio.file.Path java_nio_file_path) {
public static Properties loadPropertiesFile(Path path) {
Properties properties = new Properties();
@@ -59,6 +74,11 @@
@@ -61,6 +76,11 @@
public void savePropertiesFile(java.nio.file.Path java_nio_file_path) {
public void savePropertiesFile(Path path) {
try {
+ // CraftBukkit start - Don't attempt writing to file if it's read only
+ if (java_nio_file_path.toFile().exists() && !java_nio_file_path.toFile().canWrite()) {
+ if (path.toFile().exists() && !path.toFile().canWrite()) {
+ return;
+ }
+ // CraftBukkit end
OutputStream outputstream = Files.newOutputStream(java_nio_file_path);
OutputStream outputstream = Files.newOutputStream(path);
Throwable throwable = null;
@@ -90,7 +110,7 @@
@@ -92,7 +112,7 @@
private static <V extends Number> Function<String, V> a(Function<String, V> function) {
return (s) -> {
try {
@@ -53,7 +53,7 @@
} catch (NumberFormatException numberformatexception) {
return null;
}
@@ -109,7 +129,7 @@
@@ -111,7 +131,7 @@
@Nullable
private String c(String s) {
@@ -62,7 +62,7 @@
}
@Nullable
@@ -137,7 +157,7 @@
@@ -139,7 +159,7 @@
V v1 = MoreObjects.firstNonNull(s1 != null ? function.apply(s1) : null, v0);
this.properties.put(s, function1.apply(v1));
@@ -71,7 +71,7 @@
}
protected <V> V a(String s, Function<String, V> function, UnaryOperator<V> unaryoperator, Function<V, String> function1, V v0) {
@@ -166,7 +186,7 @@
@@ -168,7 +188,7 @@
}
protected int getInt(String s, int i) {
@@ -80,7 +80,7 @@
}
protected PropertyManager<T>.EditableProperty<Integer> b(String s, int i) {
@@ -178,7 +198,7 @@
@@ -180,7 +200,7 @@
}
protected long getLong(String s, long i) {
@@ -89,7 +89,7 @@
}
protected boolean getBoolean(String s, boolean flag) {
@@ -201,7 +221,7 @@
@@ -203,7 +223,7 @@
return properties;
}
@@ -98,7 +98,7 @@
public class EditableProperty<V> implements Supplier<V> {
@@ -209,7 +229,7 @@
@@ -211,7 +231,7 @@
private final V c;
private final Function<V, String> d;
@@ -107,7 +107,7 @@
this.b = s;
this.c = object;
this.d = function;
@@ -223,7 +243,7 @@
@@ -225,7 +245,7 @@
Properties properties = PropertyManager.this.a();
properties.put(this.b, this.d.apply(v0));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ServerGUI.java
+++ b/net/minecraft/server/ServerGUI.java
@@ -158,6 +158,7 @@
--- a/net/minecraft/server/gui/ServerGUI.java
+++ b/net/minecraft/server/gui/ServerGUI.java
@@ -160,6 +160,7 @@
this.e.forEach(Runnable::run);
}
@@ -8,7 +8,7 @@
public void a(JTextArea jtextarea, JScrollPane jscrollpane, String s) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(() -> {
@@ -173,7 +174,7 @@
@@ -175,7 +176,7 @@
}
try {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkMapDistance.java
+++ b/net/minecraft/server/ChunkMapDistance.java
@@ -59,7 +59,7 @@
--- a/net/minecraft/server/level/ChunkMapDistance.java
+++ b/net/minecraft/server/level/ChunkMapDistance.java
@@ -65,7 +65,7 @@
while (objectiterator.hasNext()) {
Entry<ArraySetSorted<Ticket<?>>> entry = (Entry) objectiterator.next();
@@ -9,7 +9,7 @@
return ticket.b(this.currentTick);
})) {
this.ticketLevelTracker.update(entry.getLongKey(), getLowestTicketLevel((ArraySetSorted) entry.getValue()), false);
@@ -95,10 +95,25 @@
@@ -101,10 +101,25 @@
}
if (!this.pendingChunkUpdates.isEmpty()) {
@@ -38,7 +38,7 @@
return true;
} else {
if (!this.l.isEmpty()) {
@@ -134,23 +149,25 @@
@@ -140,23 +155,25 @@
}
}
@@ -68,7 +68,7 @@
}
if (arraysetsorted.isEmpty()) {
@@ -158,16 +175,29 @@
@@ -164,16 +181,29 @@
}
this.ticketLevelTracker.update(i, getLowestTicketLevel(arraysetsorted), false);
@@ -101,7 +101,7 @@
}
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
@@ -210,6 +240,7 @@
@@ -216,6 +246,7 @@
public void b(SectionPosition sectionposition, EntityPlayer entityplayer) {
long i = sectionposition.r().pair();
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.c.get(i);
@@ -109,7 +109,7 @@
objectset.remove(entityplayer);
if (objectset.isEmpty()) {
@@ -251,6 +282,26 @@
@@ -257,6 +288,26 @@
return this.i.a();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkProviderServer.java
+++ b/net/minecraft/server/ChunkProviderServer.java
@@ -54,6 +54,24 @@
--- a/net/minecraft/server/level/ChunkProviderServer.java
+++ b/net/minecraft/server/level/ChunkProviderServer.java
@@ -79,6 +79,24 @@
this.clearCache();
}
@@ -25,7 +25,7 @@
@Override
public LightEngineThreaded getLightEngine() {
return this.lightEngine;
@@ -98,7 +116,7 @@
@@ -123,7 +141,7 @@
for (int l = 0; l < 4; ++l) {
if (k == this.cachePos[l] && chunkstatus == this.cacheStatus[l]) {
ichunkaccess = this.cacheChunk[l];
@@ -34,7 +34,7 @@
return ichunkaccess;
}
}
@@ -144,12 +162,12 @@
@@ -169,12 +187,12 @@
if (playerchunk == null) {
return null;
} else {
@@ -49,7 +49,7 @@
if (ichunkaccess1 != null) {
this.a(k, ichunkaccess1, ChunkStatus.FULL);
@@ -176,7 +194,15 @@
@@ -201,7 +219,15 @@
int l = 33 + ChunkStatus.a(chunkstatus);
PlayerChunk playerchunk = this.getChunk(k);
@@ -66,7 +66,7 @@
this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
if (this.a(playerchunk, l)) {
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
@@ -195,7 +221,7 @@
@@ -220,7 +246,7 @@
}
private boolean a(@Nullable PlayerChunk playerchunk, int i) {
@@ -75,7 +75,7 @@
}
public boolean isLoaded(int i, int j) {
@@ -257,19 +283,19 @@
@@ -282,19 +308,19 @@
public boolean a(Entity entity) {
long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4);
@@ -98,7 +98,7 @@
}
private boolean a(long i, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> function) {
@@ -291,11 +317,31 @@
@@ -316,11 +342,31 @@
@Override
public void close() throws IOException {
@@ -131,7 +131,7 @@
public void tick(BooleanSupplier booleansupplier) {
this.world.getMethodProfiler().enter("purge");
this.chunkMapDistance.purgeTickets();
@@ -315,12 +361,12 @@
@@ -340,12 +386,12 @@
this.lastTickTime = i;
WorldData worlddata = this.world.getWorldData();
boolean flag = this.world.isDebugWorld();
@@ -146,7 +146,7 @@
this.world.getMethodProfiler().enter("naturalSpawnCount");
int l = this.chunkMapDistance.b();
@@ -507,12 +553,18 @@
@@ -532,12 +578,18 @@
@Override
protected boolean executeNext() {

View File

@@ -1,10 +1,17 @@
--- a/net/minecraft/server/EntityPlayer.java
+++ b/net/minecraft/server/EntityPlayer.java
@@ -15,6 +15,28 @@
--- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java
@@ -135,6 +135,35 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.world.damagesource.CombatTracker;
+import net.minecraft.world.food.FoodMetaData;
+import net.minecraft.world.item.enchantment.EnchantmentManager;
+import net.minecraft.world.level.block.BlockChest;
+import net.minecraft.world.level.dimension.DimensionManager;
+import net.minecraft.world.scores.Scoreboard;
+import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
@@ -29,7 +36,7 @@
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger LOGGER = LogManager.getLogger();
@@ -60,6 +82,20 @@
@@ -180,6 +209,20 @@
public int ping;
public boolean viewingCredits;
@@ -50,7 +57,7 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile);
this.spawnDimension = World.OVERWORLD;
@@ -71,12 +107,56 @@
@@ -191,12 +234,56 @@
this.G = 1.0F;
this.c(worldserver);
this.co = minecraftserver.a(this);
@@ -108,7 +115,7 @@
int i = Math.max(0, this.server.a(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -142,11 +222,20 @@
@@ -262,11 +349,20 @@
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
this.recipeBook.a(nbttagcompound.getCompound("recipeBook"), this.server.getCraftingManager());
}
@@ -129,7 +136,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");
@@ -180,7 +269,20 @@
@@ -300,7 +396,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@@ -151,7 +158,7 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -198,7 +300,7 @@
@@ -318,7 +427,7 @@
nbttagcompound.setInt("SpawnZ", this.spawn.getZ());
nbttagcompound.setBoolean("SpawnForced", this.spawnForced);
nbttagcompound.setFloat("SpawnAngle", this.spawnAngle);
@@ -160,7 +167,7 @@
Logger logger = EntityPlayer.LOGGER;
logger.getClass();
@@ -206,9 +308,33 @@
@@ -326,9 +435,33 @@
nbttagcompound.set("SpawnDimension", nbtbase);
});
}
@@ -194,7 +201,7 @@
public void a(int i) {
float f = (float) this.getExpToLevel();
float f1 = (f - 1.0F) / f;
@@ -262,6 +388,11 @@
@@ -382,6 +515,11 @@
@Override
public void tick() {
@@ -206,7 +213,7 @@
this.playerInteractManager.a();
--this.invulnerableTicks;
if (this.noDamageTicks > 0) {
@@ -329,7 +460,7 @@
@@ -449,7 +587,7 @@
}
if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastSentSaturationZero) {
@@ -215,7 +222,7 @@
this.lastHealthSent = this.getHealth();
this.lastFoodSent = this.foodData.getFoodLevel();
this.lastSentSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -360,6 +491,12 @@
@@ -480,6 +618,12 @@
this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.lastExpTotalScored));
}
@@ -228,7 +235,7 @@
if (this.expLevel != this.lastExpLevelScored) {
this.lastExpLevelScored = this.expLevel;
this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastExpLevelScored));
@@ -374,6 +511,16 @@
@@ -494,6 +638,16 @@
CriterionTriggers.p.a(this);
}
@@ -245,7 +252,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
@@ -384,7 +531,8 @@
@@ -504,7 +658,8 @@
}
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
@@ -255,7 +262,7 @@
scoreboardscore.setScore(i);
});
}
@@ -392,9 +540,46 @@
@@ -512,9 +667,46 @@
@Override
public void die(DamageSource damagesource) {
boolean flag = this.world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES);
@@ -304,7 +311,7 @@
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
if (!future.isSuccess()) {
@@ -428,12 +613,18 @@
@@ -548,12 +740,18 @@
if (this.world.getGameRules().getBoolean(GameRules.FORGIVE_DEAD_PLAYERS)) {
this.eW();
}
@@ -327,7 +334,7 @@
EntityLiving entityliving = this.getKillingEntity();
if (entityliving != null) {
@@ -469,10 +660,12 @@
@@ -589,10 +787,12 @@
String s = this.getName();
String s1 = entity.getName();
@@ -342,7 +349,7 @@
} else {
this.a(StatisticList.MOB_KILLS);
}
@@ -490,7 +683,8 @@
@@ -610,7 +810,8 @@
int i = scoreboardteam.getColor().b();
if (i >= 0 && i < aiscoreboardcriteria.length) {
@@ -352,7 +359,7 @@
}
}
@@ -534,18 +728,20 @@
@@ -654,18 +855,20 @@
}
private boolean canPvP() {
@@ -376,7 +383,7 @@
} else {
return shapedetectorshape;
}
@@ -554,11 +750,20 @@
@@ -674,11 +877,20 @@
@Nullable
@Override
public Entity b(WorldServer worldserver) {
@@ -400,7 +407,7 @@
this.decouple();
this.getWorldServer().removePlayer(this);
if (!this.viewingCredits) {
@@ -569,6 +774,8 @@
@@ -689,6 +901,8 @@
return this;
} else {
@@ -409,7 +416,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));
@@ -578,22 +785,52 @@
@@ -698,22 +912,52 @@
playerlist.d(this);
worldserver1.removePlayer(this);
this.dead = false;
@@ -468,7 +475,7 @@
worldserver1.getMethodProfiler().exit();
this.triggerDimensionAdvancements(worldserver1);
this.playerInteractManager.a(worldserver);
@@ -612,12 +849,31 @@
@@ -732,12 +976,31 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
@@ -500,7 +507,7 @@
private void a(WorldServer worldserver, BlockPosition blockposition) {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
@@ -634,17 +890,17 @@
@@ -754,17 +1017,17 @@
}
@Override
@@ -523,7 +530,7 @@
}
return optional1;
@@ -688,10 +944,8 @@
@@ -808,10 +1071,8 @@
this.activeContainer.c();
}
@@ -536,7 +543,7 @@
if (!this.isSleeping() && this.isAlive()) {
if (!this.world.getDimensionManager().isNatural()) {
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
@@ -717,7 +971,36 @@
@@ -837,7 +1098,36 @@
}
}
@@ -574,7 +581,7 @@
this.a(StatisticList.SLEEP_IN_BED);
CriterionTriggers.q.a(this);
});
@@ -726,9 +1009,8 @@
@@ -846,9 +1136,8 @@
return either;
}
}
@@ -585,7 +592,7 @@
}
@Override
@@ -755,6 +1037,24 @@
@@ -875,6 +1164,24 @@
@Override
public void wakeup(boolean flag, boolean flag1) {
@@ -610,7 +617,7 @@
if (this.isSleeping()) {
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
}
@@ -826,8 +1126,9 @@
@@ -946,8 +1253,9 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@@ -621,7 +628,7 @@
}
@Override
@@ -842,6 +1143,24 @@
@@ -962,6 +1270,24 @@
this.nextContainerCounter();
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
@@ -646,7 +653,7 @@
if (container == null) {
if (this.isSpectator()) {
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
@@ -849,9 +1168,11 @@
@@ -969,9 +1295,11 @@
return OptionalInt.empty();
} else {
@@ -660,7 +667,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -864,13 +1185,24 @@
@@ -984,13 +1312,24 @@
@Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@@ -687,7 +694,7 @@
this.activeContainer.addSlotListener(this);
}
@@ -915,6 +1247,11 @@
@@ -1035,6 +1374,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()));
@@ -699,7 +706,7 @@
}
@Override
@@ -924,6 +1261,7 @@
@@ -1044,6 +1388,7 @@
@Override
public void closeInventory() {
@@ -707,7 +714,7 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.o();
}
@@ -958,7 +1296,7 @@
@@ -1078,7 +1423,7 @@
@Override
public void a(Statistic<?> statistic, int i) {
this.serverStatisticManager.b(this, statistic, i);
@@ -716,7 +723,7 @@
scoreboardscore.addScore(i);
});
}
@@ -966,7 +1304,7 @@
@@ -1086,7 +1431,7 @@
@Override
public void a(Statistic<?> statistic) {
this.serverStatisticManager.setStatistic(this, statistic, 0);
@@ -725,7 +732,7 @@
}
@Override
@@ -1015,7 +1353,16 @@
@@ -1135,7 +1480,16 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@@ -742,7 +749,7 @@
@Override
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
@@ -1068,12 +1415,13 @@
@@ -1188,12 +1542,13 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
@@ -757,7 +764,7 @@
}
@Override
@@ -1141,6 +1489,18 @@
@@ -1261,6 +1616,18 @@
@Override
public void a(EnumGamemode enumgamemode) {
@@ -776,7 +783,7 @@
this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) {
@@ -1190,7 +1550,20 @@
@@ -1310,7 +1677,20 @@
return s;
}
@@ -797,7 +804,7 @@
this.bY = packetplayinsettings.d();
this.bZ = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bi, (byte) packetplayinsettings.f());
@@ -1226,13 +1599,13 @@
@@ -1346,13 +1726,13 @@
if (entity instanceof EntityHuman) {
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
} else {
@@ -813,7 +820,7 @@
}
@Override
@@ -1256,7 +1629,7 @@
@@ -1376,7 +1756,7 @@
this.spectatedEntity = (Entity) (entity == null ? this : entity);
if (entity1 != this.spectatedEntity) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
@@ -822,7 +829,7 @@
}
}
@@ -1285,7 +1658,7 @@
@@ -1405,7 +1785,7 @@
@Nullable
public IChatBaseComponent getPlayerListName() {
@@ -831,7 +838,7 @@
}
@Override
@@ -1306,9 +1679,16 @@
@@ -1426,9 +1806,16 @@
return this.advancementDataPlayer;
}
@@ -848,7 +855,7 @@
if (worldserver == this.world) {
this.playerConnection.a(d0, d1, d2, f, f1);
} else {
@@ -1329,6 +1709,9 @@
@@ -1449,6 +1836,9 @@
this.server.getPlayerList().a(this, worldserver);
this.server.getPlayerList().updateClient(this);
}
@@ -858,7 +865,7 @@
}
@@ -1426,4 +1809,144 @@
@@ -1546,4 +1936,144 @@
public ITextFilter Q() {
return this.co;
}
@@ -954,7 +961,7 @@
+ }
+
+ @Override
+ protected boolean isFrozen() {
+ public boolean isFrozen() {
+ return super.isFrozen() || !getBukkitEntity().isOnline();
+ }
+

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityTrackerEntry.java
+++ b/net/minecraft/server/EntityTrackerEntry.java
@@ -11,6 +11,11 @@
--- a/net/minecraft/server/level/EntityTrackerEntry.java
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
@@ -40,6 +40,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -12,7 +12,7 @@
public class EntityTrackerEntry {
private static final Logger LOGGER = LogManager.getLogger();
@@ -31,8 +36,12 @@
@@ -60,8 +65,12 @@
private List<Entity> p;
private boolean q;
private boolean r;
@@ -26,7 +26,7 @@
this.m = Vec3D.ORIGIN;
this.p = Collections.emptyList();
this.b = worldserver;
@@ -52,16 +61,17 @@
@@ -81,16 +90,17 @@
if (!list.equals(this.p)) {
this.p = list;
@@ -48,7 +48,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -106,6 +116,17 @@
@@ -135,6 +145,17 @@
boolean flag2 = flag1 || this.tickCounter % 60 == 0;
boolean flag3 = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1;
@@ -66,7 +66,7 @@
if (this.tickCounter > 0 || this.tracker instanceof EntityArrow) {
long k = PacketPlayOutEntity.a(vec3d.x);
long l = PacketPlayOutEntity.a(vec3d.y);
@@ -144,6 +165,7 @@
@@ -173,6 +194,7 @@
}
this.c();
@@ -74,7 +74,7 @@
if (flag2) {
this.d();
}
@@ -152,6 +174,7 @@
@@ -181,6 +203,7 @@
this.yRot = i;
this.xRot = j;
}
@@ -82,7 +82,7 @@
this.q = false;
}
@@ -167,7 +190,27 @@
@@ -196,7 +219,27 @@
++this.tickCounter;
if (this.tracker.velocityChanged) {
@@ -111,7 +111,7 @@
this.tracker.velocityChanged = false;
}
@@ -182,14 +225,17 @@
@@ -211,14 +254,17 @@
PlayerConnection playerconnection = entityplayer.playerConnection;
entityplayer.playerConnection.getClass();
@@ -132,7 +132,7 @@
}
Packet<?> packet = this.tracker.P();
@@ -205,6 +251,12 @@
@@ -234,6 +280,12 @@
if (this.tracker instanceof EntityLiving) {
Collection<AttributeModifiable> collection = ((EntityLiving) this.tracker).getAttributeMap().b();
@@ -145,7 +145,7 @@
if (!collection.isEmpty()) {
consumer.accept(new PacketPlayOutUpdateAttributes(this.tracker.getId(), collection));
}
@@ -236,8 +288,14 @@
@@ -265,8 +317,14 @@
if (!list.isEmpty()) {
consumer.accept(new PacketPlayOutEntityEquipment(this.tracker.getId(), list));
}
@@ -160,7 +160,7 @@
if (this.tracker instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) this.tracker;
Iterator iterator = entityliving.getEffects().iterator();
@@ -278,6 +336,11 @@
@@ -307,6 +365,11 @@
Set<AttributeModifiable> set = ((EntityLiving) this.tracker).getAttributeMap().getAttributes();
if (!set.isEmpty()) {

View File

@@ -1,6 +1,17 @@
--- a/net/minecraft/server/PlayerChunk.java
+++ b/net/minecraft/server/PlayerChunk.java
@@ -44,7 +44,7 @@
--- a/net/minecraft/server/level/PlayerChunk.java
+++ b/net/minecraft/server/level/PlayerChunk.java
@@ -33,6 +33,10 @@
import net.minecraft.world.level.chunk.ProtoChunkExtension;
import net.minecraft.world.level.lighting.LightEngine;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
+// CraftBukkit end
+
public class PlayerChunk {
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK_ACCESS = Either.right(PlayerChunk.Failure.b);
@@ -65,7 +69,7 @@
this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
this.tickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
@@ -9,7 +20,7 @@
this.dirtyBlocks = new ShortSet[16];
this.location = chunkcoordintpair;
this.lightEngine = lightengine;
@@ -56,6 +56,19 @@
@@ -77,6 +81,19 @@
this.a(i);
}
@@ -29,7 +40,7 @@
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) {
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(chunkstatus.c());
@@ -81,9 +94,9 @@
@@ -102,9 +119,9 @@
@Nullable
public Chunk getChunk() {
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.a();
@@ -41,7 +52,7 @@
}
@Nullable
@@ -114,6 +127,7 @@
@@ -135,6 +152,7 @@
if (chunk != null) {
byte b0 = (byte) SectionPosition.a(blockposition.getY());
@@ -49,7 +60,7 @@
if (this.dirtyBlocks[b0] == null) {
this.p = true;
this.dirtyBlocks[b0] = new ShortArraySet();
@@ -216,7 +230,7 @@
@@ -237,7 +255,7 @@
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(i);
if (completablefuture != null) {
@@ -58,7 +69,7 @@
if (either == null || either.left().isPresent()) {
return completablefuture;
@@ -271,6 +285,30 @@
@@ -292,6 +310,30 @@
boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET;
PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel);
PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel);
@@ -89,7 +100,7 @@
CompletableFuture completablefuture;
if (flag) {
@@ -302,7 +340,7 @@
@@ -323,7 +365,7 @@
if (flag2 && !flag3) {
completablefuture = this.fullChunkFuture;
this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
@@ -98,7 +109,7 @@
playerchunkmap.getClass();
return either1.ifLeft(playerchunkmap::a);
}));
@@ -340,6 +378,26 @@
@@ -361,6 +403,26 @@
this.u.a(this.location, this::k, this.ticketLevel, this::d);
this.oldTicketLevel = this.ticketLevel;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PlayerChunkMap.java
+++ b/net/minecraft/server/PlayerChunkMap.java
@@ -45,6 +45,8 @@
--- a/net/minecraft/server/level/PlayerChunkMap.java
+++ b/net/minecraft/server/level/PlayerChunkMap.java
@@ -89,6 +89,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -9,7 +9,7 @@
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private static final Logger LOGGER = LogManager.getLogger();
@@ -75,6 +77,31 @@
@@ -119,6 +121,31 @@
private final Queue<Runnable> A;
private int viewDistance;
@@ -41,7 +41,7 @@
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag);
this.visibleChunks = this.updatingChunks.clone();
@@ -195,9 +222,12 @@
@@ -239,9 +266,12 @@
return completablefuture1.thenApply((list1) -> {
List<IChunkAccess> list2 = Lists.newArrayList();
@@ -56,7 +56,7 @@
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
Optional<IChunkAccess> optional = either.left();
@@ -300,7 +330,7 @@
@@ -344,7 +374,7 @@
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName());
} else {
this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
@@ -65,7 +65,7 @@
if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
this.saveChunk(ichunkaccess);
@@ -311,7 +341,6 @@
@@ -355,7 +385,6 @@
}
}
@@ -73,7 +73,7 @@
protected void unloadChunks(BooleanSupplier booleansupplier) {
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
@@ -350,7 +379,7 @@
@@ -394,7 +423,7 @@
private void a(long i, PlayerChunk playerchunk) {
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkSave();
@@ -82,13 +82,13 @@
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkSave();
if (completablefuture1 != completablefuture) {
@@ -572,8 +601,15 @@
@@ -616,8 +645,15 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
+ boolean needsRemoval = false;
+ if (chunk.needsDecoration && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof NPC) {
+ if (chunk.needsDecoration && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof net.minecraft.world.entity.npc.NPC) {
+ entity.die();
+ needsRemoval = true;
+ }
@@ -99,7 +99,7 @@
if (list == null) {
list = Lists.newArrayList(new Entity[]{entity});
} else {
@@ -784,7 +820,8 @@
@@ -828,7 +864,8 @@
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
});
@@ -109,7 +109,7 @@
return Stream.of(chunk.getEntitySlices()).mapToInt(EntitySlice::size).sum();
}).orElse(0), optional1.map((chunk) -> {
return chunk.getTileEntities().size();
@@ -795,7 +832,7 @@
@@ -839,7 +876,7 @@
private static String a(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
try {
@@ -118,7 +118,7 @@
return either != null ? (String) either.map((chunk) -> {
return "done";
@@ -813,7 +850,7 @@
@@ -857,7 +894,7 @@
private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException {
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
@@ -127,7 +127,7 @@
}
boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) {
@@ -1145,7 +1182,7 @@
@@ -1189,7 +1226,7 @@
public final Set<EntityPlayer> trackedPlayers = Sets.newHashSet();
public EntityTracker(Entity entity, int i, int j, boolean flag) {
@@ -136,7 +136,7 @@
this.tracker = entity;
this.trackingDistance = i;
this.e = SectionPosition.a(entity);
@@ -1198,7 +1235,7 @@
@@ -1242,7 +1279,7 @@
public void updatePlayer(EntityPlayer entityplayer) {
if (entityplayer != this.tracker) {
@@ -145,7 +145,7 @@
int i = Math.min(this.b(), (PlayerChunkMap.this.viewDistance - 1) * 16);
boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.tracker.a(entityplayer);
@@ -1214,6 +1251,17 @@
@@ -1258,6 +1295,17 @@
}
}

View File

@@ -1,11 +1,19 @@
--- a/net/minecraft/server/PlayerInteractManager.java
+++ b/net/minecraft/server/PlayerInteractManager.java
@@ -4,6 +4,16 @@
--- a/net/minecraft/server/level/PlayerInteractManager.java
+++ b/net/minecraft/server/level/PlayerInteractManager.java
@@ -26,6 +26,24 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import java.util.ArrayList;
+import net.minecraft.network.protocol.game.PacketPlayOutBlockChange;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.entity.EnumItemSlot;
+import net.minecraft.world.level.block.BlockCake;
+import net.minecraft.world.level.block.BlockDoor;
+import net.minecraft.world.level.block.BlockTrapdoor;
+import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.block.state.properties.BlockPropertyDoubleBlockHalf;
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -17,7 +25,7 @@
public class PlayerInteractManager {
private static final Logger LOGGER = LogManager.getLogger();
@@ -38,7 +48,7 @@
@@ -60,7 +78,7 @@
this.gamemode = enumgamemode;
enumgamemode.a(this.player.abilities);
this.player.updateAbilities();
@@ -26,7 +34,7 @@
this.world.everyoneSleeping();
}
@@ -67,7 +77,7 @@
@@ -89,7 +107,7 @@
}
public void a() {
@@ -35,7 +43,7 @@
IBlockData iblockdata;
if (this.j) {
@@ -123,9 +133,31 @@
@@ -145,9 +163,31 @@
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
if (!this.world.a((EntityHuman) this.player, blockposition)) {
@@ -67,7 +75,7 @@
if (this.isCreative()) {
this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "creative destroy");
@@ -141,11 +173,43 @@
@@ -163,11 +203,43 @@
float f = 1.0F;
iblockdata = this.world.getType(blockposition);
@@ -112,7 +120,7 @@
if (!iblockdata.isAir() && f >= 1.0F) {
this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "insta mine");
} else {
@@ -189,7 +253,7 @@
@@ -211,7 +283,7 @@
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
this.f = false;
if (!Objects.equals(this.h, blockposition)) {
@@ -121,7 +129,7 @@
this.world.a(this.player.getId(), this.h, -1);
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.h, this.world.getType(this.h), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying"));
}
@@ -205,17 +269,73 @@
@@ -227,17 +299,73 @@
if (this.breakBlock(blockposition)) {
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
} else {
@@ -197,7 +205,7 @@
TileEntity tileentity = this.world.getTileEntity(blockposition);
Block block = iblockdata.getBlock();
@@ -225,6 +345,10 @@
@@ -247,6 +375,10 @@
} else if (this.player.a((World) this.world, blockposition, this.gamemode)) {
return false;
} else {
@@ -208,7 +216,7 @@
block.a((World) this.world, blockposition, iblockdata, (EntityHuman) this.player);
boolean flag = this.world.a(blockposition, false);
@@ -233,19 +357,32 @@
@@ -255,19 +387,32 @@
}
if (this.isCreative()) {
@@ -244,7 +252,7 @@
}
}
}
@@ -287,12 +424,46 @@
@@ -309,12 +454,46 @@
}
}
@@ -291,7 +299,7 @@
if (itileinventory != null) {
entityplayer.openContainer(itileinventory);
@@ -306,7 +477,7 @@
@@ -328,7 +507,7 @@
ItemStack itemstack1 = itemstack.cloneItemStack();
if (!flag1) {
@@ -300,7 +308,7 @@
if (enuminteractionresult.a()) {
CriterionTriggers.M.a(entityplayer, blockposition, itemstack1);
@@ -314,17 +485,17 @@
@@ -336,17 +515,17 @@
}
}
@@ -321,7 +329,7 @@
}
if (enuminteractionresult1.a()) {
@@ -332,10 +503,10 @@
@@ -354,10 +533,10 @@
}
return enuminteractionresult1;

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/TicketType.java
+++ b/net/minecraft/server/TicketType.java
@@ -19,6 +19,8 @@
--- a/net/minecraft/server/level/TicketType.java
+++ b/net/minecraft/server/level/TicketType.java
@@ -23,6 +23,8 @@
public static final TicketType<BlockPosition> PORTAL = a("portal", BaseBlockPosition::compareTo, 300);
public static final TicketType<Integer> POST_TELEPORT = a("post_teleport", Integer::compareTo, 5);
public static final TicketType<ChunkCoordIntPair> UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1);

View File

@@ -1,11 +1,14 @@
--- a/net/minecraft/server/WorldServer.java
+++ b/net/minecraft/server/WorldServer.java
@@ -39,6 +39,18 @@
--- a/net/minecraft/server/level/WorldServer.java
+++ b/net/minecraft/server/level/WorldServer.java
@@ -145,6 +145,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import java.util.logging.Level;
+import net.minecraft.world.entity.monster.EntityDrowned;
+import net.minecraft.world.level.block.ITileEntity;
+import net.minecraft.world.level.storage.WorldDataServer;
+import org.bukkit.Bukkit;
+import org.bukkit.WeatherType;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -19,7 +22,7 @@
public class WorldServer extends World implements GeneratorAccessSeed {
public static final BlockPosition a = new BlockPosition(100, 50, 0);
@@ -50,7 +62,7 @@
@@ -156,7 +171,7 @@
private final ChunkProviderServer chunkProvider;
boolean tickingEntities;
private final MinecraftServer server;
@@ -28,7 +31,7 @@
public boolean savingDisabled;
private boolean everyoneSleeping;
private int emptyTime;
@@ -67,8 +79,23 @@
@@ -173,8 +188,23 @@
private final StructureManager structureManager;
private final boolean Q;
@@ -54,7 +57,7 @@
this.nextTickListBlock = new TickListServer<>(this, (block) -> {
return block == null || block.getBlockData().isAir();
}, IRegistry.BLOCK::getKey, this::b);
@@ -80,10 +107,17 @@
@@ -186,10 +216,17 @@
this.Q = flag1;
this.server = minecraftserver;
this.mobSpawners = list;
@@ -73,7 +76,7 @@
this.portalTravelAgent = new PortalTravelAgent(this);
this.Q();
this.R();
@@ -95,14 +129,48 @@
@@ -201,14 +238,48 @@
iworlddataserver.setGameType(minecraftserver.getGamemode());
}
@@ -90,7 +93,7 @@
+
+ // CraftBukkit start
+ @Override
+ protected TileEntity getTileEntity(BlockPosition pos, boolean validate) {
+ public TileEntity getTileEntity(BlockPosition pos, boolean validate) {
+ TileEntity result = super.getTileEntity(pos, validate);
+ if (!validate || Thread.currentThread() != this.serverThread) {
+ // SPIGOT-5378: avoid deadlock, this can be called in loading logic (i.e lighting) but getType() will block on chunk load
@@ -113,7 +116,7 @@
+
+ if (type instanceof ITileEntity) {
+ TileEntity replacement = ((ITileEntity) type).createTile(this);
+ replacement.world = this;
+ replacement.setLocation(this, pos);
+ this.setTileEntity(pos, replacement);
+ return replacement;
+ } else {
@@ -124,7 +127,7 @@
public void a(int i, int j, boolean flag, boolean flag1) {
this.worldDataServer.setClearWeatherTime(i);
@@ -193,6 +261,7 @@
@@ -299,6 +370,7 @@
this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F);
}
@@ -132,7 +135,7 @@
if (this.lastRainLevel != this.rainLevel) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel)), this.getDimensionKey());
}
@@ -211,18 +280,47 @@
@@ -317,18 +389,47 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
}
@@ -185,7 +188,7 @@
if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) {
this.clearWeather();
}
@@ -244,7 +342,7 @@
@@ -350,7 +451,7 @@
this.ak();
this.ticking = false;
gameprofilerfiller.exitEnter("entities");
@@ -194,7 +197,7 @@
if (flag3) {
this.resetEmptyTime();
@@ -263,6 +361,7 @@
@@ -369,6 +470,7 @@
Entity entity = (Entity) entry.getValue();
Entity entity1 = entity.getVehicle();
@@ -202,7 +205,7 @@
if (!this.server.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die();
}
@@ -270,6 +369,7 @@
@@ -376,6 +478,7 @@
if (!this.server.getSpawnNPCs() && entity instanceof NPC) {
entity.die();
}
@@ -210,7 +213,7 @@
gameprofilerfiller.enter("checkDespawn");
if (!entity.dead) {
@@ -344,7 +444,7 @@
@@ -450,7 +553,7 @@
}
private void wakeupPlayers() {
@@ -219,7 +222,7 @@
entityplayer.wakeup(false, false);
});
}
@@ -371,14 +471,14 @@
@@ -477,14 +580,14 @@
entityhorseskeleton.t(true);
entityhorseskeleton.setAgeRaw(0);
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@@ -236,7 +239,7 @@
}
}
@@ -389,11 +489,11 @@
@@ -495,11 +598,11 @@
BiomeBase biomebase = this.getBiome(blockposition);
if (biomebase.a(this, blockposition1)) {
@@ -250,7 +253,7 @@
}
if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) {
@@ -440,7 +540,7 @@
@@ -546,7 +649,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 +262,7 @@
return entityliving != null && entityliving.isAlive() && this.e(entityliving.getChunkCoordinates());
});
@@ -469,7 +569,7 @@
@@ -575,7 +678,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -268,7 +271,7 @@
++i;
} else if (entityplayer.isSleeping()) {
++j;
@@ -487,10 +587,22 @@
@@ -593,10 +696,22 @@
}
private void clearWeather() {
@@ -293,7 +296,7 @@
}
public void resetEmptyTime() {
@@ -531,6 +643,7 @@
@@ -637,6 +752,7 @@
});
gameprofilerfiller.c("tickNonPassenger");
entity.tick();
@@ -301,7 +304,7 @@
gameprofilerfiller.exit();
}
@@ -563,6 +676,7 @@
@@ -669,6 +785,7 @@
});
gameprofilerfiller.c("tickPassenger");
entity1.passengerTick();
@@ -309,7 +312,7 @@
gameprofilerfiller.exit();
}
@@ -619,6 +733,7 @@
@@ -725,6 +842,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProvider();
if (!flag1) {
@@ -317,7 +320,7 @@
if (iprogressupdate != null) {
iprogressupdate.a(new ChatMessage("menu.savingLevel"));
}
@@ -630,11 +745,19 @@
@@ -736,11 +854,19 @@
chunkproviderserver.save(flag);
}
@@ -338,7 +341,7 @@
}
this.getChunkProvider().getWorldPersistentData().a();
@@ -695,11 +818,24 @@
@@ -801,11 +927,24 @@
@Override
public boolean addEntity(Entity entity) {
@@ -365,7 +368,7 @@
}
public void addEntityTeleport(Entity entity) {
@@ -749,13 +885,18 @@
@@ -855,13 +994,18 @@
this.registerEntity(entityplayer);
}
@@ -386,7 +389,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)) {
@@ -784,7 +925,7 @@
@@ -890,7 +1034,7 @@
if (entity1 == null) {
return false;
} else {
@@ -395,7 +398,7 @@
return true;
}
}
@@ -813,10 +954,16 @@
@@ -919,10 +1063,16 @@
}
public boolean addAllEntitiesSafely(Entity entity) {
@@ -413,7 +416,7 @@
return true;
}
}
@@ -867,10 +1014,17 @@
@@ -973,10 +1123,17 @@
}
this.getScoreboard().a(entity);
@@ -431,7 +434,7 @@
}
private void registerEntity(Entity entity) {
@@ -891,9 +1045,16 @@
@@ -997,9 +1154,16 @@
this.entitiesByUUID.put(entity.getUniqueID(), entity);
this.getChunkProvider().addEntity(entity);
@@ -448,7 +451,7 @@
}
}
@@ -909,7 +1070,7 @@
@@ -1015,7 +1179,7 @@
}
private void removeEntityFromChunk(Entity entity) {
@@ -457,7 +460,7 @@
if (ichunkaccess instanceof Chunk) {
((Chunk) ichunkaccess).b(entity);
@@ -923,10 +1084,33 @@
@@ -1029,10 +1193,33 @@
this.everyoneSleeping();
}
@@ -491,7 +494,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -935,6 +1119,12 @@
@@ -1041,6 +1228,12 @@
double d1 = (double) blockposition.getY() - entityplayer.locY();
double d2 = (double) blockposition.getZ() - entityplayer.locZ();
@@ -504,7 +507,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -973,7 +1163,18 @@
@@ -1079,7 +1272,18 @@
Iterator iterator = this.navigators.iterator();
while (iterator.hasNext()) {
@@ -524,7 +527,7 @@
if (!navigationabstract.i()) {
navigationabstract.b(blockposition);
@@ -995,10 +1196,20 @@
@@ -1101,10 +1305,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) {
@@ -545,7 +548,7 @@
if (explosion_effect == Explosion.Effect.NONE) {
explosion.clearBlocks();
}
@@ -1063,13 +1274,20 @@
@@ -1169,13 +1383,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) {
@@ -568,7 +571,7 @@
++j;
}
}
@@ -1111,7 +1329,7 @@
@@ -1217,7 +1438,7 @@
@Nullable
public BlockPosition a(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
@@ -577,7 +580,7 @@
}
@Nullable
@@ -1149,7 +1367,13 @@
@@ -1255,7 +1476,13 @@
@Override
public WorldMap a(String s) {
return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().b(() -> {
@@ -592,7 +595,61 @@
}, s);
}
@@ -1460,6 +1684,11 @@
@@ -1386,9 +1613,9 @@
reputationhandler.a(reputationevent, entity);
}
- public void a(Path path) throws IOException {
+ public void a(java.nio.file.Path java_nio_file_path) throws IOException {
PlayerChunkMap playerchunkmap = this.getChunkProvider().playerChunkMap;
- BufferedWriter bufferedwriter = Files.newBufferedWriter(path.resolve("stats.txt"));
+ BufferedWriter bufferedwriter = Files.newBufferedWriter(java_nio_file_path.resolve("stats.txt"));
Throwable throwable = null;
try {
@@ -1432,7 +1659,7 @@
CrashReport crashreport = new CrashReport("Level dump", new Exception("dummy"));
this.a(crashreport);
- BufferedWriter bufferedwriter1 = Files.newBufferedWriter(path.resolve("example_crash.txt"));
+ BufferedWriter bufferedwriter1 = Files.newBufferedWriter(java_nio_file_path.resolve("example_crash.txt"));
Throwable throwable3 = null;
try {
@@ -1455,8 +1682,8 @@
}
- Path path1 = path.resolve("chunks.csv");
- BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);
+ java.nio.file.Path java_nio_file_path1 = java_nio_file_path.resolve("chunks.csv");
+ BufferedWriter bufferedwriter2 = Files.newBufferedWriter(java_nio_file_path1);
Throwable throwable6 = null;
try {
@@ -1479,8 +1706,8 @@
}
- Path path2 = path.resolve("entities.csv");
- BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);
+ java.nio.file.Path java_nio_file_path2 = java_nio_file_path.resolve("entities.csv");
+ BufferedWriter bufferedwriter3 = Files.newBufferedWriter(java_nio_file_path2);
Throwable throwable9 = null;
try {
@@ -1503,8 +1730,8 @@
}
- Path path3 = path.resolve("block_entities.csv");
- BufferedWriter bufferedwriter4 = Files.newBufferedWriter(path3);
+ java.nio.file.Path java_nio_file_path3 = java_nio_file_path.resolve("block_entities.csv");
+ BufferedWriter bufferedwriter4 = Files.newBufferedWriter(java_nio_file_path3);
Throwable throwable12 = null;
try {
@@ -1566,6 +1793,11 @@
@Override
public void update(BlockPosition blockposition, Block block) {
if (!this.isDebugWorld()) {
@@ -604,7 +661,7 @@
this.applyPhysics(blockposition, block);
}
@@ -1474,12 +1703,12 @@
@@ -1580,12 +1812,12 @@
}
public boolean isFlatWorld() {
@@ -619,7 +676,7 @@
}
@Nullable
@@ -1499,9 +1728,9 @@
@@ -1605,9 +1837,9 @@
@VisibleForTesting
public String F() {
@@ -631,7 +688,7 @@
return IRegistry.BLOCK_ENTITY_TYPE.getKey(tileentity.getTileType());
}), this.getBlockTickList().a(), this.getFluidTickList().a(), this.P());
}
@@ -1509,7 +1738,7 @@
@@ -1615,7 +1847,7 @@
private static <T> String a(Collection<T> collection, Function<T, MinecraftKey> function) {
try {
Object2IntOpenHashMap<MinecraftKey> object2intopenhashmap = new Object2IntOpenHashMap();
@@ -640,7 +697,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1518,7 +1747,8 @@
@@ -1624,7 +1856,8 @@
object2intopenhashmap.addTo(minecraftkey, 1);
}
@@ -650,7 +707,7 @@
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 +1757,32 @@
@@ -1633,16 +1866,32 @@
}
public static void a(WorldServer worldserver) {

View File

@@ -1,7 +1,8 @@
--- a/net/minecraft/server/HandshakeListener.java
+++ b/net/minecraft/server/HandshakeListener.java
@@ -1,7 +1,16 @@
package net.minecraft.server;
--- a/net/minecraft/server/network/HandshakeListener.java
+++ b/net/minecraft/server/network/HandshakeListener.java
@@ -11,8 +11,17 @@
import net.minecraft.network.protocol.login.PacketLoginOutDisconnect;
import net.minecraft.server.MinecraftServer;
+// CraftBukkit start
+import java.net.InetAddress;
@@ -17,7 +18,7 @@
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
private final MinecraftServer b;
private final NetworkManager c;
@@ -16,6 +25,40 @@
@@ -27,6 +36,40 @@
switch (packethandshakinginsetprotocol.b()) {
case LOGIN:
this.c.setProtocol(EnumProtocol.LOGIN);
@@ -58,7 +59,7 @@
if (packethandshakinginsetprotocol.c() != SharedConstants.getGameVersion().getProtocolVersion()) {
ChatMessage chatmessage;
@@ -29,6 +72,7 @@
@@ -40,6 +83,7 @@
this.c.close(chatmessage);
} else {
this.c.setPacketListener(new LoginListener(this.b, this.c));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/LegacyPingHandler.java
+++ b/net/minecraft/server/LegacyPingHandler.java
@@ -34,11 +34,12 @@
--- a/net/minecraft/server/network/LegacyPingHandler.java
+++ b/net/minecraft/server/network/LegacyPingHandler.java
@@ -35,11 +35,12 @@
MinecraftServer minecraftserver = this.b.d();
int i = bytebuf.readableBytes();
String s;
@@ -14,7 +14,7 @@
this.a(channelhandlercontext, this.a(s));
break;
case 1:
@@ -47,7 +48,7 @@
@@ -48,7 +49,7 @@
}
LegacyPingHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
@@ -23,7 +23,7 @@
this.a(channelhandlercontext, this.a(s));
break;
default:
@@ -66,7 +67,7 @@
@@ -67,7 +68,7 @@
}
LegacyPingHandler.LOGGER.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());

View File

@@ -1,10 +1,11 @@
--- a/net/minecraft/server/LoginListener.java
+++ b/net/minecraft/server/LoginListener.java
@@ -18,6 +18,12 @@
--- a/net/minecraft/server/network/LoginListener.java
+++ b/net/minecraft/server/network/LoginListener.java
@@ -35,6 +35,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.network.chat.ChatComponentText;
+import org.bukkit.craftbukkit.util.Waitable;
+import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
+import org.bukkit.event.player.PlayerPreLoginEvent;
@@ -13,7 +14,7 @@
public class LoginListener implements PacketLoginInListener {
private static final AtomicInteger b = new AtomicInteger(0);
@@ -32,6 +38,7 @@
@@ -49,6 +56,7 @@
private final String j;
private SecretKey loginKey;
private EntityPlayer l;
@@ -21,7 +22,7 @@
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.g = LoginListener.EnumProtocolState.HELLO;
@@ -60,6 +67,20 @@
@@ -77,6 +85,20 @@
}
@@ -42,7 +43,7 @@
@Override
public NetworkManager a() {
return this.networkManager;
@@ -81,10 +102,12 @@
@@ -98,10 +120,12 @@
this.i = this.a(this.i);
}
@@ -58,7 +59,7 @@
} else {
this.g = LoginListener.EnumProtocolState.ACCEPTED;
if (this.server.ax() >= 0 && !this.networkManager.isLocal()) {
@@ -98,9 +121,9 @@
@@ -115,9 +139,9 @@
if (entityplayer != null) {
this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT;
@@ -70,7 +71,7 @@
}
}
@@ -158,6 +181,43 @@
@@ -175,6 +199,43 @@
try {
LoginListener.this.i = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
if (LoginListener.this.i != null) {
@@ -114,7 +115,7 @@
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 @@
@@ -194,6 +255,11 @@
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
}

View File

@@ -1,12 +1,16 @@
--- a/net/minecraft/server/PacketStatusListener.java
+++ b/net/minecraft/server/PacketStatusListener.java
@@ -1,5 +1,14 @@
package net.minecraft.server;
--- a/net/minecraft/server/network/PacketStatusListener.java
+++ b/net/minecraft/server/network/PacketStatusListener.java
@@ -10,6 +10,18 @@
import net.minecraft.network.protocol.status.PacketStatusOutServerInfo;
import net.minecraft.server.MinecraftServer;
+// CraftBukkit start
+import com.mojang.authlib.GameProfile;
+import java.net.InetSocketAddress;
+import java.util.Iterator;
+import net.minecraft.SharedConstants;
+import net.minecraft.network.protocol.status.ServerPing;
+import net.minecraft.server.level.EntityPlayer;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
+import org.bukkit.craftbukkit.util.CraftIconCache;
+import org.bukkit.entity.Player;
@@ -15,7 +19,7 @@
public class PacketStatusListener implements PacketStatusInListener {
private static final IChatBaseComponent a = new ChatMessage("multiplayer.status.request_handled");
@@ -26,8 +35,96 @@
@@ -36,8 +48,96 @@
this.networkManager.close(PacketStatusListener.a);
} else {
this.d = true;

View File

@@ -1,12 +1,23 @@
--- a/net/minecraft/server/PlayerConnection.java
+++ b/net/minecraft/server/PlayerConnection.java
@@ -24,6 +24,48 @@
--- a/net/minecraft/server/network/PlayerConnection.java
+++ b/net/minecraft/server/network/PlayerConnection.java
@@ -158,6 +158,59 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity;
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntityLiving;
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnPosition;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.entity.EntityInsentient;
+import net.minecraft.world.entity.animal.EntityFish;
+import net.minecraft.world.inventory.InventoryClickType;
+import net.minecraft.world.item.crafting.IRecipe;
+import net.minecraft.world.level.RayTrace;
+import net.minecraft.world.phys.MovingObjectPosition;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -49,7 +60,7 @@
public class PlayerConnection implements PacketListenerPlayIn {
private static final Logger LOGGER = LogManager.getLogger();
@@ -34,7 +76,10 @@
@@ -168,7 +221,10 @@
private long lastKeepAlive;
private boolean awaitingKeepAlive;
private long h;
@@ -61,7 +72,7 @@
private int j;
private final Int2ShortMap k = new Int2ShortOpenHashMap();
private double l;
@@ -72,8 +117,33 @@
@@ -206,8 +262,33 @@
itextfilter.a();
}
@@ -95,7 +106,7 @@
public void tick() {
this.syncPosition();
this.player.lastX = this.player.locX();
@@ -121,7 +191,7 @@
@@ -255,7 +336,7 @@
this.minecraftServer.getMethodProfiler().enter("keepAlive");
long i = SystemUtils.getMonotonicMillis();
@@ -104,7 +115,7 @@
if (this.awaitingKeepAlive) {
this.disconnect(new ChatMessage("disconnect.timeout"));
} else {
@@ -133,15 +203,21 @@
@@ -267,15 +348,21 @@
}
this.minecraftServer.getMethodProfiler().exit();
@@ -126,7 +137,7 @@
this.disconnect(new ChatMessage("multiplayer.disconnect.idling"));
}
@@ -165,16 +241,46 @@
@@ -299,16 +386,46 @@
return this.minecraftServer.a(this.player.getProfile());
}
@@ -174,7 +185,7 @@
}
private <T> void a(T t0, Consumer<T> consumer, BiFunction<ITextFilter, T, CompletableFuture<Optional<T>>> bifunction) {
@@ -190,7 +296,7 @@
@@ -324,7 +441,7 @@
ITextFilter itextfilter = this.player.Q();
if (itextfilter != null) {
@@ -183,7 +194,7 @@
optional.ifPresent(consumer1);
}, iasynctaskhandler);
} else {
@@ -247,7 +353,34 @@
@@ -381,7 +498,34 @@
double d9 = entity.getMot().g();
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@@ -219,7 +230,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;
@@ -277,14 +410,72 @@
@@ -411,14 +555,72 @@
}
entity.setLocation(d3, d4, d5, f, f1);
@@ -292,7 +303,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);
@@ -303,7 +494,7 @@
@@ -437,7 +639,7 @@
@Override
public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) {
PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer());
@@ -301,7 +312,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;
@@ -313,6 +504,7 @@
@@ -447,6 +649,7 @@
}
this.teleportPos = null;
@@ -309,7 +320,7 @@
}
}
@@ -320,7 +512,7 @@
@@ -454,7 +657,7 @@
@Override
public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.getWorldServer());
@@ -318,7 +329,7 @@
RecipeBookServer recipebookserver = this.player.getRecipeBook();
optional.ifPresent(recipebookserver::e);
@@ -349,6 +541,12 @@
@@ -483,6 +686,12 @@
@Override
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer());
@@ -331,7 +342,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.c());
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -358,6 +556,7 @@
@@ -492,6 +701,7 @@
ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@@ -339,7 +350,7 @@
this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
});
}
@@ -586,6 +785,7 @@
@@ -720,6 +930,7 @@
if (container instanceof ContainerMerchant) {
ContainerMerchant containermerchant = (ContainerMerchant) container;
@@ -347,7 +358,7 @@
containermerchant.d(i);
containermerchant.g(i);
@@ -595,6 +795,13 @@
@@ -729,6 +940,13 @@
@Override
public void a(PacketPlayInBEdit packetplayinbedit) {
@@ -361,7 +372,7 @@
ItemStack itemstack = packetplayinbedit.b();
if (itemstack.getItem() == Items.WRITABLE_BOOK) {
@@ -610,13 +817,15 @@
@@ -744,13 +962,15 @@
NBTTagList nbttaglist = nbttagcompound.getList("pages", 8);
@@ -380,7 +391,7 @@
if (PlayerInventory.d(i) || i == 40) {
this.a((List) list, flag ? (list1) -> {
this.a((String) list1.get(0), list1.subList(1, list1.size()), i);
@@ -635,7 +844,9 @@
@@ -769,7 +989,9 @@
NBTTagList nbttaglist = new NBTTagList();
list.stream().map(NBTTagString::a).forEach(nbttaglist::add);
@@ -390,7 +401,7 @@
}
}
@@ -664,7 +875,7 @@
@@ -798,7 +1020,7 @@
}
itemstack1.a("pages", (NBTBase) nbttaglist);
@@ -399,7 +410,7 @@
}
}
@@ -702,7 +913,7 @@
@@ -836,7 +1058,7 @@
} else {
WorldServer worldserver = this.player.getWorldServer();
@@ -408,7 +419,7 @@
if (this.e == 0) {
this.syncPosition();
}
@@ -712,13 +923,21 @@
@@ -846,13 +1068,21 @@
this.A = this.e;
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
}
@@ -431,7 +442,7 @@
double d0 = this.player.locX();
double d1 = this.player.locY();
double d2 = this.player.locZ();
@@ -743,15 +962,33 @@
@@ -877,15 +1107,33 @@
++this.receivedMovePackets;
int i = this.receivedMovePackets - this.processedMovePackets;
@@ -467,7 +478,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;
@@ -770,6 +1007,7 @@
@@ -904,6 +1152,7 @@
}
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
@@ -475,7 +486,7 @@
double d12 = d8;
d7 = d4 - this.player.locX();
@@ -791,10 +1029,74 @@
@@ -925,10 +1174,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 {
@@ -552,7 +563,7 @@
if (flag) {
this.player.fallDistance = 0.0F;
}
@@ -823,10 +1125,66 @@
@@ -957,10 +1270,66 @@
}
public void a(double d0, double d1, double d2, float f, float f1) {
@@ -620,7 +631,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;
@@ -838,6 +1196,14 @@
@@ -972,6 +1341,14 @@
this.teleportAwait = 0;
}
@@ -635,7 +646,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));
@@ -846,6 +1212,7 @@
@@ -980,6 +1357,7 @@
@Override
public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());
@@ -643,7 +654,7 @@
BlockPosition blockposition = packetplayinblockdig.b();
this.player.resetIdleTimer();
@@ -856,14 +1223,46 @@
@@ -990,14 +1368,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.b(EnumHand.OFF_HAND);
@@ -692,7 +703,7 @@
this.player.dropItem(false);
}
@@ -900,6 +1299,7 @@
@@ -1034,6 +1444,7 @@
@Override
public void a(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.getWorldServer());
@@ -700,7 +711,7 @@
WorldServer worldserver = this.player.getWorldServer();
EnumHand enumhand = packetplayinuseitem.b();
ItemStack itemstack = this.player.b(enumhand);
@@ -910,6 +1310,14 @@
@@ -1044,6 +1455,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)) {
@@ -715,7 +726,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)) {
@@ -933,12 +1341,51 @@
@@ -1067,12 +1486,51 @@
@Override
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
@@ -767,7 +778,7 @@
EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.b()) {
@@ -959,7 +1406,7 @@
@@ -1093,7 +1551,7 @@
Entity entity = packetplayinspectate.a(worldserver);
if (entity != null) {
@@ -776,7 +787,7 @@
return;
}
}
@@ -968,7 +1415,12 @@
@@ -1102,7 +1560,12 @@
}
@Override
@@ -790,7 +801,7 @@
@Override
public void a(PacketPlayInBoatMove packetplayinboatmove) {
@@ -983,11 +1435,26 @@
@@ -1117,11 +1580,26 @@
@Override
public void a(IChatBaseComponent ichatbasecomponent) {
@@ -818,7 +829,7 @@
ITextFilter itextfilter = this.player.Q();
if (itextfilter != null) {
@@ -1019,6 +1486,15 @@
@@ -1153,6 +1631,15 @@
}
}
@@ -834,7 +845,7 @@
try {
this.networkManager.sendPacket(packet, genericfuturelistener);
} catch (Throwable throwable) {
@@ -1035,7 +1511,16 @@
@@ -1169,7 +1656,16 @@
@Override
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
@@ -851,7 +862,7 @@
if (this.player.inventory.itemInHandIndex != packetplayinhelditemslot.b() && this.player.getRaisedHand() == EnumHand.MAIN_HAND) {
this.player.clearActiveItem();
}
@@ -1044,65 +1529,286 @@
@@ -1178,65 +1674,286 @@
this.player.resetIdleTimer();
} else {
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getDisplayName().getString());
@@ -1147,7 +1158,7 @@
this.player.resetIdleTimer();
IJumpable ijumpable;
@@ -1160,6 +1866,7 @@
@@ -1294,6 +2011,7 @@
@Override
public void a(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
@@ -1155,7 +1166,7 @@
WorldServer worldserver = this.player.getWorldServer();
Entity entity = packetplayinuseentity.a((World) worldserver);
@@ -1173,18 +1880,72 @@
@@ -1307,18 +2025,72 @@
ItemStack itemstack = enumhand != null ? this.player.b(enumhand).cloneItemStack() : ItemStack.b;
Optional<EnumInteractionResult> optional = Optional.empty();
@@ -1188,7 +1199,7 @@
+
+ if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) {
+ // Refresh the current entity metadata
+ this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true));
+ this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true));
+ }
+
+ if (event.isCancelled()) {
@@ -1229,7 +1240,7 @@
}
if (optional.isPresent() && ((EnumInteractionResult) optional.get()).a()) {
@@ -1231,15 +1992,21 @@
@@ -1365,15 +2137,21 @@
@Override
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
@@ -1253,7 +1264,7 @@
NonNullList<ItemStack> nonnulllist = NonNullList.a();
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
@@ -1248,8 +2015,274 @@
@@ -1382,8 +2160,274 @@
this.player.a(this.player.activeContainer, nonnulllist);
} else {
@@ -1529,7 +1540,7 @@
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
this.player.e = true;
@@ -1289,6 +2322,7 @@
@@ -1423,6 +2467,7 @@
@Override
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
@@ -1537,7 +1548,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());
@@ -1321,6 +2355,43 @@
@@ -1455,6 +2500,43 @@
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@@ -1581,7 +1592,7 @@
if (flag1 && flag2) {
if (itemstack.isEmpty()) {
@@ -1342,6 +2413,7 @@
@@ -1476,6 +2558,7 @@
@Override
public void a(PacketPlayInTransaction packetplayintransaction) {
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
@@ -1589,7 +1600,7 @@
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()) {
@@ -1360,6 +2432,7 @@
@@ -1494,6 +2577,7 @@
}
private void a(PacketPlayInUpdateSign packetplayinupdatesign, List<String> list) {
@@ -1597,7 +1608,7 @@
this.player.resetIdleTimer();
WorldServer worldserver = this.player.getWorldServer();
BlockPosition blockposition = packetplayinupdatesign.b();
@@ -1376,12 +2449,28 @@
@@ -1510,12 +2594,28 @@
if (!tileentitysign.d() || tileentitysign.f() != this.player) {
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString());
@@ -1627,7 +1638,7 @@
tileentitysign.update();
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
@@ -1391,6 +2480,7 @@
@@ -1525,6 +2625,7 @@
@Override
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
@@ -1635,7 +1646,7 @@
if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) {
int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive);
@@ -1405,7 +2495,17 @@
@@ -1539,7 +2640,17 @@
@Override
public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
@@ -1654,7 +1665,7 @@
}
@Override
@@ -1414,8 +2514,50 @@
@@ -1548,8 +2659,50 @@
this.player.a(packetplayinsettings);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ServerConnection.java
+++ b/net/minecraft/server/ServerConnection.java
@@ -74,14 +74,24 @@
--- a/net/minecraft/server/network/ServerConnection.java
+++ b/net/minecraft/server/network/ServerConnection.java
@@ -87,14 +87,24 @@
int j = ServerConnection.this.e.k();
Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/ExpirableListEntry.java
+++ b/net/minecraft/server/ExpirableListEntry.java
@@ -23,7 +23,7 @@
--- a/net/minecraft/server/players/ExpirableListEntry.java
+++ b/net/minecraft/server/players/ExpirableListEntry.java
@@ -24,7 +24,7 @@
}
protected ExpirableListEntry(T t0, JsonObject jsonobject) {
@@ -9,7 +9,7 @@
Date date;
@@ -74,4 +74,26 @@
@@ -75,4 +75,26 @@
jsonobject.addProperty("expires", this.d == null ? "forever" : ExpirableListEntry.a.format(this.d));
jsonobject.addProperty("reason", this.e);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/JsonList.java
+++ b/net/minecraft/server/JsonList.java
@@ -50,7 +50,7 @@
--- a/net/minecraft/server/players/JsonList.java
+++ b/net/minecraft/server/players/JsonList.java
@@ -52,7 +52,7 @@
@Nullable
public V get(K k0) {
this.g();
@@ -9,7 +9,7 @@
}
public void remove(K k0) {
@@ -72,6 +72,12 @@
@@ -74,6 +74,12 @@
return (String[]) this.d.keySet().toArray(new String[this.d.size()]);
}
@@ -22,7 +22,7 @@
public boolean isEmpty() {
return this.d.size() < 1;
}
@@ -89,7 +95,7 @@
@@ -91,7 +97,7 @@
Iterator iterator = this.d.values().iterator();
while (iterator.hasNext()) {
@@ -31,7 +31,7 @@
if (v0.hasExpired()) {
list.add(v0.getKey());
@@ -99,7 +105,7 @@
@@ -101,7 +107,7 @@
iterator = list.iterator();
while (iterator.hasNext()) {
@@ -40,7 +40,7 @@
this.d.remove(this.a(k0));
}
@@ -119,7 +125,7 @@
@@ -121,7 +127,7 @@
JsonObject jsonobject = new JsonObject();
jsonlistentry.getClass();
@@ -49,7 +49,7 @@
}).forEach(jsonarray::add);
BufferedWriter bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
Throwable throwable = null;
@@ -163,7 +169,7 @@
@@ -165,7 +171,7 @@
JsonListEntry<K> jsonlistentry = this.a(jsonobject);
if (jsonlistentry.getKey() != null) {

View File

@@ -1,6 +1,18 @@
--- a/net/minecraft/server/NameReferencingFileConverter.java
+++ b/net/minecraft/server/NameReferencingFileConverter.java
@@ -80,7 +80,7 @@
--- a/net/minecraft/server/players/NameReferencingFileConverter.java
+++ b/net/minecraft/server/players/NameReferencingFileConverter.java
@@ -27,6 +27,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTCompressedStreamTools;
+import net.minecraft.nbt.NBTTagCompound;
+// CraftBukkit end
+
public class NameReferencingFileConverter {
private static final Logger LOGGER = LogManager.getLogger();
@@ -85,7 +90,7 @@
try {
gameprofilebanlist.load();
} catch (IOException ioexception) {
@@ -9,7 +21,7 @@
}
}
@@ -138,7 +138,7 @@
@@ -143,7 +148,7 @@
try {
ipbanlist.load();
} catch (IOException ioexception) {
@@ -18,7 +30,7 @@
}
}
@@ -179,7 +179,7 @@
@@ -184,7 +189,7 @@
try {
oplist.load();
} catch (IOException ioexception) {
@@ -27,7 +39,7 @@
}
}
@@ -223,7 +223,7 @@
@@ -228,7 +233,7 @@
try {
whitelist.load();
} catch (IOException ioexception) {
@@ -36,7 +48,7 @@
}
}
@@ -346,6 +346,30 @@
@@ -351,6 +356,30 @@
File file5 = new File(file, s2 + ".dat");
File file6 = new File(file4, s3 + ".dat");

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/PlayerList.java
+++ b/net/minecraft/server/PlayerList.java
@@ -21,6 +21,23 @@
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -90,6 +90,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -8,6 +8,10 @@
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
+import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.server.network.LoginListener;
+
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.CraftWorld;
+
@@ -24,7 +28,7 @@
public abstract class PlayerList {
public static final File b = new File("banned-players.json");
@@ -30,14 +47,16 @@
@@ -99,14 +120,16 @@
private static final Logger LOGGER = LogManager.getLogger();
private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
private final MinecraftServer server;
@@ -44,7 +48,7 @@
public final WorldNBTStorage playerFileData;
private boolean hasWhitelist;
private final IRegistryCustom.Dimension s;
@@ -47,13 +66,23 @@
@@ -116,13 +139,23 @@
private boolean v;
private int w;
@@ -70,7 +74,7 @@
this.server = minecraftserver;
this.s = iregistrycustom_dimension;
this.maxPlayers = i;
@@ -69,6 +98,12 @@
@@ -138,6 +171,12 @@
usercache.a(gameprofile);
NBTTagCompound nbttagcompound = this.a(entityplayer);
ResourceKey resourcekey;
@@ -83,7 +87,7 @@
if (nbttagcompound != null) {
DataResult dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.a, nbttagcompound.get("Dimension")));
@@ -99,7 +134,8 @@
@@ -168,7 +207,8 @@
s1 = networkmanager.getSocketAddress().toString();
}
@@ -93,7 +97,7 @@
WorldData worlddata = worldserver1.getWorldData();
this.a(entityplayer, (EntityPlayer) null, worldserver1);
@@ -109,6 +145,7 @@
@@ -178,6 +218,7 @@
boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO);
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.F(), this.s, worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), this.getMaxPlayers(), this.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld()));
@@ -101,7 +105,7 @@
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
@@ -127,19 +164,61 @@
@@ -196,19 +237,61 @@
} else {
chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[]{entityplayer.getScoreboardDisplayName(), s});
}
@@ -153,7 +157,7 @@
+ entityplayer.sentListPacket = true;
+ // CraftBukkit end
+
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.datawatcher, true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.getDataWatcher(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
+
+ // CraftBukkit start - Only add if the player wasn't moved in the event
+ if (entityplayer.world == worldserver1 && !worldserver1.getPlayers().contains(entityplayer)) {
@@ -168,7 +172,7 @@
this.a(entityplayer, worldserver1);
if (!this.server.getResourcePack().isEmpty()) {
entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash());
@@ -155,8 +234,11 @@
@@ -224,8 +307,11 @@
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
@@ -182,7 +186,7 @@
});
if (entity != null) {
@@ -199,6 +281,8 @@
@@ -268,6 +354,8 @@
}
entityplayer.syncInventory();
@@ -191,7 +195,7 @@
}
public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
@@ -231,30 +315,31 @@
@@ -300,30 +388,31 @@
}
public void setPlayerFileData(WorldServer worldserver) {
@@ -228,7 +232,7 @@
}
@Override
@@ -282,14 +367,15 @@
@@ -351,14 +440,15 @@
}
protected void savePlayerFile(EntityPlayer entityplayer) {
@@ -246,7 +250,7 @@
if (advancementdataplayer != null) {
advancementdataplayer.b();
@@ -297,10 +383,24 @@
@@ -366,10 +456,24 @@
}
@@ -272,7 +276,7 @@
this.savePlayerFile(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle();
@@ -332,18 +432,66 @@
@@ -401,18 +505,66 @@
if (entityplayer1 == entityplayer) {
this.j.remove(uuid);
@@ -345,7 +349,7 @@
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile);
chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()});
@@ -351,10 +499,12 @@
@@ -420,10 +572,12 @@
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.g.format(gameprofilebanentry.getExpires())}));
}
@@ -361,7 +365,7 @@
IpBanEntry ipbanentry = this.l.get(socketaddress);
chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[]{ipbanentry.getReason()});
@@ -362,13 +512,25 @@
@@ -431,13 +585,25 @@
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[]{PlayerList.g.format(ipbanentry.getExpires())}));
}
@@ -390,7 +394,7 @@
UUID uuid = EntityHuman.a(gameprofile);
List<EntityPlayer> list = Lists.newArrayList();
@@ -404,14 +566,24 @@
@@ -473,14 +639,24 @@
}
return new EntityPlayer(this.server, worldserver, gameprofile, (PlayerInteractManager) object);
@@ -415,7 +419,7 @@
WorldServer worldserver = this.server.getWorldServer(entityplayer.getSpawnDimension());
Optional optional;
@@ -431,6 +603,11 @@
@@ -500,6 +676,11 @@
}
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getProfile(), (PlayerInteractManager) object);
@@ -427,7 +431,7 @@
entityplayer1.playerConnection = entityplayer.playerConnection;
entityplayer1.copyFrom(entityplayer, flag);
@@ -444,52 +621,113 @@
@@ -513,52 +694,113 @@
entityplayer1.addScoreboardTag(s);
}
@@ -566,7 +570,7 @@
return entityplayer1;
}
@@ -502,7 +740,18 @@
@@ -571,7 +813,18 @@
public void tick() {
if (++this.w > 600) {
@@ -586,7 +590,7 @@
this.w = 0;
}
@@ -515,6 +764,25 @@
@@ -584,6 +837,25 @@
}
@@ -612,7 +616,7 @@
public void a(Packet<?> packet, ResourceKey<World> resourcekey) {
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@@ -615,6 +883,7 @@
@@ -684,6 +956,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
}
@@ -620,7 +624,7 @@
this.server.getCommandDispatcher().a(entityplayer);
}
@@ -647,6 +916,12 @@
@@ -716,6 +989,12 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@@ -633,7 +637,7 @@
if (entityplayer != entityhuman && entityplayer.world.getDimensionKey() == resourcekey) {
double d4 = d0 - entityplayer.locX();
double d5 = d1 - entityplayer.locY();
@@ -686,23 +961,34 @@
@@ -755,23 +1034,34 @@
public void reloadWhitelist() {}
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
@@ -673,7 +677,7 @@
}
public int getPlayerCount() {
@@ -755,31 +1041,54 @@
@@ -824,31 +1114,54 @@
entityplayer.playerInteractManager.a(this.u, EnumGamemode.NOT_SET);
}
@@ -736,7 +740,7 @@
if (file2.exists() && file2.isFile()) {
file2.renameTo(file1);
@@ -787,7 +1096,7 @@
@@ -856,7 +1169,7 @@
}
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
@@ -745,7 +749,7 @@
}
return serverstatisticmanager;
@@ -795,14 +1104,14 @@
@@ -864,14 +1177,14 @@
public AdvancementDataPlayer f(EntityPlayer entityplayer) {
UUID uuid = entityplayer.getUniqueID();
@@ -762,7 +766,7 @@
}
advancementdataplayer.a(entityplayer);
@@ -838,13 +1147,20 @@
@@ -907,13 +1220,20 @@
}
public void reload() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/RemoteControlCommandListener.java
+++ b/net/minecraft/server/RemoteControlCommandListener.java
@@ -26,6 +26,17 @@
--- a/net/minecraft/server/rcon/RemoteControlCommandListener.java
+++ b/net/minecraft/server/rcon/RemoteControlCommandListener.java
@@ -36,6 +36,17 @@
return new CommandListenerWrapper(this, Vec3D.b((BaseBlockPosition) worldserver.getSpawn()), Vec2F.a, worldserver, 4, "Rcon", RemoteControlCommandListener.b, this.server, (Entity) null);
}