@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/AdvancementDataPlayer.java
|
||||
+++ b/net/minecraft/server/AdvancementDataPlayer.java
|
||||
@@ -197,6 +197,7 @@
|
||||
@@ -196,6 +196,7 @@
|
||||
AdvancementHolder advancementholder = advancementdataworld.get(minecraftkey);
|
||||
|
||||
if (advancementholder == null) {
|
||||
@@ -8,7 +8,7 @@
|
||||
AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", minecraftkey, this.playerSavePath);
|
||||
} else {
|
||||
this.startProgress(advancementholder, advancementprogress);
|
||||
@@ -228,6 +229,7 @@
|
||||
@@ -227,6 +228,7 @@
|
||||
this.progressChanged.add(advancementholder);
|
||||
flag = true;
|
||||
if (!flag1 && advancementprogress.isDone()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/CustomFunctionData.java
|
||||
+++ b/net/minecraft/server/CustomFunctionData.java
|
||||
@@ -45,7 +45,7 @@
|
||||
@@ -36,7 +36,7 @@
|
||||
}
|
||||
|
||||
public CommandDispatcher<CommandListenerWrapper> getDispatcher() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -61,6 +61,17 @@
|
||||
@@ -60,6 +60,17 @@
|
||||
import net.minecraft.world.level.storage.WorldInfo;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
public class Main {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -68,8 +79,9 @@
|
||||
@@ -67,8 +78,9 @@
|
||||
public Main() {}
|
||||
|
||||
@DontObfuscate
|
||||
@@ -29,7 +29,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");
|
||||
@@ -94,15 +106,18 @@
|
||||
@@ -93,15 +105,18 @@
|
||||
optionparser.printHelpOn(System.err);
|
||||
return;
|
||||
}
|
||||
@@ -50,7 +50,7 @@
|
||||
JvmProfiler.INSTANCE.start(Environment.SERVER);
|
||||
}
|
||||
|
||||
@@ -110,13 +125,26 @@
|
||||
@@ -109,13 +124,26 @@
|
||||
DispenserRegistry.validate();
|
||||
SystemUtils.startTimerHackThread();
|
||||
Path path1 = Paths.get("server.properties");
|
||||
@@ -79,7 +79,7 @@
|
||||
Main.LOGGER.info("Initialized '{}' and '{}'", path1.toAbsolutePath(), path2.toAbsolutePath());
|
||||
return;
|
||||
}
|
||||
@@ -126,11 +154,12 @@
|
||||
@@ -125,11 +153,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,15 +92,16 @@
|
||||
Convertable convertable = Convertable.createDefault(file.toPath());
|
||||
- Convertable.ConversionSession convertable_conversionsession = convertable.validateAndCreateAccess(s);
|
||||
+ Convertable.ConversionSession convertable_conversionsession = convertable.validateAndCreateAccess(s, WorldDimension.OVERWORLD);
|
||||
WorldInfo worldinfo = convertable_conversionsession.getSummary();
|
||||
+ // CraftBukkit end
|
||||
Dynamic dynamic;
|
||||
|
||||
if (worldinfo != null) {
|
||||
@@ -145,13 +174,31 @@
|
||||
}
|
||||
if (convertable_conversionsession.hasWorldData()) {
|
||||
@@ -170,13 +200,31 @@
|
||||
}
|
||||
|
||||
Dynamic<?> dynamic1 = dynamic;
|
||||
- boolean flag = optionset.has(optionspec6);
|
||||
+ boolean flag = optionset.has("safeMode");
|
||||
+ boolean flag = optionset.has("safeMode"); // CraftBukkit
|
||||
|
||||
if (flag) {
|
||||
Main.LOGGER.warn("Safe mode active, only vanilla datapack will be loaded");
|
||||
@@ -128,15 +129,15 @@
|
||||
|
||||
WorldStem worldstem;
|
||||
|
||||
@@ -160,6 +207,7 @@
|
||||
@@ -185,6 +233,7 @@
|
||||
|
||||
worldstem = (WorldStem) SystemUtils.blockUntilDone((executor) -> {
|
||||
return WorldLoader.load(worldloader_c, (worldloader_a) -> {
|
||||
+ worldLoader.set(worldloader_a); // CraftBukkit
|
||||
IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
|
||||
DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) worldloader_a.datapackWorldgen());
|
||||
Pair<SaveData, WorldDimensions.b> pair = convertable_conversionsession.getDataTag(dynamicops, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen().allRegistriesLifecycle());
|
||||
@@ -171,7 +219,7 @@
|
||||
|
||||
if (dynamic1 != null) {
|
||||
@@ -197,7 +246,7 @@
|
||||
WorldOptions worldoptions;
|
||||
WorldDimensions worlddimensions;
|
||||
|
||||
@@ -145,7 +146,7 @@
|
||||
worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
worldoptions = WorldOptions.DEMO_OPTIONS;
|
||||
worlddimensions = WorldPresets.createNormalWorldDimensions(worldloader_a.datapackWorldgen());
|
||||
@@ -179,7 +227,7 @@
|
||||
@@ -205,7 +254,7 @@
|
||||
DedicatedServerProperties dedicatedserverproperties = dedicatedserversettings.getProperties();
|
||||
|
||||
worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), worldloader_a.dataConfiguration());
|
||||
@@ -154,7 +155,7 @@
|
||||
worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen());
|
||||
}
|
||||
|
||||
@@ -195,6 +243,7 @@
|
||||
@@ -221,6 +270,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -162,7 +163,7 @@
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registries().compositeAccess();
|
||||
|
||||
if (optionset.has(optionspec4)) {
|
||||
@@ -206,20 +255,31 @@
|
||||
@@ -232,20 +282,31 @@
|
||||
SaveData savedata = worldstem.worldData();
|
||||
|
||||
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
|
||||
@@ -196,7 +197,7 @@
|
||||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
public void run() {
|
||||
dedicatedserver.halt(true);
|
||||
@@ -228,6 +288,7 @@
|
||||
@@ -254,6 +315,7 @@
|
||||
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
@@ -204,7 +205,7 @@
|
||||
} catch (Exception exception1) {
|
||||
Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1);
|
||||
}
|
||||
@@ -263,7 +324,7 @@
|
||||
@@ -290,7 +352,7 @@
|
||||
}
|
||||
|
||||
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, IRegistry<WorldDimension> iregistry) {
|
||||
|
||||
@@ -1,26 +1,25 @@
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -163,6 +163,30 @@
|
||||
@@ -165,13 +165,36 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.mojang.datafixers.util.Pair;
|
||||
+import com.mojang.serialization.DynamicOps;
|
||||
+import com.mojang.serialization.Dynamic;
|
||||
+import com.mojang.serialization.Lifecycle;
|
||||
+import java.util.Random;
|
||||
+import jline.console.ConsoleReader;
|
||||
+import joptsimple.OptionSet;
|
||||
+import net.minecraft.core.HolderLookup;
|
||||
+import net.minecraft.nbt.DynamicOpsNBT;
|
||||
+import net.minecraft.nbt.NBTBase;
|
||||
+import net.minecraft.resources.RegistryOps;
|
||||
+import net.minecraft.nbt.NbtException;
|
||||
+import net.minecraft.nbt.ReportedNbtException;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import net.minecraft.server.dedicated.DedicatedServerProperties;
|
||||
+import net.minecraft.util.datafix.DataConverterRegistry;
|
||||
+import net.minecraft.world.level.levelgen.WorldDimensions;
|
||||
+import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
+import net.minecraft.world.level.storage.LevelDataAndDimensions;
|
||||
+import net.minecraft.world.level.storage.WorldDataServer;
|
||||
+import net.minecraft.world.level.storage.WorldInfo;
|
||||
+import net.minecraft.world.level.validation.ContentValidationException;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
@@ -31,7 +30,15 @@
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ServerInfo, ICommandListener, AutoCloseable {
|
||||
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -247,6 +271,19 @@
|
||||
public static final String VANILLA_BRAND = "vanilla";
|
||||
private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F;
|
||||
private static final int TICK_STATS_SPAN = 100;
|
||||
- private static final long OVERLOADED_THRESHOLD_NANOS = 20L * TimeRange.NANOSECONDS_PER_SECOND / 20L;
|
||||
+ private static final long OVERLOADED_THRESHOLD_NANOS = 30L * TimeRange.NANOSECONDS_PER_SECOND / 20L; // CraftBukkit
|
||||
private static final int OVERLOADED_TICKS_THRESHOLD = 20;
|
||||
private static final long OVERLOADED_WARNING_INTERVAL_NANOS = 10L * TimeRange.NANOSECONDS_PER_SECOND;
|
||||
private static final int OVERLOADED_TICKS_WARNING_INTERVAL = 100;
|
||||
@@ -254,6 +277,19 @@
|
||||
protected SaveData worldData;
|
||||
private volatile boolean isSaving;
|
||||
|
||||
@@ -51,7 +58,7 @@
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
@@ -260,14 +297,14 @@
|
||||
@@ -267,14 +303,14 @@
|
||||
thread.setPriority(8);
|
||||
}
|
||||
|
||||
@@ -68,7 +75,7 @@
|
||||
super("Server");
|
||||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.getProfiler();
|
||||
@@ -286,7 +323,7 @@
|
||||
@@ -295,7 +331,7 @@
|
||||
this.customBossEvents = new BossBattleCustomData();
|
||||
this.registries = worldstem.registries();
|
||||
this.worldData = worldstem.worldData();
|
||||
@@ -77,7 +84,7 @@
|
||||
throw new IllegalStateException("Missing Overworld dimension data");
|
||||
} else {
|
||||
this.proxy = proxy;
|
||||
@@ -309,6 +346,33 @@
|
||||
@@ -319,6 +355,33 @@
|
||||
this.serverThread = thread;
|
||||
this.executor = SystemUtils.backgroundExecutor();
|
||||
}
|
||||
@@ -111,7 +118,7 @@
|
||||
}
|
||||
|
||||
private void readScoreboard(WorldPersistentData worldpersistentdata) {
|
||||
@@ -317,7 +381,7 @@
|
||||
@@ -327,7 +390,7 @@
|
||||
|
||||
protected abstract boolean initServer() throws IOException;
|
||||
|
||||
@@ -120,7 +127,7 @@
|
||||
if (!JvmProfiler.INSTANCE.isRunning()) {
|
||||
;
|
||||
}
|
||||
@@ -325,12 +389,8 @@
|
||||
@@ -335,12 +398,8 @@
|
||||
boolean flag = false;
|
||||
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
|
||||
|
||||
@@ -134,7 +141,7 @@
|
||||
if (profiledduration != null) {
|
||||
profiledduration.finish();
|
||||
}
|
||||
@@ -347,23 +407,179 @@
|
||||
@@ -357,23 +416,216 @@
|
||||
|
||||
protected void forceDifficulty() {}
|
||||
|
||||
@@ -223,17 +230,54 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ Dynamic<?> dynamic;
|
||||
+ if (worldSession.hasWorldData()) {
|
||||
+ WorldInfo worldinfo;
|
||||
+
|
||||
+ try {
|
||||
+ dynamic = worldSession.getDataTag();
|
||||
+ worldinfo = worldSession.getSummary(dynamic);
|
||||
+ } catch (NbtException | ReportedNbtException | IOException ioexception) {
|
||||
+ Convertable.b convertable_b = worldSession.getLevelDirectory();
|
||||
+
|
||||
+ MinecraftServer.LOGGER.warn("Failed to load world data from {}", convertable_b.dataFile(), ioexception);
|
||||
+ MinecraftServer.LOGGER.info("Attempting to use fallback");
|
||||
+
|
||||
+ try {
|
||||
+ dynamic = worldSession.getDataTagFallback();
|
||||
+ worldinfo = worldSession.getSummary(dynamic);
|
||||
+ } catch (NbtException | ReportedNbtException | IOException ioexception1) {
|
||||
+ MinecraftServer.LOGGER.error("Failed to load world data from {}", convertable_b.oldDataFile(), ioexception1);
|
||||
+ MinecraftServer.LOGGER.error("Failed to load world data from {} and {}. World files may be corrupted. Shutting down.", convertable_b.dataFile(), convertable_b.oldDataFile());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ worldSession.restoreLevelDataFromOld();
|
||||
+ }
|
||||
+
|
||||
+ if (worldinfo.requiresManualConversion()) {
|
||||
+ MinecraftServer.LOGGER.info("This world must be opened in an older version (like 1.6.4) to be safely converted");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!worldinfo.isCompatible()) {
|
||||
+ MinecraftServer.LOGGER.info("This world was created by an incompatible version.");
|
||||
+ return;
|
||||
+ }
|
||||
+ } else {
|
||||
+ dynamic = null;
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
|
||||
+ org.bukkit.generator.BiomeProvider biomeProvider = this.server.getBiomeProvider(name);
|
||||
+
|
||||
+ WorldDataServer worlddata;
|
||||
+ WorldLoader.a worldloader_a = this.worldLoader;
|
||||
+ IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
|
||||
+ DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) worldloader_a.datapackWorldgen());
|
||||
+ Pair<SaveData, WorldDimensions.b> pair = worldSession.getDataTag(dynamicops, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen().allRegistriesLifecycle());
|
||||
+ if (dynamic != null) {
|
||||
+ LevelDataAndDimensions leveldataanddimensions = Convertable.getLevelDataAndDimensions(dynamic, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen());
|
||||
+
|
||||
+ if (pair != null) {
|
||||
+ worlddata = (WorldDataServer) pair.getFirst();
|
||||
+ worlddata = (WorldDataServer) leveldataanddimensions.worldData();
|
||||
+ } else {
|
||||
+ WorldSettings worldsettings;
|
||||
+ WorldOptions worldoptions;
|
||||
@@ -328,7 +372,7 @@
|
||||
|
||||
if (!iworlddataserver.isInitialized()) {
|
||||
try {
|
||||
@@ -387,30 +603,8 @@
|
||||
@@ -397,30 +649,8 @@
|
||||
iworlddataserver.setInitialized(true);
|
||||
}
|
||||
|
||||
@@ -360,7 +404,7 @@
|
||||
|
||||
private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
|
||||
if (flag1) {
|
||||
@@ -418,6 +612,21 @@
|
||||
@@ -428,6 +658,21 @@
|
||||
} else {
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkproviderserver.randomState().sampler().findSpawnPosition());
|
||||
@@ -382,7 +426,7 @@
|
||||
int i = chunkproviderserver.getGenerator().getSpawnHeight(worldserver);
|
||||
|
||||
if (i < worldserver.getMinBuildHeight()) {
|
||||
@@ -477,8 +686,11 @@
|
||||
@@ -487,8 +732,11 @@
|
||||
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
|
||||
}
|
||||
|
||||
@@ -396,28 +440,28 @@
|
||||
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
@@ -487,19 +699,23 @@
|
||||
@@ -497,19 +745,23 @@
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
|
||||
this.nextTickTime = SystemUtils.getMillis();
|
||||
this.nextTickTimeNanos = SystemUtils.getNanos();
|
||||
- chunkproviderserver.addRegionTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver.getWorld().getKeepSpawnInMemory()) {
|
||||
+ chunkproviderserver.addRegionTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
|
||||
- while (chunkproviderserver.getTickingGenerated() != 441) {
|
||||
- this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
- this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
- this.waitUntilNextTick();
|
||||
+ while (chunkproviderserver.getTickingGenerated() != 441) {
|
||||
+ // this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
+ // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
+ this.executeModerately();
|
||||
+ }
|
||||
}
|
||||
|
||||
- this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
- this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
- this.waitUntilNextTick();
|
||||
- Iterator iterator = this.levels.values().iterator();
|
||||
+ // this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
+ // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
+ this.executeModerately();
|
||||
+ // Iterator iterator = this.levels.values().iterator();
|
||||
|
||||
@@ -429,14 +473,14 @@
|
||||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk.factory(), "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
@@ -514,10 +730,17 @@
|
||||
@@ -524,10 +776,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
- this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
- this.waitUntilNextTick();
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
+ // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
+ this.executeModerately();
|
||||
+ // CraftBukkit end
|
||||
worldloadlistener.stop();
|
||||
@@ -450,7 +494,7 @@
|
||||
}
|
||||
|
||||
public EnumGamemode getDefaultGameType() {
|
||||
@@ -547,12 +770,16 @@
|
||||
@@ -557,12 +816,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
|
||||
}
|
||||
|
||||
@@ -467,7 +511,7 @@
|
||||
if (flag1) {
|
||||
Iterator iterator1 = this.getAllLevels().iterator();
|
||||
|
||||
@@ -587,18 +814,40 @@
|
||||
@@ -597,18 +860,40 @@
|
||||
this.stopServer();
|
||||
}
|
||||
|
||||
@@ -508,34 +552,32 @@
|
||||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -686,15 +935,16 @@
|
||||
@@ -696,7 +981,7 @@
|
||||
}
|
||||
|
||||
this.nextTickTime = SystemUtils.getMillis();
|
||||
this.nextTickTimeNanos = SystemUtils.getNanos();
|
||||
- this.statusIcon = (ServerPing.a) this.loadStatusIcon().orElse((Object) null);
|
||||
+ this.statusIcon = (ServerPing.a) this.loadStatusIcon().orElse(null); // CraftBukkit - decompile error
|
||||
this.status = this.buildServerStatus();
|
||||
|
||||
while (this.running) {
|
||||
long i = SystemUtils.getMillis() - this.nextTickTime;
|
||||
@@ -713,6 +998,7 @@
|
||||
if (j > MinecraftServer.OVERLOADED_THRESHOLD_NANOS + 20L * i && this.nextTickTimeNanos - this.lastOverloadWarningNanos >= MinecraftServer.OVERLOADED_WARNING_INTERVAL_NANOS + 100L * i) {
|
||||
long k = j / i;
|
||||
|
||||
- if (i > 2000L && this.nextTickTime - this.lastOverloadWarning >= 15000L) {
|
||||
+ if (i > 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit
|
||||
long j = i / 50L;
|
||||
|
||||
+ if (server.getWarnOnOverload()) // CraftBukkit
|
||||
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
this.nextTickTime += j * 50L;
|
||||
this.lastOverloadWarning = this.nextTickTime;
|
||||
@@ -705,6 +955,7 @@
|
||||
+ if (server.getWarnOnOverload()) // CraftBukkit
|
||||
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", j / TimeRange.NANOSECONDS_PER_MILLISECOND, k);
|
||||
this.nextTickTimeNanos += k * i;
|
||||
this.lastOverloadWarningNanos = this.nextTickTimeNanos;
|
||||
@@ -726,6 +1012,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(SystemUtils.getNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
this.nextTickTime += 50L;
|
||||
this.nextTickTimeNanos += i;
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
@@ -743,6 +994,12 @@
|
||||
@@ -770,6 +1057,12 @@
|
||||
this.services.profileCache().clearExecutor();
|
||||
}
|
||||
|
||||
@@ -548,13 +590,13 @@
|
||||
this.onServerExit();
|
||||
}
|
||||
|
||||
@@ -776,7 +1033,14 @@
|
||||
@@ -803,7 +1096,14 @@
|
||||
}
|
||||
|
||||
private boolean haveTime() {
|
||||
- return this.runningTask() || SystemUtils.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
- return this.runningTask() || SystemUtils.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
|
||||
+ // CraftBukkit start
|
||||
+ return this.forceTicks || this.runningTask() || SystemUtils.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ return this.forceTicks || this.runningTask() || SystemUtils.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
|
||||
+ }
|
||||
+
|
||||
+ private void executeModerately() {
|
||||
@@ -564,7 +606,7 @@
|
||||
}
|
||||
|
||||
protected void waitUntilNextTick() {
|
||||
@@ -823,7 +1087,7 @@
|
||||
@@ -850,7 +1150,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,16 +615,20 @@
|
||||
this.getProfiler().incrementCounter("runTask");
|
||||
super.doRunTask(ticktask);
|
||||
}
|
||||
@@ -876,7 +1140,7 @@
|
||||
this.status = this.buildServerStatus();
|
||||
@@ -909,8 +1209,10 @@
|
||||
}
|
||||
|
||||
- if (this.tickCount % 6000 == 0) {
|
||||
+ if (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0) { // CraftBukkit
|
||||
--this.ticksUntilAutosave;
|
||||
- if (this.ticksUntilAutosave <= 0) {
|
||||
- this.ticksUntilAutosave = this.computeNextAutosaveInterval();
|
||||
+ // CraftBukkit start
|
||||
+ if (this.autosavePeriod > 0 && this.ticksUntilAutosave <= 0) {
|
||||
+ this.ticksUntilAutosave = this.autosavePeriod;
|
||||
+ // CraftBukkit end
|
||||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.profiler.push("save");
|
||||
this.saveEverything(true, false, false);
|
||||
@@ -928,22 +1192,39 @@
|
||||
@@ -991,22 +1293,39 @@
|
||||
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
|
||||
entityplayer.connection.suspendFlushing();
|
||||
});
|
||||
@@ -622,7 +668,7 @@
|
||||
|
||||
this.profiler.push("tick");
|
||||
|
||||
@@ -1033,6 +1314,22 @@
|
||||
@@ -1096,6 +1415,22 @@
|
||||
return (WorldServer) this.levels.get(resourcekey);
|
||||
}
|
||||
|
||||
@@ -645,7 +691,7 @@
|
||||
public Set<ResourceKey<World>> levelKeys() {
|
||||
return this.levels.keySet();
|
||||
}
|
||||
@@ -1062,7 +1359,7 @@
|
||||
@@ -1125,7 +1460,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@@ -654,7 +700,7 @@
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport systemreport) {
|
||||
@@ -1403,11 +1700,11 @@
|
||||
@@ -1466,11 +1801,11 @@
|
||||
public CompletableFuture<Void> reloadResources(Collection<String> collection) {
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE);
|
||||
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
|
||||
@@ -668,7 +714,7 @@
|
||||
}, this).thenCompose((immutablelist) -> {
|
||||
ResourceManager resourcemanager = new ResourceManager(EnumResourcePackType.SERVER_DATA, immutablelist);
|
||||
|
||||
@@ -1422,6 +1719,7 @@
|
||||
@@ -1485,6 +1820,7 @@
|
||||
}).thenAcceptAsync((minecraftserver_reloadableresources) -> {
|
||||
this.resources.close();
|
||||
this.resources = minecraftserver_reloadableresources;
|
||||
@@ -676,7 +722,7 @@
|
||||
this.packRepository.setSelected(collection);
|
||||
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository), this.worldData.enabledFeatures());
|
||||
|
||||
@@ -1778,7 +2076,7 @@
|
||||
@@ -1853,7 +2189,7 @@
|
||||
try {
|
||||
label51:
|
||||
{
|
||||
@@ -685,7 +731,7 @@
|
||||
|
||||
try {
|
||||
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
|
||||
@@ -1828,6 +2126,22 @@
|
||||
@@ -1903,6 +2239,22 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -708,7 +754,7 @@
|
||||
private void startMetricsRecordingTick() {
|
||||
if (this.willStartRecordingMetrics) {
|
||||
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
|
||||
@@ -1954,6 +2268,11 @@
|
||||
@@ -2029,6 +2381,11 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,83 +1,83 @@
|
||||
--- a/net/minecraft/server/ScoreboardServer.java
|
||||
+++ b/net/minecraft/server/ScoreboardServer.java
|
||||
@@ -37,7 +37,7 @@
|
||||
public void onScoreChanged(ScoreboardScore scoreboardscore) {
|
||||
super.onScoreChanged(scoreboardscore);
|
||||
if (this.trackedObjectives.contains(scoreboardscore.getObjective())) {
|
||||
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getOwner(), scoreboardscore.getScore()));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getOwner(), scoreboardscore.getScore()));
|
||||
@@ -40,7 +40,7 @@
|
||||
protected void onScoreChanged(ScoreHolder scoreholder, ScoreboardObjective scoreboardobjective, ScoreboardScore scoreboardscore) {
|
||||
super.onScoreChanged(scoreholder, scoreboardobjective, scoreboardscore);
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(scoreholder.getScoreboardName(), scoreboardobjective.getName(), scoreboardscore.value(), scoreboardscore.display(), scoreboardscore.numberFormat()));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardScore(scoreholder.getScoreboardName(), scoreboardobjective.getName(), scoreboardscore.value(), scoreboardscore.display(), scoreboardscore.numberFormat())); // CraftBukkit
|
||||
}
|
||||
|
||||
this.setDirty();
|
||||
@@ -46,7 +46,7 @@
|
||||
@@ -55,7 +55,7 @@
|
||||
@Override
|
||||
public void onPlayerRemoved(String s) {
|
||||
super.onPlayerRemoved(s);
|
||||
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
||||
public void onPlayerRemoved(ScoreHolder scoreholder) {
|
||||
super.onPlayerRemoved(scoreholder);
|
||||
- this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), (String) null));
|
||||
+ this.broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), (String) null)); // CraftBukkit
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
public void onPlayerScoreRemoved(String s, ScoreboardObjective scoreboardobjective) {
|
||||
super.onPlayerScoreRemoved(s, scoreboardobjective);
|
||||
@@ -63,7 +63,7 @@
|
||||
public void onPlayerScoreRemoved(ScoreHolder scoreholder, ScoreboardObjective scoreboardobjective) {
|
||||
super.onPlayerScoreRemoved(scoreholder, scoreboardobjective);
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
||||
- this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), scoreboardobjective.getName()));
|
||||
+ this.broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), scoreboardobjective.getName())); // CraftBukkit
|
||||
}
|
||||
|
||||
this.setDirty();
|
||||
@@ -67,7 +67,7 @@
|
||||
@@ -76,7 +76,7 @@
|
||||
super.setDisplayObjective(displayslot, scoreboardobjective);
|
||||
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
|
||||
if (this.getObjectiveDisplaySlotCount(scoreboardobjective1) > 0) {
|
||||
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective)); // CraftBukkit
|
||||
} else {
|
||||
this.stopTrackingObjective(scoreboardobjective1);
|
||||
}
|
||||
@@ -75,7 +75,7 @@
|
||||
@@ -84,7 +84,7 @@
|
||||
|
||||
if (scoreboardobjective != null) {
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective)); // CraftBukkit
|
||||
} else {
|
||||
this.startTrackingObjective(scoreboardobjective);
|
||||
}
|
||||
@@ -87,7 +87,7 @@
|
||||
@@ -96,7 +96,7 @@
|
||||
@Override
|
||||
public boolean addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) {
|
||||
if (super.addPlayerToTeam(s, scoreboardteam)) {
|
||||
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD)); // CraftBukkit
|
||||
this.setDirty();
|
||||
return true;
|
||||
} else {
|
||||
@@ -98,7 +98,7 @@
|
||||
@@ -107,7 +107,7 @@
|
||||
@Override
|
||||
public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) {
|
||||
super.removePlayerFromTeam(s, scoreboardteam);
|
||||
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE)); // CraftBukkit
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
@@ -121,7 +121,7 @@
|
||||
public void onObjectiveChanged(ScoreboardObjective scoreboardobjective) {
|
||||
super.onObjectiveChanged(scoreboardobjective);
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2)); // CraftBukkit
|
||||
}
|
||||
|
||||
this.setDirty();
|
||||
@@ -131,21 +131,21 @@
|
||||
@@ -140,21 +140,21 @@
|
||||
@Override
|
||||
public void onTeamAdded(ScoreboardTeam scoreboardteam) {
|
||||
super.onTeamAdded(scoreboardteam);
|
||||
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true)); // CraftBukkit
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
public void onTeamChanged(ScoreboardTeam scoreboardteam) {
|
||||
super.onTeamChanged(scoreboardteam);
|
||||
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, false));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, false));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, false)); // CraftBukkit
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@
|
||||
public void onTeamRemoved(ScoreboardTeam scoreboardteam) {
|
||||
super.onTeamRemoved(scoreboardteam);
|
||||
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam));
|
||||
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam)); // CraftBukkit
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -196,6 +196,7 @@
|
||||
@@ -205,6 +205,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
@@ -105,7 +105,7 @@
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -232,6 +233,7 @@
|
||||
@@ -241,6 +242,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
@@ -113,7 +113,7 @@
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -276,6 +278,16 @@
|
||||
@@ -285,6 +287,16 @@
|
||||
return this.createData().load(nbttagcompound);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/server/commands/CommandSchedule.java
|
||||
+++ b/net/minecraft/server/commands/CommandSchedule.java
|
||||
@@ -56,7 +56,7 @@
|
||||
@@ -55,7 +55,7 @@
|
||||
} else {
|
||||
long j = commandlistenerwrapper.getLevel().getGameTime() + (long) i;
|
||||
MinecraftKey minecraftkey = (MinecraftKey) pair.getFirst();
|
||||
- CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = commandlistenerwrapper.getServer().getWorldData().overworldData().getScheduledEvents();
|
||||
+ CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = commandlistenerwrapper.getLevel().serverLevelData.overworldData().getScheduledEvents(); // CraftBukkit - SPIGOT-6667: Use world specific function timer
|
||||
|
||||
((Either) pair.getSecond()).ifLeft((customfunction) -> {
|
||||
((Either) pair.getSecond()).ifLeft((net_minecraft_commands_functions_commandfunction) -> {
|
||||
String s = minecraftkey.toString();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
@@ -92,7 +92,7 @@
|
||||
@@ -93,7 +93,7 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
set.add(entity.getTeam());
|
||||
} else {
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
@@ -203,7 +203,7 @@
|
||||
commandspreadplayers_a = acommandspreadplayers_a[j++];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/CommandTrigger.java
|
||||
+++ b/net/minecraft/server/commands/CommandTrigger.java
|
||||
@@ -96,7 +96,7 @@
|
||||
if (scoreboardobjective.getCriteria() != IScoreboardCriteria.TRIGGER) {
|
||||
throw CommandTrigger.ERROR_INVALID_OBJECTIVE.create();
|
||||
} else {
|
||||
- Scoreboard scoreboard = entityplayer.getScoreboard();
|
||||
+ Scoreboard scoreboard = entityplayer.getServer().getScoreboard(); // CraftBukkit - SPIGOT-6917: use main scoreboard
|
||||
String s = entityplayer.getScoreboardName();
|
||||
|
||||
if (!scoreboard.hasPlayerScore(s, scoreboardobjective)) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -45,11 +45,16 @@
|
||||
@@ -44,11 +44,16 @@
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
public final boolean onlineMode = this.get("online-mode", true);
|
||||
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
|
||||
public final String serverIp = this.get("server-ip", "");
|
||||
@@ -104,8 +109,10 @@
|
||||
@@ -103,8 +108,10 @@
|
||||
private final DedicatedServerProperties.WorldDimensionData worldDimensionData;
|
||||
public final WorldOptions worldOptions;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
this.difficulty = (EnumDifficulty) this.get("difficulty", dispatchNumberOrString(EnumDifficulty::byId, EnumDifficulty::byName), EnumDifficulty::getKey, EnumDifficulty.EASY);
|
||||
this.gamemode = (EnumGamemode) this.get("gamemode", dispatchNumberOrString(EnumGamemode::byId, EnumGamemode::byName), EnumGamemode::getName, EnumGamemode.SURVIVAL);
|
||||
this.levelName = this.get("level-name", "world");
|
||||
@@ -162,13 +169,15 @@
|
||||
@@ -161,13 +168,15 @@
|
||||
this.initialDataPackConfiguration = getDatapackConfig(this.get("initial-enabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getEnabled())), this.get("initial-disabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getDisabled())));
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -249,10 +258,10 @@
|
||||
@@ -248,10 +257,10 @@
|
||||
}).orElseThrow(() -> {
|
||||
return new IllegalStateException("Invalid datapack contents: can't find default preset");
|
||||
});
|
||||
@@ -63,7 +63,7 @@
|
||||
});
|
||||
|
||||
Objects.requireNonNull(iregistry);
|
||||
@@ -264,7 +273,7 @@
|
||||
@@ -263,7 +272,7 @@
|
||||
|
||||
if (holder.is(WorldPresets.FLAT)) {
|
||||
RegistryOps<JsonElement> registryops = RegistryOps.create(JsonOps.INSTANCE, (HolderLookup.b) iregistrycustom);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/ChunkProviderServer.java
|
||||
+++ b/net/minecraft/server/level/ChunkProviderServer.java
|
||||
@@ -85,6 +85,16 @@
|
||||
@@ -83,6 +83,16 @@
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
@Override
|
||||
public LightEngineThreaded getLightEngine() {
|
||||
return this.lightEngine;
|
||||
@@ -129,7 +139,7 @@
|
||||
@@ -127,7 +137,7 @@
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
|
||||
ichunkaccess = this.lastChunk[l];
|
||||
@@ -26,7 +26,7 @@
|
||||
return ichunkaccess;
|
||||
}
|
||||
}
|
||||
@@ -177,12 +187,12 @@
|
||||
@@ -175,12 +185,12 @@
|
||||
if (playerchunk == null) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
if (ichunkaccess1 != null) {
|
||||
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
|
||||
@@ -230,7 +240,15 @@
|
||||
@@ -228,7 +238,15 @@
|
||||
int l = ChunkLevel.byStatus(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
if (this.chunkAbsent(playerchunk, l)) {
|
||||
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
||||
@@ -249,7 +267,7 @@
|
||||
@@ -247,7 +265,7 @@
|
||||
}
|
||||
|
||||
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -317,7 +335,7 @@
|
||||
@@ -315,7 +333,7 @@
|
||||
} else if (!this.level.shouldTickBlocksAt(i)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
return either != null && either.left().isPresent();
|
||||
}
|
||||
@@ -330,11 +348,31 @@
|
||||
@@ -328,11 +346,31 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
@@ -109,25 +109,21 @@
|
||||
@Override
|
||||
public void tick(BooleanSupplier booleansupplier, boolean flag) {
|
||||
this.level.getProfiler().push("purge");
|
||||
@@ -366,7 +404,7 @@
|
||||
@@ -379,11 +417,11 @@
|
||||
|
||||
gameprofilerfiller.push("pollingChunks");
|
||||
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||
- boolean flag1 = worlddata.getGameTime() % 400L == 0L;
|
||||
+ boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
||||
this.lastSpawnState = spawnercreature_d;
|
||||
gameprofilerfiller.popPush("spawnAndTick");
|
||||
- boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING);
|
||||
+ boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
||||
|
||||
gameprofilerfiller.push("naturalSpawnCount");
|
||||
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
||||
@@ -387,7 +425,7 @@
|
||||
}
|
||||
SystemUtils.shuffle(list, this.level.random);
|
||||
int l = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||
- boolean flag1 = this.level.getLevelData().getGameTime() % 400L == 0L;
|
||||
+ boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
gameprofilerfiller.popPush("spawnAndTick");
|
||||
- boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING);
|
||||
+ boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !level.players().isEmpty(); // CraftBukkit
|
||||
|
||||
Collections.shuffle(list);
|
||||
Iterator iterator1 = list.iterator();
|
||||
@@ -592,13 +630,19 @@
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -586,13 +624,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -151,6 +151,37 @@
|
||||
@@ -157,6 +157,38 @@
|
||||
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.util.CraftDimensionUtil;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.entity.EntityExhaustionEvent;
|
||||
+import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||
+import org.bukkit.event.player.PlayerChangedMainHandEvent;
|
||||
+import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
@@ -38,7 +39,7 @@
|
||||
public class EntityPlayer extends EntityHuman {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -185,7 +216,7 @@
|
||||
@@ -192,7 +224,7 @@
|
||||
private int levitationStartTime;
|
||||
private boolean disconnected;
|
||||
private int requestedViewDistance;
|
||||
@@ -47,7 +48,7 @@
|
||||
@Nullable
|
||||
private Vec3D startingToFallPosition;
|
||||
@Nullable
|
||||
@@ -210,6 +241,20 @@
|
||||
@@ -217,6 +249,20 @@
|
||||
private int containerCounter;
|
||||
public boolean wonGame;
|
||||
|
||||
@@ -68,7 +69,7 @@
|
||||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, ClientInformation clientinformation) {
|
||||
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
|
||||
this.chatVisibility = EnumChatVisibility.FULL;
|
||||
@@ -276,12 +321,56 @@
|
||||
@@ -283,12 +329,56 @@
|
||||
this.setMaxUpStep(1.0F);
|
||||
this.fudgeSpawnLocation(worldserver);
|
||||
this.updateOptions(clientinformation);
|
||||
@@ -77,8 +78,8 @@
|
||||
+ this.displayName = this.getScoreboardName();
|
||||
+ this.bukkitPickUpLoot = true;
|
||||
+ this.maxHealthCache = this.getMaxHealth();
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now.
|
||||
+ // If this is an issue, PRs are welcome
|
||||
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) {
|
||||
@@ -115,9 +116,9 @@
|
||||
+ }
|
||||
+
|
||||
+ return blockposition;
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
private void fudgeSpawnLocation(WorldServer worldserver) {
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
|
||||
@@ -126,7 +127,7 @@
|
||||
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -330,7 +419,7 @@
|
||||
@@ -337,7 +427,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
|
||||
@@ -135,7 +136,7 @@
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -349,17 +438,26 @@
|
||||
@@ -356,17 +446,26 @@
|
||||
if (nbttagcompound.contains("recipeBook", 10)) {
|
||||
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
|
||||
}
|
||||
@@ -163,7 +164,7 @@
|
||||
Logger logger1 = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -372,7 +470,7 @@
|
||||
@@ -379,7 +478,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -172,7 +173,7 @@
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -393,7 +491,20 @@
|
||||
@@ -400,7 +499,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
@@ -194,7 +195,7 @@
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -418,8 +529,32 @@
|
||||
@@ -425,8 +537,32 @@
|
||||
nbttagcompound.put("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
@@ -227,7 +228,7 @@
|
||||
|
||||
public void setExperiencePoints(int i) {
|
||||
float f = (float) this.getXpNeededForNextLevel();
|
||||
@@ -479,6 +614,11 @@
|
||||
@@ -486,6 +622,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -239,7 +240,7 @@
|
||||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
@@ -535,7 +675,7 @@
|
||||
@@ -542,7 +683,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
|
||||
@@ -248,7 +249,7 @@
|
||||
this.lastSentHealth = this.getHealth();
|
||||
this.lastSentFood = this.foodData.getFoodLevel();
|
||||
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -566,6 +706,12 @@
|
||||
@@ -573,6 +714,12 @@
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
|
||||
}
|
||||
|
||||
@@ -261,7 +262,7 @@
|
||||
if (this.experienceLevel != this.lastRecordedLevel) {
|
||||
this.lastRecordedLevel = this.experienceLevel;
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
|
||||
@@ -580,6 +726,20 @@
|
||||
@@ -587,6 +734,20 @@
|
||||
CriterionTriggers.LOCATION.trigger(this);
|
||||
}
|
||||
|
||||
@@ -282,17 +283,17 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
|
||||
@@ -622,7 +782,8 @@
|
||||
@@ -629,7 +790,8 @@
|
||||
}
|
||||
|
||||
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
- this.getScoreboard().forAllObjectives(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
- this.getScoreboard().forAllObjectives(iscoreboardcriteria, this, (scoreaccess) -> {
|
||||
+ // CraftBukkit - Use our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
scoreboardscore.setScore(i);
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(iscoreboardcriteria, this, (scoreaccess) -> {
|
||||
scoreaccess.set(i);
|
||||
});
|
||||
}
|
||||
@@ -631,9 +792,47 @@
|
||||
@@ -638,9 +800,47 @@
|
||||
public void die(DamageSource damagesource) {
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
@@ -342,7 +343,7 @@
|
||||
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
boolean flag1 = true;
|
||||
@@ -664,12 +863,18 @@
|
||||
@@ -671,12 +871,18 @@
|
||||
if (this.level().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
this.tellNeutralMobsThatIDied();
|
||||
}
|
||||
@@ -356,41 +357,41 @@
|
||||
+ this.getInventory().clearContent();
|
||||
}
|
||||
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.DEATH_COUNT, this.getScoreboardName(), ScoreboardScore::increment);
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.DEATH_COUNT, this, ScoreAccess::increment);
|
||||
+ this.setCamera(this); // Remove spectated target
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getScoreboardName(), ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(IScoreboardCriteria.DEATH_COUNT, this, ScoreAccess::increment);
|
||||
EntityLiving entityliving = this.getKillCredit();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -707,10 +912,12 @@
|
||||
String s = this.getScoreboardName();
|
||||
String s1 = entity.getScoreboardName();
|
||||
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
|
||||
@@ -711,10 +917,12 @@
|
||||
if (entity != this) {
|
||||
super.awardKillScore(entity, i, damagesource);
|
||||
this.increaseScore(i);
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, this, ScoreAccess::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, this, ScoreAccess::increment);
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.awardStat(StatisticList.PLAYER_KILLS);
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_PLAYERS, this, ScoreAccess::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(IScoreboardCriteria.KILL_COUNT_PLAYERS, this, ScoreAccess::increment);
|
||||
} else {
|
||||
this.awardStat(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -728,7 +935,8 @@
|
||||
@@ -732,7 +940,8 @@
|
||||
int i = scoreboardteam.getColor().getId();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
- this.getScoreboard().forAllObjectives(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
|
||||
- this.getScoreboard().forAllObjectives(aiscoreboardcriteria[i], scoreholder, ScoreAccess::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(aiscoreboardcriteria[i], scoreholder, ScoreAccess::increment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -778,18 +986,20 @@
|
||||
@@ -782,18 +991,20 @@
|
||||
}
|
||||
|
||||
private boolean isPvpAllowed() {
|
||||
@@ -414,7 +415,7 @@
|
||||
} else {
|
||||
return shapedetectorshape;
|
||||
}
|
||||
@@ -798,11 +1008,20 @@
|
||||
@@ -802,11 +1013,20 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
@@ -438,7 +439,7 @@
|
||||
this.unRide();
|
||||
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.wonGame) {
|
||||
@@ -813,6 +1032,8 @@
|
||||
@@ -817,6 +1037,8 @@
|
||||
|
||||
return this;
|
||||
} else {
|
||||
@@ -447,7 +448,7 @@
|
||||
WorldData worlddata = worldserver.getLevelData();
|
||||
|
||||
this.connection.send(new PacketPlayOutRespawn(this.createCommonSpawnInfo(worldserver), (byte) 3));
|
||||
@@ -822,20 +1043,50 @@
|
||||
@@ -826,20 +1048,50 @@
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
@@ -503,7 +504,7 @@
|
||||
this.connection.resetPosition();
|
||||
worldserver.addDuringPortalTeleport(this);
|
||||
worldserver1.getProfiler().pop();
|
||||
@@ -855,39 +1106,66 @@
|
||||
@@ -859,39 +1111,66 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
@@ -576,7 +577,7 @@
|
||||
}
|
||||
|
||||
return optional1;
|
||||
@@ -897,13 +1175,21 @@
|
||||
@@ -901,13 +1180,21 @@
|
||||
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
|
||||
ResourceKey<World> resourcekey = worldserver.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level().dimension();
|
||||
@@ -601,7 +602,7 @@
|
||||
this.enteredNetherPosition = null;
|
||||
}
|
||||
|
||||
@@ -920,19 +1206,17 @@
|
||||
@@ -924,19 +1211,17 @@
|
||||
this.containerMenu.broadcastChanges();
|
||||
}
|
||||
|
||||
@@ -625,7 +626,7 @@
|
||||
if (this.level().isDay()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_NOW);
|
||||
} else {
|
||||
@@ -949,7 +1233,36 @@
|
||||
@@ -953,7 +1238,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -663,7 +664,7 @@
|
||||
this.awardStat(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
@@ -962,9 +1275,8 @@
|
||||
@@ -966,9 +1280,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
@@ -674,7 +675,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -991,13 +1303,31 @@
|
||||
@@ -995,13 +1308,31 @@
|
||||
|
||||
@Override
|
||||
public void stopSleepInBed(boolean flag, boolean flag1) {
|
||||
@@ -707,7 +708,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1039,8 +1369,9 @@
|
||||
@@ -1051,8 +1382,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos(), flag));
|
||||
}
|
||||
|
||||
@@ -718,7 +719,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1048,13 +1379,35 @@
|
||||
@@ -1060,13 +1392,35 @@
|
||||
if (itileinventory == null) {
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@@ -754,7 +755,7 @@
|
||||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
|
||||
@@ -1062,9 +1415,11 @@
|
||||
@@ -1074,9 +1428,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@@ -768,7 +769,7 @@
|
||||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -1077,13 +1432,24 @@
|
||||
@@ -1089,13 +1445,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@@ -795,7 +796,7 @@
|
||||
this.initMenu(this.containerMenu);
|
||||
}
|
||||
|
||||
@@ -1106,6 +1472,7 @@
|
||||
@@ -1118,6 +1485,7 @@
|
||||
|
||||
@Override
|
||||
public void closeContainer() {
|
||||
@@ -803,7 +804,7 @@
|
||||
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||
this.doCloseContainer();
|
||||
}
|
||||
@@ -1128,6 +1495,16 @@
|
||||
@@ -1140,6 +1508,16 @@
|
||||
}
|
||||
|
||||
this.jumping = flag;
|
||||
@@ -820,34 +821,65 @@
|
||||
this.setShiftKeyDown(flag1);
|
||||
}
|
||||
|
||||
@@ -1136,7 +1513,7 @@
|
||||
@@ -1173,19 +1551,19 @@
|
||||
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(StatisticList.SWIM_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SWIM); // CraftBukkit - EntityExhaustionEvent
|
||||
}
|
||||
} else if (this.isEyeInFluid(TagsFluid.WATER)) {
|
||||
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(StatisticList.WALK_UNDER_WATER_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_UNDERWATER); // CraftBukkit - EntityExhaustionEvent
|
||||
}
|
||||
} else if (this.isInWater()) {
|
||||
i = Math.round((float) Math.sqrt(d0 * d0 + d2 * d2) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(StatisticList.WALK_ON_WATER_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_ON_WATER); // CraftBukkit - EntityExhaustionEvent
|
||||
}
|
||||
} else if (this.onClimbable()) {
|
||||
if (d1 > 0.0D) {
|
||||
@@ -1196,13 +1574,13 @@
|
||||
if (i > 0) {
|
||||
if (this.isSprinting()) {
|
||||
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.1F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.1F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SPRINT); // CraftBukkit - EntityExhaustionEvent
|
||||
} else if (this.isCrouching()) {
|
||||
this.awardStat(StatisticList.CROUCH_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.CROUCH); // CraftBukkit - EntityExhaustionEvent
|
||||
} else {
|
||||
this.awardStat(StatisticList.WALK_ONE_CM, i);
|
||||
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
|
||||
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK); // CraftBukkit - EntityExhaustionEvent
|
||||
}
|
||||
}
|
||||
} else if (this.isFallFlying()) {
|
||||
@@ -1245,7 +1623,7 @@
|
||||
@Override
|
||||
public void awardStat(Statistic<?> statistic, int i) {
|
||||
this.stats.increment(this, statistic, i);
|
||||
- this.getScoreboard().forAllObjectives(statistic, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
|
||||
scoreboardscore.add(i);
|
||||
- this.getScoreboard().forAllObjectives(statistic, this, (scoreaccess) -> {
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(statistic, this, (scoreaccess) -> {
|
||||
scoreaccess.add(i);
|
||||
});
|
||||
}
|
||||
@@ -1144,7 +1521,7 @@
|
||||
@@ -1253,7 +1631,7 @@
|
||||
@Override
|
||||
public void resetStat(Statistic<?> statistic) {
|
||||
this.stats.setValue(this, statistic, 0);
|
||||
- this.getScoreboard().forAllObjectives(statistic, this.getScoreboardName(), ScoreboardScore::reset);
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), ScoreboardScore::reset); // CraftBukkit - Get our scores instead
|
||||
- this.getScoreboard().forAllObjectives(statistic, this, ScoreAccess::reset);
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(statistic, this, ScoreAccess::reset); // CraftBukkit - Get our scores instead
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1165,7 +1542,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
MinecraftKey minecraftkey = aminecraftkey1[j];
|
||||
- Optional optional = this.server.getRecipeManager().byKey(minecraftkey);
|
||||
+ Optional<? extends RecipeHolder<?>> optional = this.server.getRecipeManager().byKey(minecraftkey); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -1200,6 +1577,7 @@
|
||||
@@ -1301,6 +1679,7 @@
|
||||
|
||||
public void resetSentInfo() {
|
||||
this.lastSentHealth = -1.0E8F;
|
||||
@@ -855,7 +887,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1257,7 +1635,7 @@
|
||||
@@ -1358,7 +1737,7 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
@@ -864,7 +896,7 @@
|
||||
this.seenCredits = entityplayer.seenCredits;
|
||||
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
|
||||
this.chunkTrackingView = entityplayer.chunkTrackingView;
|
||||
@@ -1308,6 +1686,12 @@
|
||||
@@ -1409,6 +1788,12 @@
|
||||
|
||||
@Override
|
||||
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
|
||||
@@ -877,7 +909,7 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
|
||||
|
||||
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
|
||||
@@ -1317,9 +1701,9 @@
|
||||
@@ -1418,9 +1803,9 @@
|
||||
}
|
||||
|
||||
if (worldserver == this.level()) {
|
||||
@@ -889,7 +921,7 @@
|
||||
}
|
||||
|
||||
this.setYHeadRot(f);
|
||||
@@ -1423,6 +1807,16 @@
|
||||
@@ -1524,6 +1909,16 @@
|
||||
}
|
||||
|
||||
public void updateOptions(ClientInformation clientinformation) {
|
||||
@@ -906,7 +938,7 @@
|
||||
this.language = clientinformation.language();
|
||||
this.requestedViewDistance = clientinformation.viewDistance();
|
||||
this.chatVisibility = clientinformation.chatVisibility();
|
||||
@@ -1506,7 +1900,7 @@
|
||||
@@ -1607,7 +2002,7 @@
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
@@ -915,7 +947,7 @@
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
@@ -1543,7 +1937,7 @@
|
||||
@@ -1644,7 +2039,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getTabListDisplayName() {
|
||||
@@ -924,7 +956,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1564,9 +1958,16 @@
|
||||
@@ -1665,9 +2060,16 @@
|
||||
return this.advancements;
|
||||
}
|
||||
|
||||
@@ -941,7 +973,7 @@
|
||||
if (worldserver == this.level()) {
|
||||
this.connection.teleport(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1586,6 +1987,9 @@
|
||||
@@ -1687,6 +2089,9 @@
|
||||
this.server.getPlayerList().sendLevelInfo(this, worldserver);
|
||||
this.server.getPlayerList().sendAllPlayerInfo(this);
|
||||
}
|
||||
@@ -951,7 +983,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1607,6 +2011,32 @@
|
||||
@@ -1708,6 +2113,32 @@
|
||||
}
|
||||
|
||||
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
||||
@@ -984,7 +1016,7 @@
|
||||
if (blockposition != null) {
|
||||
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
|
||||
|
||||
@@ -1812,4 +2242,146 @@
|
||||
@@ -1913,4 +2344,146 @@
|
||||
public CommonPlayerSpawnInfo createCommonSpawnInfo(WorldServer worldserver) {
|
||||
return new CommonPlayerSpawnInfo(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), this.getLastDeathLocation(), this.getPortalCooldown());
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
+ org.bukkit.block.BlockState state = bblock.getState();
|
||||
+ level.captureDrops = new ArrayList<>();
|
||||
+ // CraftBukkit end
|
||||
block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
|
||||
IBlockData iblockdata1 = block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
|
||||
boolean flag = this.level.removeBlock(blockposition, false);
|
||||
|
||||
@@ -256,19 +399,32 @@
|
||||
@@ -238,12 +238,12 @@
|
||||
} else {
|
||||
ItemStack itemstack = this.player.getMainHandItem();
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
boolean flag1 = this.player.hasCorrectToolForDrops(iblockdata);
|
||||
boolean flag1 = this.player.hasCorrectToolForDrops(iblockdata1);
|
||||
|
||||
itemstack.mineBlock(this.level, iblockdata, blockposition, this.player);
|
||||
itemstack.mineBlock(this.level, iblockdata1, blockposition, this.player);
|
||||
- if (flag && flag1) {
|
||||
+ if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items
|
||||
block.playerDestroy(this.level, this.player, blockposition, iblockdata, tileentity, itemstack1);
|
||||
block.playerDestroy(this.level, this.player, blockposition, iblockdata1, tileentity, itemstack1);
|
||||
}
|
||||
|
||||
- return true;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -162,6 +162,26 @@
|
||||
@@ -164,6 +164,26 @@
|
||||
import net.minecraft.world.ticks.TickListServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -175,7 +195,7 @@
|
||||
@@ -177,7 +197,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
@@ -36,7 +36,7 @@
|
||||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
private final GameEventDispatcher gameEventDispatcher;
|
||||
@@ -200,12 +220,30 @@
|
||||
@@ -202,12 +222,30 @@
|
||||
private final boolean tickTime;
|
||||
private final RandomSequences randomSequences;
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -219,6 +257,22 @@
|
||||
@@ -221,6 +259,22 @@
|
||||
this.customSpawners = list;
|
||||
this.serverLevelData = iworlddataserver;
|
||||
ChunkGenerator chunkgenerator = worlddimension.generator();
|
||||
@@ -95,7 +95,7 @@
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -246,9 +300,9 @@
|
||||
@@ -248,9 +302,9 @@
|
||||
long l = minecraftserver.getWorldData().worldGenOptions().seed();
|
||||
|
||||
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
|
||||
@@ -108,7 +108,7 @@
|
||||
} else {
|
||||
this.dragonFight = null;
|
||||
}
|
||||
@@ -258,6 +312,7 @@
|
||||
@@ -260,6 +314,7 @@
|
||||
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
|
||||
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
|
||||
});
|
||||
@@ -116,7 +116,7 @@
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
@@ -296,12 +351,20 @@
|
||||
@@ -304,12 +359,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
@@ -140,25 +140,25 @@
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -327,7 +390,7 @@
|
||||
this.runBlockEvents();
|
||||
@@ -344,7 +407,7 @@
|
||||
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
- boolean flag = !this.players.isEmpty() || !this.getForcedChunks().isEmpty();
|
||||
+ boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
||||
- boolean flag1 = !this.players.isEmpty() || !this.getForcedChunks().isEmpty();
|
||||
+ boolean flag1 = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
||||
|
||||
if (flag) {
|
||||
if (flag1) {
|
||||
this.resetEmptyTime();
|
||||
@@ -343,7 +406,7 @@
|
||||
@@ -360,7 +423,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
- if (this.shouldDiscardEntity(entity)) {
|
||||
+ if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
||||
entity.discard();
|
||||
} else {
|
||||
} else if (!tickratemanager.isEntityFrozen(entity)) {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -415,7 +478,7 @@
|
||||
@@ -432,7 +495,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
@@ -167,7 +167,7 @@
|
||||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -442,7 +505,7 @@
|
||||
@@ -459,7 +522,7 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
@@ -176,7 +176,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +514,7 @@
|
||||
@@ -468,7 +531,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setVisualOnly(flag1);
|
||||
@@ -185,7 +185,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -506,7 +569,7 @@
|
||||
@@ -524,7 +587,7 @@
|
||||
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition1).value();
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition2)) {
|
||||
@@ -193,8 +193,8 @@
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition2, Blocks.ICE.defaultBlockState(), null); // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -522,10 +585,10 @@
|
||||
if (this.isRaining()) {
|
||||
@@ -540,10 +603,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, j + 1);
|
||||
|
||||
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1);
|
||||
@@ -207,7 +207,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -686,6 +749,7 @@
|
||||
@@ -704,6 +767,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -704,14 +768,47 @@
|
||||
@@ -722,15 +786,48 @@
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
@@ -243,7 +243,8 @@
|
||||
|
||||
}
|
||||
|
||||
private void resetWeatherCycle() {
|
||||
@VisibleForTesting
|
||||
public void resetWeatherCycle() {
|
||||
- this.serverLevelData.setRainTime(0);
|
||||
+ // CraftBukkit start
|
||||
this.serverLevelData.setRaining(false);
|
||||
@@ -265,7 +266,7 @@
|
||||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -746,6 +843,7 @@
|
||||
@@ -765,6 +862,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
@@ -273,7 +274,7 @@
|
||||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -769,6 +867,7 @@
|
||||
@@ -788,6 +886,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
@@ -281,7 +282,7 @@
|
||||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -793,6 +892,7 @@
|
||||
@@ -812,6 +911,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
@@ -289,7 +290,7 @@
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
|
||||
}
|
||||
@@ -810,11 +910,19 @@
|
||||
@@ -829,11 +929,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -310,7 +311,7 @@
|
||||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -879,15 +987,37 @@
|
||||
@@ -898,15 +1006,37 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
@@ -351,7 +352,7 @@
|
||||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -918,24 +1048,37 @@
|
||||
@@ -937,24 +1067,37 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
@@ -393,7 +394,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -949,10 +1092,32 @@
|
||||
@@ -968,10 +1111,32 @@
|
||||
entityplayer.remove(entity_removalreason);
|
||||
}
|
||||
|
||||
@@ -426,7 +427,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -961,6 +1126,12 @@
|
||||
@@ -980,6 +1145,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
@@ -439,7 +440,7 @@
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1020,7 +1191,18 @@
|
||||
@@ -1039,7 +1210,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -459,10 +460,10 @@
|
||||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -1082,6 +1264,11 @@
|
||||
@@ -1101,6 +1283,11 @@
|
||||
@Override
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a) {
|
||||
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false);
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a, ParticleParam particleparam, ParticleParam particleparam1, SoundEffect soundeffect) {
|
||||
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false, particleparam, particleparam1, soundeffect);
|
||||
+ // CraftBukkit start
|
||||
+ if (explosion.wasCanceled) {
|
||||
+ return explosion;
|
||||
@@ -471,7 +472,7 @@
|
||||
|
||||
if (!explosion.interactsWithBlocks()) {
|
||||
explosion.clearToBlow();
|
||||
@@ -1154,13 +1341,20 @@
|
||||
@@ -1173,13 +1360,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
@@ -494,7 +495,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1211,7 +1405,7 @@
|
||||
@@ -1230,7 +1424,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
|
||||
@@ -503,7 +504,7 @@
|
||||
return null;
|
||||
} else {
|
||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
|
||||
@@ -1253,6 +1447,7 @@
|
||||
@@ -1277,6 +1471,7 @@
|
||||
|
||||
@Override
|
||||
public void setMapData(String s, WorldMap worldmap) {
|
||||
@@ -511,7 +512,7 @@
|
||||
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
||||
}
|
||||
|
||||
@@ -1550,6 +1745,11 @@
|
||||
@@ -1574,6 +1769,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
@@ -523,7 +524,7 @@
|
||||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1569,12 +1769,12 @@
|
||||
@@ -1593,12 +1793,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
@@ -538,7 +539,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1597,7 +1797,7 @@
|
||||
@@ -1621,7 +1821,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
@@ -547,7 +548,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1606,7 +1806,7 @@
|
||||
@@ -1630,7 +1830,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
@@ -556,7 +557,7 @@
|
||||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1617,17 +1817,33 @@
|
||||
@@ -1641,17 +1841,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
@@ -592,7 +593,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1703,7 +1919,9 @@
|
||||
@@ -1737,7 +1953,9 @@
|
||||
|
||||
a() {}
|
||||
|
||||
@@ -603,7 +604,7 @@
|
||||
|
||||
public void onDestroyed(Entity entity) {
|
||||
WorldServer.this.getScoreboard().entityRemoved(entity);
|
||||
@@ -1751,6 +1969,7 @@
|
||||
@@ -1785,6 +2003,7 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||
@@ -611,7 +612,7 @@
|
||||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1787,6 +2006,14 @@
|
||||
@@ -1821,6 +2040,14 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/net/minecraft/server/network/LoginListener.java
|
||||
@@ -39,6 +39,13 @@
|
||||
@@ -40,6 +40,13 @@
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
public class LoginListener implements PacketLoginInListener, TickablePacketListener {
|
||||
|
||||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
|
||||
@@ -55,6 +62,7 @@
|
||||
@@ -56,6 +63,7 @@
|
||||
@Nullable
|
||||
private GameProfile authenticatedProfile;
|
||||
private final String serverId;
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
|
||||
this.state = LoginListener.EnumProtocolState.HELLO;
|
||||
@@ -80,6 +88,13 @@
|
||||
@@ -81,6 +89,13 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
@Override
|
||||
public boolean isAcceptingMessages() {
|
||||
return this.connection.isConnected();
|
||||
@@ -138,10 +153,12 @@
|
||||
@@ -139,10 +154,12 @@
|
||||
|
||||
private void verifyLoginAndFinishConnectionSetup(GameProfile gameprofile) {
|
||||
PlayerList playerlist = this.server.getPlayerList();
|
||||
@@ -52,7 +52,7 @@
|
||||
} else {
|
||||
if (this.server.getCompressionThreshold() >= 0 && !this.connection.isMemoryConnection()) {
|
||||
this.connection.send(new PacketLoginOutSetCompression(this.server.getCompressionThreshold()), PacketSendListener.thenRun(() -> {
|
||||
@@ -149,7 +166,7 @@
|
||||
@@ -150,7 +167,7 @@
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.state = LoginListener.EnumProtocolState.WAITING_FOR_DUPE_DISCONNECT;
|
||||
@@ -205,6 +222,43 @@
|
||||
@@ -200,6 +217,43 @@
|
||||
if (profileresult != null) {
|
||||
GameProfile gameprofile = profileresult.profile();
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
LoginListener.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId());
|
||||
LoginListener.this.startClientVerification(gameprofile);
|
||||
} else if (LoginListener.this.server.isSingleplayer()) {
|
||||
@@ -222,6 +276,11 @@
|
||||
@@ -217,6 +271,11 @@
|
||||
LoginListener.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.authservers_down"));
|
||||
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
|
||||
}
|
||||
@@ -117,7 +117,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -247,7 +306,7 @@
|
||||
@@ -242,7 +301,7 @@
|
||||
public void handleLoginAcknowledgement(ServerboundLoginAcknowledgedPacket serverboundloginacknowledgedpacket) {
|
||||
Validate.validState(this.state == LoginListener.EnumProtocolState.PROTOCOL_SWITCHING, "Unexpected login acknowledgement packet", new Object[0]);
|
||||
CommonListenerCookie commonlistenercookie = CommonListenerCookie.createInitial((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -180,6 +180,66 @@
|
||||
@@ -183,6 +183,67 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
+import java.util.Arrays;
|
||||
+import java.util.concurrent.ExecutionException;
|
||||
+import java.util.concurrent.atomic.AtomicInteger;
|
||||
+import java.util.function.Function;
|
||||
+import net.minecraft.network.chat.OutgoingChatMessage;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment;
|
||||
@@ -67,7 +68,7 @@
|
||||
public class PlayerConnection extends ServerCommonPacketListenerImpl implements PacketListenerPlayIn, ServerPlayerConnection, TickablePacketListener {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -191,7 +251,9 @@
|
||||
@@ -194,7 +255,9 @@
|
||||
public final PlayerChunkSender chunkSender;
|
||||
private int tickCount;
|
||||
private int ackBlockChangesUpTo = -1;
|
||||
@@ -78,19 +79,19 @@
|
||||
private int dropSpamTickCount;
|
||||
private double firstGoodX;
|
||||
private double firstGoodY;
|
||||
@@ -227,7 +289,7 @@
|
||||
@@ -229,7 +292,7 @@
|
||||
private boolean waitingForSwitchToConfig;
|
||||
|
||||
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
|
||||
- super(minecraftserver, networkmanager, commonlistenercookie);
|
||||
+ super(minecraftserver, networkmanager, commonlistenercookie, entityplayer); // CraftBukkit
|
||||
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
|
||||
this.lastSeenMessages = new LastSeenMessagesValidator(20);
|
||||
this.messageSignatureCache = MessageSignatureCache.createDefault();
|
||||
@@ -237,9 +299,25 @@
|
||||
entityplayer.connection = this;
|
||||
entityplayer.getTextFilter().join();
|
||||
this.signedMessageDecoder = minecraftserver.enforceSecureProfile() ? SignedMessageChain.b.REJECT_ALL : SignedMessageChain.b.unsigned(entityplayer.getUUID());
|
||||
this.chunkSender = new PlayerChunkSender(networkmanager.isMemoryConnection());
|
||||
networkmanager.setListener(this);
|
||||
this.player = entityplayer;
|
||||
@@ -239,9 +302,25 @@
|
||||
|
||||
Objects.requireNonNull(minecraftserver);
|
||||
this.signedMessageDecoder = SignedMessageChain.b.unsigned(uuid, minecraftserver::enforceSecureProfile);
|
||||
- this.chatMessageChain = new FutureChain(minecraftserver);
|
||||
+ this.chatMessageChain = new FutureChain(minecraftserver.chatExecutor); // CraftBukkit - async chat
|
||||
}
|
||||
@@ -114,7 +115,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.ackBlockChangesUpTo > -1) {
|
||||
@@ -291,15 +369,21 @@
|
||||
@@ -293,15 +372,21 @@
|
||||
}
|
||||
|
||||
this.keepConnectionAlive();
|
||||
@@ -136,7 +137,7 @@
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
|
||||
}
|
||||
|
||||
@@ -390,7 +474,34 @@
|
||||
@@ -392,7 +477,34 @@
|
||||
double d9 = entity.getDeltaMovement().lengthSqr();
|
||||
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
@@ -172,7 +173,7 @@
|
||||
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
|
||||
this.send(new PacketPlayOutVehicleMove(entity));
|
||||
return;
|
||||
@@ -430,14 +541,72 @@
|
||||
@@ -432,14 +544,72 @@
|
||||
}
|
||||
|
||||
entity.absMoveTo(d3, d4, d5, f, f1);
|
||||
@@ -245,7 +246,7 @@
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
this.player.checkMovementStatistics(this.player.getX() - d0, this.player.getY() - d1, this.player.getZ() - d2);
|
||||
this.clientVehicleIsFloating = d11 >= -0.03125D && !flag1 && !this.server.isFlightAllowed() && !entity.isNoGravity() && this.noBlocksAround(entity);
|
||||
@@ -471,6 +640,7 @@
|
||||
@@ -473,6 +643,7 @@
|
||||
}
|
||||
|
||||
this.awaitingPositionFromClient = null;
|
||||
@@ -253,7 +254,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -478,7 +648,7 @@
|
||||
@@ -480,7 +651,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.serverLevel());
|
||||
@@ -262,7 +263,7 @@
|
||||
RecipeBookServer recipebookserver = this.player.getRecipeBook();
|
||||
|
||||
Objects.requireNonNull(recipebookserver);
|
||||
@@ -488,6 +658,7 @@
|
||||
@@ -490,6 +661,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookChangeSettingsPacket(PacketPlayInRecipeSettings packetplayinrecipesettings) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipesettings, this, this.player.serverLevel());
|
||||
@@ -270,7 +271,7 @@
|
||||
this.player.getRecipeBook().setBookSetting(packetplayinrecipesettings.getBookType(), packetplayinrecipesettings.isOpen(), packetplayinrecipesettings.isFiltering());
|
||||
}
|
||||
|
||||
@@ -508,6 +679,12 @@
|
||||
@@ -510,6 +682,12 @@
|
||||
@Override
|
||||
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.serverLevel());
|
||||
@@ -283,7 +284,7 @@
|
||||
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -517,6 +694,7 @@
|
||||
@@ -519,6 +697,7 @@
|
||||
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
@@ -291,7 +292,7 @@
|
||||
this.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
|
||||
});
|
||||
}
|
||||
@@ -762,6 +940,13 @@
|
||||
@@ -766,6 +945,13 @@
|
||||
|
||||
if (container instanceof ContainerMerchant) {
|
||||
ContainerMerchant containermerchant = (ContainerMerchant) container;
|
||||
@@ -305,7 +306,7 @@
|
||||
|
||||
if (!containermerchant.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
|
||||
@@ -776,6 +961,13 @@
|
||||
@@ -780,6 +966,13 @@
|
||||
|
||||
@Override
|
||||
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
|
||||
@@ -319,7 +320,7 @@
|
||||
int i = packetplayinbedit.getSlot();
|
||||
|
||||
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
|
||||
@@ -784,7 +976,7 @@
|
||||
@@ -788,7 +981,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -328,7 +329,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
stream.forEach(list::add);
|
||||
@@ -802,7 +994,7 @@
|
||||
@@ -806,7 +999,7 @@
|
||||
ItemStack itemstack = this.player.getInventory().getItem(i);
|
||||
|
||||
if (itemstack.is(Items.WRITABLE_BOOK)) {
|
||||
@@ -337,7 +338,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -827,16 +1019,16 @@
|
||||
@@ -831,16 +1024,16 @@
|
||||
|
||||
this.updateBookPages(list, (s) -> {
|
||||
return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s));
|
||||
@@ -358,7 +359,7 @@
|
||||
return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty()));
|
||||
});
|
||||
|
||||
@@ -862,6 +1054,7 @@
|
||||
@@ -866,6 +1059,7 @@
|
||||
}
|
||||
|
||||
itemstack.addTagElement("pages", nbttaglist);
|
||||
@@ -366,7 +367,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -898,7 +1091,7 @@
|
||||
@@ -922,7 +1116,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
|
||||
@@ -375,7 +376,7 @@
|
||||
if (this.tickCount == 0) {
|
||||
this.resetPosition();
|
||||
}
|
||||
@@ -908,7 +1101,7 @@
|
||||
@@ -932,7 +1126,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
}
|
||||
@@ -384,7 +385,7 @@
|
||||
} else {
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX()));
|
||||
@@ -920,7 +1113,15 @@
|
||||
@@ -944,7 +1138,15 @@
|
||||
if (this.player.isPassenger()) {
|
||||
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
@@ -400,43 +401,43 @@
|
||||
double d3 = this.player.getX();
|
||||
double d4 = this.player.getY();
|
||||
double d5 = this.player.getZ();
|
||||
@@ -939,15 +1140,33 @@
|
||||
++this.receivedMovePacketCount;
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
@@ -964,15 +1166,33 @@
|
||||
++this.receivedMovePacketCount;
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
|
||||
- if (i > 5) {
|
||||
+ // CraftBukkit start - handle custom speeds and skipped ticks
|
||||
+ this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
|
||||
+ this.allowedPlayerTicks = Math.max(this.allowedPlayerTicks, 1);
|
||||
+ this.lastTick = (int) (System.currentTimeMillis() / 50);
|
||||
- if (i > 5) {
|
||||
+ // CraftBukkit start - handle custom speeds and skipped ticks
|
||||
+ this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
|
||||
+ this.allowedPlayerTicks = Math.max(this.allowedPlayerTicks, 1);
|
||||
+ this.lastTick = (int) (System.currentTimeMillis() / 50);
|
||||
+
|
||||
+ if (i > Math.max(this.allowedPlayerTicks, 5)) {
|
||||
PlayerConnection.LOGGER.debug("{} is sending move packets too frequently ({} packets since last tick)", this.player.getName().getString(), i);
|
||||
i = 1;
|
||||
}
|
||||
+ if (i > Math.max(this.allowedPlayerTicks, 5)) {
|
||||
PlayerConnection.LOGGER.debug("{} is sending move packets too frequently ({} packets since last tick)", this.player.getName().getString(), i);
|
||||
i = 1;
|
||||
}
|
||||
|
||||
+ if (packetplayinflying.hasRot || d10 > 0) {
|
||||
+ allowedPlayerTicks -= 1;
|
||||
+ } else {
|
||||
+ allowedPlayerTicks = 20;
|
||||
+ }
|
||||
+ double speed;
|
||||
+ if (player.getAbilities().flying) {
|
||||
+ speed = player.getAbilities().flyingSpeed * 20f;
|
||||
+ } else {
|
||||
+ speed = player.getAbilities().walkingSpeed * 10f;
|
||||
+ }
|
||||
+ if (packetplayinflying.hasRot || d10 > 0) {
|
||||
+ allowedPlayerTicks -= 1;
|
||||
+ } else {
|
||||
+ allowedPlayerTicks = 20;
|
||||
+ }
|
||||
+ double speed;
|
||||
+ if (player.getAbilities().flying) {
|
||||
+ speed = player.getAbilities().flyingSpeed * 20f;
|
||||
+ } else {
|
||||
+ speed = player.getAbilities().walkingSpeed * 10f;
|
||||
+ }
|
||||
+
|
||||
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
|
||||
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
|
||||
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
|
||||
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
|
||||
|
||||
- if (d10 - d9 > (double) (f2 * (float) i) && !this.isSingleplayerOwner()) {
|
||||
+ if (d10 - d9 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
||||
+ // CraftBukkit end
|
||||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
|
||||
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
||||
return;
|
||||
@@ -968,6 +1187,7 @@
|
||||
- if (d10 - d9 > (double) (f2 * (float) i) && !this.isSingleplayerOwner()) {
|
||||
+ if (d10 - d9 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
||||
+ // CraftBukkit end
|
||||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
|
||||
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
||||
return;
|
||||
@@ -994,6 +1214,7 @@
|
||||
boolean flag1 = this.player.verticalCollisionBelow;
|
||||
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d6, d7, d8));
|
||||
@@ -444,7 +445,7 @@
|
||||
double d11 = d7;
|
||||
|
||||
d6 = d0 - this.player.getX();
|
||||
@@ -986,9 +1206,70 @@
|
||||
@@ -1012,9 +1233,70 @@
|
||||
}
|
||||
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) {
|
||||
@@ -516,7 +517,7 @@
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
this.clientIsFloating = d11 >= -0.03125D && !flag1 && this.player.gameMode.getGameModeForPlayer() != EnumGamemode.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isFallFlying() && !this.player.isAutoSpinAttack() && this.noBlocksAround(this.player);
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
@@ -1029,11 +1310,68 @@
|
||||
@@ -1055,11 +1337,68 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -586,7 +587,7 @@
|
||||
double d3 = set.contains(RelativeMovement.X) ? this.player.getX() : 0.0D;
|
||||
double d4 = set.contains(RelativeMovement.Y) ? this.player.getY() : 0.0D;
|
||||
double d5 = set.contains(RelativeMovement.Z) ? this.player.getZ() : 0.0D;
|
||||
@@ -1045,6 +1383,14 @@
|
||||
@@ -1071,6 +1410,14 @@
|
||||
this.awaitingTeleport = 0;
|
||||
}
|
||||
|
||||
@@ -601,7 +602,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
|
||||
@@ -1053,6 +1399,7 @@
|
||||
@@ -1079,6 +1426,7 @@
|
||||
@Override
|
||||
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.serverLevel());
|
||||
@@ -609,7 +610,7 @@
|
||||
BlockPosition blockposition = packetplayinblockdig.getPos();
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
@@ -1063,14 +1410,46 @@
|
||||
@@ -1089,14 +1437,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
|
||||
|
||||
@@ -658,7 +659,7 @@
|
||||
this.player.drop(false);
|
||||
}
|
||||
|
||||
@@ -1108,6 +1487,7 @@
|
||||
@@ -1134,6 +1514,7 @@
|
||||
@Override
|
||||
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.serverLevel());
|
||||
@@ -666,7 +667,7 @@
|
||||
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinuseitem.getHand();
|
||||
@@ -1131,6 +1511,7 @@
|
||||
@@ -1157,6 +1538,7 @@
|
||||
|
||||
if (blockposition.getY() < i) {
|
||||
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
|
||||
@@ -674,7 +675,7 @@
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
|
||||
@@ -1159,6 +1540,7 @@
|
||||
@@ -1185,6 +1567,7 @@
|
||||
@Override
|
||||
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.serverLevel());
|
||||
@@ -682,7 +683,7 @@
|
||||
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinblockplace.getHand();
|
||||
@@ -1166,6 +1548,49 @@
|
||||
@@ -1192,6 +1575,49 @@
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
@@ -732,7 +733,7 @@
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
|
||||
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1186,7 +1611,7 @@
|
||||
@@ -1212,7 +1638,7 @@
|
||||
Entity entity = packetplayinspectate.getEntity(worldserver);
|
||||
|
||||
if (entity != null) {
|
||||
@@ -741,7 +742,7 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1209,6 +1634,13 @@
|
||||
@@ -1235,6 +1661,13 @@
|
||||
|
||||
@Override
|
||||
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
|
||||
@@ -755,7 +756,7 @@
|
||||
PlayerConnection.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), ichatbasecomponent.getString());
|
||||
this.removePlayerFromWorld();
|
||||
super.onDisconnect(ichatbasecomponent);
|
||||
@@ -1216,10 +1648,18 @@
|
||||
@@ -1242,10 +1675,18 @@
|
||||
|
||||
private void removePlayerFromWorld() {
|
||||
this.chatMessageChain.close();
|
||||
@@ -775,7 +776,7 @@
|
||||
this.player.getTextFilter().leave();
|
||||
}
|
||||
|
||||
@@ -1234,7 +1674,16 @@
|
||||
@@ -1260,7 +1701,16 @@
|
||||
@Override
|
||||
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.serverLevel());
|
||||
@@ -792,7 +793,7 @@
|
||||
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
@@ -1243,18 +1692,25 @@
|
||||
@@ -1269,18 +1719,25 @@
|
||||
this.player.resetLastActionTime();
|
||||
} else {
|
||||
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
@@ -811,7 +812,7 @@
|
||||
if (isChatMessageIllegal(packetplayinchat.message())) {
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.illegal_characters"));
|
||||
} else {
|
||||
Optional<LastSeenMessages> optional = this.tryHandleChat(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.lastSeenMessages());
|
||||
Optional<LastSeenMessages> optional = this.tryHandleChat(packetplayinchat.lastSeenMessages());
|
||||
|
||||
if (optional.isPresent()) {
|
||||
- this.server.submit(() -> {
|
||||
@@ -819,19 +820,25 @@
|
||||
PlayerChatMessage playerchatmessage;
|
||||
|
||||
try {
|
||||
@@ -1272,9 +1728,9 @@
|
||||
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(ichatbasecomponent).filter(filteredtext.mask());
|
||||
@@ -1290,7 +1747,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
- }, executor);
|
||||
+ }, this.server.chatExecutor); // CraftBukkit - async chat
|
||||
- CompletableFuture<FilteredText> completablefuture = this.filterTextPacket(playerchatmessage.signedContent());
|
||||
+ CompletableFuture<FilteredText> completablefuture = this.filterTextPacket(playerchatmessage.signedContent()).thenApplyAsync(Function.identity(), this.server.chatExecutor); // CraftBukkit - async chat
|
||||
IChatBaseComponent ichatbasecomponent = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent());
|
||||
|
||||
this.chatMessageChain.append(completablefuture, (filteredtext) -> {
|
||||
@@ -1298,7 +1755,7 @@
|
||||
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
});
|
||||
- });
|
||||
+ // }); // CraftBukkit - async chat
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1289,6 +1745,12 @@
|
||||
@@ -1313,6 +1770,12 @@
|
||||
|
||||
if (optional.isPresent()) {
|
||||
this.server.submit(() -> {
|
||||
@@ -844,7 +851,7 @@
|
||||
this.performChatCommand(serverboundchatcommandpacket, (LastSeenMessages) optional.get());
|
||||
this.detectRateSpam();
|
||||
});
|
||||
@@ -1298,12 +1760,25 @@
|
||||
@@ -1322,12 +1785,25 @@
|
||||
}
|
||||
|
||||
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) {
|
||||
@@ -872,7 +879,7 @@
|
||||
} catch (SignedMessageChain.a signedmessagechain_a) {
|
||||
this.handleMessageDecodeFailure(signedmessagechain_a);
|
||||
return;
|
||||
@@ -1311,10 +1786,10 @@
|
||||
@@ -1335,10 +1811,10 @@
|
||||
|
||||
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
|
||||
|
||||
@@ -885,16 +892,16 @@
|
||||
}
|
||||
|
||||
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
|
||||
@@ -1355,7 +1830,7 @@
|
||||
} else {
|
||||
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
|
||||
@@ -1375,7 +1851,7 @@
|
||||
private Optional<LastSeenMessages> tryHandleChat(LastSeenMessages.b lastseenmessages_b) {
|
||||
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
|
||||
|
||||
- if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
|
||||
+ if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -1403,6 +1878,116 @@
|
||||
- if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
|
||||
+ if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -1409,6 +1885,116 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1011,7 +1018,7 @@
|
||||
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
|
||||
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
|
||||
|
||||
@@ -1410,13 +1995,33 @@
|
||||
@@ -1416,13 +2002,33 @@
|
||||
}
|
||||
|
||||
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
|
||||
@@ -1048,7 +1055,7 @@
|
||||
this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
|
||||
}
|
||||
|
||||
@@ -1438,13 +2043,62 @@
|
||||
@@ -1444,13 +2050,62 @@
|
||||
@Override
|
||||
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.serverLevel());
|
||||
@@ -1111,7 +1118,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
Entity entity;
|
||||
IJumpable ijumpable;
|
||||
@@ -1526,6 +2180,12 @@
|
||||
@@ -1532,6 +2187,12 @@
|
||||
}
|
||||
|
||||
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
|
||||
@@ -1124,7 +1131,7 @@
|
||||
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level().registryAccess())));
|
||||
this.addPendingMessage(playerchatmessage);
|
||||
}
|
||||
@@ -1552,6 +2212,7 @@
|
||||
@@ -1558,6 +2219,7 @@
|
||||
@Override
|
||||
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.serverLevel());
|
||||
@@ -1132,7 +1139,7 @@
|
||||
final WorldServer worldserver = this.player.serverLevel();
|
||||
final Entity entity = packetplayinuseentity.getTarget(worldserver);
|
||||
|
||||
@@ -1566,13 +2227,51 @@
|
||||
@@ -1572,13 +2234,51 @@
|
||||
|
||||
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
|
||||
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
|
||||
@@ -1185,7 +1192,7 @@
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity);
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1585,23 +2284,29 @@
|
||||
@@ -1591,23 +2291,29 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand) {
|
||||
@@ -1218,7 +1225,7 @@
|
||||
}
|
||||
} else {
|
||||
PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked"));
|
||||
@@ -1624,14 +2329,14 @@
|
||||
@@ -1630,14 +2336,14 @@
|
||||
case PERFORM_RESPAWN:
|
||||
if (this.player.wonGame) {
|
||||
this.player.wonGame = false;
|
||||
@@ -1235,7 +1242,7 @@
|
||||
if (this.server.isHardcore()) {
|
||||
this.player.setGameMode(EnumGamemode.SPECTATOR);
|
||||
((GameRules.GameRuleBoolean) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
|
||||
@@ -1647,15 +2352,21 @@
|
||||
@@ -1653,15 +2359,21 @@
|
||||
@Override
|
||||
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.serverLevel());
|
||||
@@ -1259,7 +1266,7 @@
|
||||
this.player.containerMenu.sendAllDataToRemote();
|
||||
} else if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
|
||||
@@ -1668,7 +2379,284 @@
|
||||
@@ -1674,7 +2386,284 @@
|
||||
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
|
||||
|
||||
this.player.containerMenu.suppressRemoteUpdates();
|
||||
@@ -1545,7 +1552,7 @@
|
||||
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -1698,9 +2686,18 @@
|
||||
@@ -1704,9 +2693,18 @@
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
|
||||
} else {
|
||||
@@ -1566,7 +1573,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1708,6 +2705,7 @@
|
||||
@@ -1714,6 +2712,7 @@
|
||||
@Override
|
||||
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.serverLevel());
|
||||
@@ -1574,7 +1581,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
@@ -1750,6 +2748,43 @@
|
||||
@@ -1756,6 +2755,43 @@
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||
@@ -1618,7 +1625,7 @@
|
||||
|
||||
if (flag1 && flag2) {
|
||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).setByPlayer(itemstack);
|
||||
@@ -1772,6 +2807,7 @@
|
||||
@@ -1778,6 +2814,7 @@
|
||||
}
|
||||
|
||||
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
|
||||
@@ -1626,7 +1633,7 @@
|
||||
this.player.resetLastActionTime();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
||||
@@ -1793,7 +2829,17 @@
|
||||
@@ -1799,7 +2836,17 @@
|
||||
@Override
|
||||
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
|
||||
@@ -1645,7 +1652,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1852,7 +2898,7 @@
|
||||
@@ -1858,7 +2905,7 @@
|
||||
if (!this.waitingForSwitchToConfig) {
|
||||
throw new IllegalStateException("Client acknowledged config, but none was requested");
|
||||
} else {
|
||||
|
||||
@@ -113,10 +113,10 @@
|
||||
@Override
|
||||
public void handleResourcePackResponse(ServerboundResourcePackPacket serverboundresourcepackpacket) {
|
||||
@@ -81,6 +156,7 @@
|
||||
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.playerProfile().getName());
|
||||
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), serverboundresourcepackpacket.id());
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
|
||||
}
|
||||
+ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getCraftPlayer(), PlayerResourcePackStatusEvent.Status.values()[serverboundresourcepackpacket.getAction().ordinal()])); // CraftBukkit
|
||||
+ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getCraftPlayer(), PlayerResourcePackStatusEvent.Status.values()[serverboundresourcepackpacket.action().ordinal()])); // CraftBukkit
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
--- a/net/minecraft/server/players/NameReferencingFileConverter.java
|
||||
+++ b/net/minecraft/server/players/NameReferencingFileConverter.java
|
||||
@@ -27,6 +27,11 @@
|
||||
@@ -27,6 +27,12 @@
|
||||
import net.minecraft.world.level.storage.SavedFile;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.nbt.NBTCompressedStreamTools;
|
||||
+import net.minecraft.nbt.NBTReadLimiter;
|
||||
+import net.minecraft.nbt.NBTTagCompound;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class NameReferencingFileConverter {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -87,7 +92,7 @@
|
||||
@@ -85,7 +91,7 @@
|
||||
try {
|
||||
gameprofilebanlist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@@ -21,7 +22,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +150,7 @@
|
||||
@@ -143,7 +149,7 @@
|
||||
try {
|
||||
ipbanlist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@@ -30,7 +31,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +191,7 @@
|
||||
@@ -184,7 +190,7 @@
|
||||
try {
|
||||
oplist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@@ -39,7 +40,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +235,7 @@
|
||||
@@ -228,7 +234,7 @@
|
||||
try {
|
||||
whitelist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@@ -48,7 +49,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,6 +354,30 @@
|
||||
@@ -347,6 +353,30 @@
|
||||
File file5 = new File(file, s2 + ".dat");
|
||||
File file6 = new File(file4, s3 + ".dat");
|
||||
|
||||
@@ -56,7 +57,7 @@
|
||||
+ NBTTagCompound root = null;
|
||||
+
|
||||
+ try {
|
||||
+ root = NBTCompressedStreamTools.readCompressed(new java.io.FileInputStream(file5));
|
||||
+ root = NBTCompressedStreamTools.readCompressed(new java.io.FileInputStream(file5), NBTReadLimiter.unlimitedHeap());
|
||||
+ } catch (Exception exception) {
|
||||
+ exception.printStackTrace();
|
||||
+ }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -102,6 +102,26 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
@@ -101,6 +101,26 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
@@ -27,7 +27,7 @@
|
||||
public abstract class PlayerList {
|
||||
|
||||
public static final File USERBANLIST_FILE = new File("banned-players.json");
|
||||
@@ -114,14 +134,16 @@
|
||||
@@ -113,14 +133,16 @@
|
||||
private static final int SEND_PLAYER_INFO_INTERVAL = 600;
|
||||
private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
|
||||
private final MinecraftServer server;
|
||||
@@ -47,7 +47,7 @@
|
||||
public final WorldNBTStorage playerIo;
|
||||
private boolean doWhiteList;
|
||||
private final LayeredRegistryAccess<RegistryLayer> registries;
|
||||
@@ -132,13 +154,23 @@
|
||||
@@ -131,13 +153,23 @@
|
||||
private static final boolean ALLOW_LOGOUTIVATOR = false;
|
||||
private int sendAllPlayerInfoIn;
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
this.server = minecraftserver;
|
||||
this.registries = layeredregistryaccess;
|
||||
this.maxPlayers = i;
|
||||
@@ -161,15 +193,21 @@
|
||||
@@ -160,15 +192,21 @@
|
||||
|
||||
NBTTagCompound nbttagcompound = this.load(entityplayer);
|
||||
ResourceKey resourcekey;
|
||||
@@ -98,7 +98,7 @@
|
||||
}
|
||||
|
||||
ResourceKey<World> resourcekey1 = resourcekey;
|
||||
@@ -186,7 +224,8 @@
|
||||
@@ -185,7 +223,8 @@
|
||||
entityplayer.setServerLevel(worldserver1);
|
||||
String s1 = networkmanager.getLoggableAddress(this.server.logIPs());
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
WorldData worlddata = worldserver1.getLevelData();
|
||||
|
||||
entityplayer.loadGameTypes(nbttagcompound);
|
||||
@@ -197,6 +236,7 @@
|
||||
@@ -196,6 +235,7 @@
|
||||
boolean flag2 = gamerules.getBoolean(GameRules.RULE_LIMITED_CRAFTING);
|
||||
|
||||
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), this.server.levelKeys(), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, flag2, entityplayer.createCommonSpawnInfo(worldserver1)));
|
||||
@@ -116,7 +116,7 @@
|
||||
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
playerconnection.send(new PacketPlayOutAbilities(entityplayer.getAbilities()));
|
||||
playerconnection.send(new PacketPlayOutHeldItemSlot(entityplayer.getInventory().selected));
|
||||
@@ -213,8 +253,10 @@
|
||||
@@ -212,8 +252,10 @@
|
||||
} else {
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s);
|
||||
}
|
||||
@@ -128,7 +128,7 @@
|
||||
playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
ServerPing serverping = this.server.getStatus();
|
||||
|
||||
@@ -222,13 +264,64 @@
|
||||
@@ -221,13 +263,64 @@
|
||||
entityplayer.sendServerStatus(serverping);
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
Iterator iterator = entityplayer.getActiveEffects().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -239,8 +332,11 @@
|
||||
@@ -238,8 +331,11 @@
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
|
||||
@@ -211,7 +211,7 @@
|
||||
});
|
||||
|
||||
if (entity != null) {
|
||||
@@ -283,6 +379,8 @@
|
||||
@@ -282,6 +378,8 @@
|
||||
}
|
||||
|
||||
entityplayer.initInventoryMenu();
|
||||
@@ -220,7 +220,7 @@
|
||||
}
|
||||
|
||||
public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
|
||||
@@ -319,30 +417,31 @@
|
||||
@@ -318,30 +416,31 @@
|
||||
}
|
||||
|
||||
public void addWorldborderListener(WorldServer worldserver) {
|
||||
@@ -257,7 +257,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -370,14 +469,15 @@
|
||||
@@ -369,14 +468,15 @@
|
||||
}
|
||||
|
||||
protected void save(EntityPlayer entityplayer) {
|
||||
@@ -275,7 +275,7 @@
|
||||
|
||||
if (advancementdataplayer != null) {
|
||||
advancementdataplayer.save();
|
||||
@@ -385,10 +485,24 @@
|
||||
@@ -384,10 +484,24 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@
|
||||
this.save(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -412,18 +526,66 @@
|
||||
@@ -411,18 +525,66 @@
|
||||
|
||||
if (entityplayer1 == entityplayer) {
|
||||
this.playersByUUID.remove(uuid);
|
||||
@@ -374,7 +374,7 @@
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
|
||||
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
|
||||
@@ -431,10 +593,12 @@
|
||||
@@ -430,10 +592,12 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@
|
||||
IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
|
||||
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason());
|
||||
@@ -442,17 +606,32 @@
|
||||
@@ -441,17 +605,32 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())));
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@
|
||||
UUID uuid = gameprofile.getId();
|
||||
Set<EntityPlayer> set = Sets.newIdentityHashSet();
|
||||
Iterator iterator = this.players.iterator();
|
||||
@@ -480,14 +659,24 @@
|
||||
@@ -479,14 +658,24 @@
|
||||
}
|
||||
|
||||
return !set.isEmpty();
|
||||
@@ -454,7 +454,7 @@
|
||||
WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
Optional optional;
|
||||
|
||||
@@ -499,6 +688,11 @@
|
||||
@@ -498,6 +687,11 @@
|
||||
|
||||
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld();
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile(), entityplayer.clientInformation());
|
||||
@@ -466,7 +466,7 @@
|
||||
|
||||
entityplayer1.connection = entityplayer.connection;
|
||||
entityplayer1.restoreFrom(entityplayer, flag);
|
||||
@@ -514,28 +708,66 @@
|
||||
@@ -513,28 +707,66 @@
|
||||
|
||||
boolean flag2 = false;
|
||||
|
||||
@@ -549,7 +549,7 @@
|
||||
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
|
||||
}
|
||||
|
||||
@@ -544,21 +776,43 @@
|
||||
@@ -543,21 +775,43 @@
|
||||
WorldData worlddata = worldserver2.getLevelData();
|
||||
|
||||
entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.createCommonSpawnInfo(worldserver2), (byte) i));
|
||||
@@ -598,7 +598,7 @@
|
||||
return entityplayer1;
|
||||
}
|
||||
|
||||
@@ -571,7 +825,18 @@
|
||||
@@ -570,7 +824,18 @@
|
||||
|
||||
public void tick() {
|
||||
if (++this.sendAllPlayerInfoIn > 600) {
|
||||
@@ -618,7 +618,7 @@
|
||||
this.sendAllPlayerInfoIn = 0;
|
||||
}
|
||||
|
||||
@@ -588,6 +853,25 @@
|
||||
@@ -587,6 +852,25 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -644,7 +644,7 @@
|
||||
public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) {
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
@@ -666,7 +950,7 @@
|
||||
@@ -665,7 +949,7 @@
|
||||
}
|
||||
|
||||
public void deop(GameProfile gameprofile) {
|
||||
@@ -653,7 +653,7 @@
|
||||
EntityPlayer entityplayer = this.getPlayer(gameprofile.getId());
|
||||
|
||||
if (entityplayer != null) {
|
||||
@@ -690,6 +974,7 @@
|
||||
@@ -689,6 +973,7 @@
|
||||
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
@@ -661,7 +661,7 @@
|
||||
this.server.getCommands().sendCommands(entityplayer);
|
||||
}
|
||||
|
||||
@@ -722,6 +1007,12 @@
|
||||
@@ -719,6 +1004,12 @@
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
|
||||
@@ -674,7 +674,7 @@
|
||||
if (entityplayer != entityhuman && entityplayer.level().dimension() == resourcekey) {
|
||||
double d4 = d0 - entityplayer.getX();
|
||||
double d5 = d1 - entityplayer.getY();
|
||||
@@ -761,23 +1052,35 @@
|
||||
@@ -758,15 +1049,19 @@
|
||||
public void reloadWhiteList() {}
|
||||
|
||||
public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
@@ -697,7 +697,8 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.LEVEL_CHUNKS_LOAD_START, 0.0F));
|
||||
@@ -775,8 +1070,16 @@
|
||||
|
||||
public void sendAllPlayerInfo(EntityPlayer entityplayer) {
|
||||
entityplayer.inventoryMenu.sendAllDataToRemote();
|
||||
@@ -715,7 +716,7 @@
|
||||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
@@ -833,12 +1136,22 @@
|
||||
@@ -832,12 +1135,22 @@
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
@@ -740,7 +741,7 @@
|
||||
public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> {
|
||||
return ichatbasecomponent;
|
||||
@@ -896,16 +1209,23 @@
|
||||
@@ -895,16 +1208,23 @@
|
||||
return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now());
|
||||
}
|
||||
|
||||
@@ -768,7 +769,7 @@
|
||||
Path path = file2.toPath();
|
||||
|
||||
if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
|
||||
@@ -914,7 +1234,7 @@
|
||||
@@ -913,7 +1233,7 @@
|
||||
}
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
@@ -777,7 +778,7 @@
|
||||
}
|
||||
|
||||
return serverstatisticmanager;
|
||||
@@ -922,13 +1242,13 @@
|
||||
@@ -921,13 +1241,13 @@
|
||||
|
||||
public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) {
|
||||
UUID uuid = entityplayer.getUUID();
|
||||
@@ -793,7 +794,7 @@
|
||||
}
|
||||
|
||||
advancementdataplayer.setPlayer(entityplayer);
|
||||
@@ -979,13 +1299,20 @@
|
||||
@@ -978,13 +1298,20 @@
|
||||
}
|
||||
|
||||
public void reloadResources() {
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
package net.minecraft.server.players;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -81,7 +82,7 @@
|
||||
}
|
||||
@@ -85,7 +86,7 @@
|
||||
}
|
||||
|
||||
public void onProfileLookupFailed(String s1, Exception exception) {
|
||||
- atomicreference.set((Object) null);
|
||||
+ atomicreference.set(null); // CraftBukkit - decompile error
|
||||
}
|
||||
};
|
||||
public void onProfileLookupFailed(String s1, Exception exception) {
|
||||
- atomicreference.set((Object) null);
|
||||
+ atomicreference.set(null); // CraftBukkit - decompile error
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user