@@ -1,13 +1,12 @@
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -163,6 +163,27 @@
|
||||
@@ -160,6 +160,27 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.mojang.serialization.DynamicOps;
|
||||
+import com.mojang.serialization.Lifecycle;
|
||||
+import com.google.common.collect.ImmutableSet;
|
||||
+import jline.console.ConsoleReader;
|
||||
+import joptsimple.OptionSet;
|
||||
+import net.minecraft.nbt.DynamicOpsNBT;
|
||||
@@ -16,6 +15,7 @@
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import net.minecraft.server.dedicated.DedicatedServerProperties;
|
||||
+import net.minecraft.util.datafix.DataConverterRegistry;
|
||||
+import net.minecraft.world.level.biome.WorldChunkManager;
|
||||
+import net.minecraft.world.level.levelgen.ChunkGeneratorAbstract;
|
||||
+import net.minecraft.world.level.storage.WorldDataServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
@@ -25,12 +25,12 @@
|
||||
+import org.bukkit.event.server.ServerLoadEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ICommandListener, AutoCloseable {
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -254,6 +275,20 @@
|
||||
private final DefinedStructureManager structureManager;
|
||||
@@ -252,6 +273,20 @@
|
||||
protected SaveData worldData;
|
||||
private volatile boolean isSaving;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public DataPackConfiguration datapackconfiguration;
|
||||
@@ -46,13 +46,13 @@
|
||||
+ private boolean forceTicks;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static <S extends MinecraftServer> S a(Function<Thread, S> function) {
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
@@ -263,14 +298,14 @@
|
||||
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
|
||||
MinecraftServer.LOGGER.error(throwable);
|
||||
});
|
||||
@@ -265,14 +300,14 @@
|
||||
thread.setPriority(8);
|
||||
}
|
||||
|
||||
- S s0 = (MinecraftServer) function.apply(thread);
|
||||
+ S s0 = function.apply(thread); // CraftBukkit - decompile error
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
super("Server");
|
||||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.e();
|
||||
@@ -282,7 +317,7 @@
|
||||
this.profiler = this.metricsRecorder.getProfiler();
|
||||
@@ -284,7 +319,7 @@
|
||||
this.status = new ServerPing();
|
||||
this.random = new Random();
|
||||
this.port = -1;
|
||||
@@ -75,10 +75,10 @@
|
||||
this.running = true;
|
||||
this.tickTimes = new long[100];
|
||||
this.resourcePack = "";
|
||||
@@ -312,13 +347,40 @@
|
||||
this.structureManager = new DefinedStructureManager(datapackresources.i(), convertable_conversionsession, datafixer);
|
||||
@@ -314,13 +349,40 @@
|
||||
this.structureManager = new DefinedStructureManager(datapackresources.getResourceManager(), convertable_conversionsession, datafixer);
|
||||
this.serverThread = thread;
|
||||
this.executor = SystemUtils.f();
|
||||
this.executor = SystemUtils.backgroundExecutor();
|
||||
+ // CraftBukkit start
|
||||
+ this.options = options;
|
||||
+ this.datapackconfiguration = datapackconfiguration;
|
||||
@@ -108,66 +108,95 @@
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
private void initializeScoreboards(WorldPersistentData worldpersistentdata) {
|
||||
private void readScoreboard(WorldPersistentData worldpersistentdata) {
|
||||
ScoreboardServer scoreboardserver = this.getScoreboard();
|
||||
|
||||
Objects.requireNonNull(scoreboardserver);
|
||||
- Function function = scoreboardserver::a;
|
||||
+ Function<net.minecraft.nbt.NBTTagCompound, net.minecraft.world.scores.PersistentScoreboard> function = scoreboardserver::a; // CraftBukkit - decompile error
|
||||
- Function function = scoreboardserver::createData;
|
||||
+ Function<net.minecraft.nbt.NBTTagCompound, net.minecraft.world.scores.PersistentScoreboard> function = scoreboardserver::createData; // CraftBukkit - decompile error
|
||||
ScoreboardServer scoreboardserver1 = this.getScoreboard();
|
||||
|
||||
Objects.requireNonNull(scoreboardserver1);
|
||||
@@ -329,7 +391,7 @@
|
||||
|
||||
public static void convertWorld(Convertable.ConversionSession convertable_conversionsession) {
|
||||
if (convertable_conversionsession.isConvertable()) {
|
||||
- MinecraftServer.LOGGER.info("Converting map!");
|
||||
+ MinecraftServer.LOGGER.info("Converting map! {}", convertable_conversionsession.getLevelName()); // CraftBukkit
|
||||
convertable_conversionsession.convert(new IProgressUpdate() {
|
||||
private long timeStamp = SystemUtils.getMonotonicMillis();
|
||||
protected abstract boolean initServer() throws IOException;
|
||||
|
||||
@@ -358,48 +420,211 @@
|
||||
- protected void loadLevel() {
|
||||
+ protected void loadLevel(String s) { // CraftBukkit
|
||||
if (!JvmProfiler.INSTANCE.isRunning()) {
|
||||
;
|
||||
}
|
||||
@@ -337,13 +399,8 @@
|
||||
boolean flag = false;
|
||||
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
|
||||
|
||||
- this.detectBundledResources();
|
||||
- this.worldData.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
|
||||
- WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ loadWorld0(s); // CraftBukkit
|
||||
|
||||
- this.createLevels(worldloadlistener);
|
||||
- this.forceDifficulty();
|
||||
- this.prepareLevels(worldloadlistener);
|
||||
if (profiledduration != null) {
|
||||
profiledduration.finish();
|
||||
}
|
||||
@@ -358,35 +415,204 @@
|
||||
|
||||
}
|
||||
|
||||
- protected void loadWorld() {
|
||||
- this.loadResourcesZip();
|
||||
- this.worldData.a(this.getServerModName(), this.getModded().isPresent());
|
||||
- WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ protected void loadWorld(String s) {
|
||||
+ // CraftBukkit start
|
||||
- protected void forceDifficulty() {}
|
||||
+ // CraftBukkit start
|
||||
+ private void loadWorld0(String s) {
|
||||
+ Convertable.ConversionSession worldSession = this.storageSource;
|
||||
+ IRegistryCustom.Dimension iregistrycustom_dimension = this.registryHolder;
|
||||
+ RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.INSTANCE, this.resources.i(), (IRegistryCustom) iregistrycustom_dimension);
|
||||
+ WorldDataServer overworldData = (WorldDataServer) worldSession.a((DynamicOps) registryreadops, datapackconfiguration);
|
||||
+ RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.createAndLoad(DynamicOpsNBT.INSTANCE, this.resources.getResourceManager(), iregistrycustom_dimension);
|
||||
+ WorldDataServer overworldData = (WorldDataServer) worldSession.getDataTag(registryreadops, datapackconfiguration);
|
||||
+ if (overworldData == null) {
|
||||
+ WorldSettings worldsettings;
|
||||
+ GeneratorSettings generatorsettings;
|
||||
+
|
||||
+ if (this.isDemoMode()) {
|
||||
+ if (this.isDemo()) {
|
||||
+ worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
+ generatorsettings = GeneratorSettings.a((IRegistryCustom) iregistrycustom_dimension);
|
||||
+ generatorsettings = GeneratorSettings.demoSettings(iregistrycustom_dimension);
|
||||
+ } else {
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getDedicatedServerProperties();
|
||||
+
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getProperties();
|
||||
|
||||
- protected void createLevels(WorldLoadListener worldloadlistener) {
|
||||
- IWorldDataServer iworlddataserver = this.worldData.overworldData();
|
||||
- GeneratorSettings generatorsettings = this.worldData.worldGenSettings();
|
||||
- boolean flag = generatorsettings.isDebug();
|
||||
- long i = generatorsettings.seed();
|
||||
- long j = BiomeManager.obfuscateSeed(i);
|
||||
- List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
|
||||
- RegistryMaterials<WorldDimension> registrymaterials = generatorsettings.dimensions();
|
||||
- WorldDimension worlddimension = (WorldDimension) registrymaterials.get(WorldDimension.OVERWORLD);
|
||||
- DimensionManager dimensionmanager;
|
||||
- Object object;
|
||||
-
|
||||
- if (worlddimension == null) {
|
||||
- dimensionmanager = (DimensionManager) this.registryHolder.registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrThrow(DimensionManager.OVERWORLD_LOCATION);
|
||||
- object = GeneratorSettings.makeDefaultOverworld(this.registryHolder, (new Random()).nextLong());
|
||||
- } else {
|
||||
- dimensionmanager = worlddimension.type();
|
||||
- object = worlddimension.generator();
|
||||
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.a((IRegistryCustom) iregistrycustom_dimension).j() : dedicatedserverproperties.a((IRegistryCustom) iregistrycustom_dimension);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension).withBonusChest() : dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension);
|
||||
+ }
|
||||
+
|
||||
+ overworldData = new WorldDataServer(worldsettings, generatorsettings, Lifecycle.stable());
|
||||
+ }
|
||||
+
|
||||
+ GeneratorSettings overworldSettings = overworldData.getGeneratorSettings();
|
||||
+ RegistryMaterials<WorldDimension> registrymaterials = overworldSettings.d();
|
||||
+ for (Entry<ResourceKey<WorldDimension>, WorldDimension> entry : registrymaterials.d()) {
|
||||
+ GeneratorSettings overworldSettings = overworldData.worldGenSettings();
|
||||
+ RegistryMaterials<WorldDimension> registrymaterials = overworldSettings.dimensions();
|
||||
+ for (Entry<ResourceKey<WorldDimension>, WorldDimension> entry : registrymaterials.entrySet()) {
|
||||
+ ResourceKey<WorldDimension> dimensionKey = entry.getKey();
|
||||
+
|
||||
+ WorldServer world;
|
||||
+ int dimension = 0;
|
||||
|
||||
- this.a(worldloadlistener);
|
||||
+
|
||||
+ if (dimensionKey == WorldDimension.NETHER) {
|
||||
+ if (getAllowNether()) {
|
||||
+ if (isNetherEnabled()) {
|
||||
+ dimension = -1;
|
||||
+ } else {
|
||||
+ continue;
|
||||
@@ -182,11 +211,11 @@
|
||||
+ dimension = -999;
|
||||
+ }
|
||||
+
|
||||
+ String worldType = (dimension == -999) ? dimensionKey.a().getNamespace() + "_" + dimensionKey.a().getKey() : org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase();
|
||||
+ String worldType = (dimension == -999) ? dimensionKey.location().getNamespace() + "_" + dimensionKey.location().getPath() : org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase();
|
||||
+ String name = (dimensionKey == WorldDimension.OVERWORLD) ? s : s + "_" + worldType;
|
||||
+ if (dimension != 0) {
|
||||
+ File newWorld = Convertable.getFolder(new File(name), dimensionKey);
|
||||
+ File oldWorld = Convertable.getFolder(new File(s), dimensionKey);
|
||||
+ File newWorld = Convertable.getStorageFolder(new File(name).toPath(), dimensionKey).toFile();
|
||||
+ File oldWorld = Convertable.getStorageFolder(new File(s).toPath(), dimensionKey).toFile();
|
||||
+ File oldLevelDat = new File(new File(s), "level.dat"); // The data folders exist on first run as they are created in the PersistentCollection constructor above, but the level.dat won't
|
||||
+
|
||||
+ if (!newWorld.isDirectory() && oldWorld.isDirectory() && oldLevelDat.isFile()) {
|
||||
@@ -220,58 +249,55 @@
|
||||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ worldSession = Convertable.a(server.getWorldContainer().toPath()).c(name, dimensionKey);
|
||||
+ worldSession = Convertable.createDefault(server.getWorldContainer().toPath()).createAccess(name, dimensionKey);
|
||||
+ } catch (IOException ex) {
|
||||
+ throw new RuntimeException(ex);
|
||||
+ }
|
||||
+ MinecraftServer.convertWorld(worldSession); // Run conversion now
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
|
||||
+ org.bukkit.generator.BiomeProvider biomeProvider = this.server.getBiomeProvider(name);
|
||||
+
|
||||
+ WorldDataServer worlddata = (WorldDataServer) worldSession.a((DynamicOps) registryreadops, datapackconfiguration);
|
||||
+ WorldDataServer worlddata = (WorldDataServer) worldSession.getDataTag((DynamicOps) registryreadops, datapackconfiguration);
|
||||
+ if (worlddata == null) {
|
||||
+ WorldSettings worldsettings;
|
||||
+ GeneratorSettings generatorsettings;
|
||||
+
|
||||
+ if (this.isDemoMode()) {
|
||||
+ if (this.isDemo()) {
|
||||
+ worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
+ generatorsettings = GeneratorSettings.a((IRegistryCustom) iregistrycustom_dimension);
|
||||
+ generatorsettings = GeneratorSettings.demoSettings(iregistrycustom_dimension);
|
||||
+ } else {
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getDedicatedServerProperties();
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getProperties();
|
||||
+
|
||||
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.a((IRegistryCustom) iregistrycustom_dimension).j() : dedicatedserverproperties.a((IRegistryCustom) iregistrycustom_dimension);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension).withBonusChest() : dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension);
|
||||
+ }
|
||||
+
|
||||
+ worlddata = new WorldDataServer(worldsettings, generatorsettings, Lifecycle.stable());
|
||||
+ }
|
||||
+ worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
|
||||
+ if (options.has("forceUpgrade")) {
|
||||
+ net.minecraft.server.Main.convertWorld(worldSession, DataConverterRegistry.a(), options.has("eraseCache"), () -> {
|
||||
+ net.minecraft.server.Main.forceUpgrade(worldSession, DataConverterRegistry.getDataFixer(), options.has("eraseCache"), () -> {
|
||||
+ return true;
|
||||
+ }, worlddata.getGeneratorSettings().d().d().stream().map((entry1) -> {
|
||||
+ return ResourceKey.a(IRegistry.DIMENSION_TYPE_REGISTRY, ((ResourceKey) entry1.getKey()).a());
|
||||
+ }).collect(ImmutableSet.toImmutableSet()));
|
||||
+ }, worlddata.worldGenSettings());
|
||||
+ }
|
||||
+
|
||||
+ IWorldDataServer iworlddataserver = worlddata;
|
||||
+ GeneratorSettings generatorsettings = worlddata.getGeneratorSettings();
|
||||
+ boolean flag = generatorsettings.isDebugWorld();
|
||||
+ long i = generatorsettings.getSeed();
|
||||
+ long j = BiomeManager.a(i);
|
||||
+ GeneratorSettings generatorsettings = worlddata.worldGenSettings();
|
||||
+ boolean flag = generatorsettings.isDebug();
|
||||
+ long i = generatorsettings.seed();
|
||||
+ long j = BiomeManager.obfuscateSeed(i);
|
||||
+ List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
|
||||
+ WorldDimension worlddimension = (WorldDimension) registrymaterials.a(dimensionKey);
|
||||
+ WorldDimension worlddimension = (WorldDimension) registrymaterials.get(WorldDimension.OVERWORLD);
|
||||
+ DimensionManager dimensionmanager;
|
||||
+ ChunkGenerator chunkgenerator;
|
||||
+
|
||||
+ if (worlddimension == null) {
|
||||
+ dimensionmanager = (DimensionManager) this.registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).d(DimensionManager.OVERWORLD_LOCATION);
|
||||
+ chunkgenerator = GeneratorSettings.a(this.registryHolder.d(IRegistry.BIOME_REGISTRY), this.registryHolder.d(IRegistry.NOISE_GENERATOR_SETTINGS_REGISTRY), (new Random()).nextLong());
|
||||
+ dimensionmanager = (DimensionManager) this.registryHolder.registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrThrow(DimensionManager.OVERWORLD_LOCATION);
|
||||
+ chunkgenerator = GeneratorSettings.makeDefaultOverworld(this.registryHolder, (new Random()).nextLong());
|
||||
+ } else {
|
||||
+ dimensionmanager = worlddimension.b();
|
||||
+ chunkgenerator = worlddimension.c();
|
||||
+ dimensionmanager = worlddimension.type();
|
||||
+ chunkgenerator = worlddimension.generator();
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), dimensionmanager);
|
||||
@@ -280,23 +306,23 @@
|
||||
+ }
|
||||
+
|
||||
+ if (biomeProvider != null) {
|
||||
+ WorldChunkManager worldChunkManager = new CustomWorldChunkManager(worldInfo, biomeProvider, registryHolder.b(IRegistry.BIOME_REGISTRY));
|
||||
+ WorldChunkManager worldChunkManager = new CustomWorldChunkManager(worldInfo, biomeProvider, registryHolder.ownedRegistryOrThrow(IRegistry.BIOME_REGISTRY));
|
||||
+ if (chunkgenerator instanceof ChunkGeneratorAbstract) {
|
||||
+ chunkgenerator = new ChunkGeneratorAbstract(worldChunkManager, chunkgenerator.strongholdSeed, ((ChunkGeneratorAbstract) chunkgenerator).settings);
|
||||
+ chunkgenerator = new ChunkGeneratorAbstract(((ChunkGeneratorAbstract) chunkgenerator).noises, worldChunkManager, chunkgenerator.strongholdSeed, ((ChunkGeneratorAbstract) chunkgenerator).settings);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ResourceKey<World> worldKey = ResourceKey.a(IRegistry.DIMENSION_REGISTRY, dimensionKey.a());
|
||||
+ ResourceKey<World> worldKey = ResourceKey.create(IRegistry.DIMENSION_REGISTRY, dimensionKey.location());
|
||||
+
|
||||
+ if (dimensionKey == WorldDimension.OVERWORLD) {
|
||||
+ this.worldData = worlddata;
|
||||
+ this.worldData.setGameType(((DedicatedServer) this).getDedicatedServerProperties().gamemode); // From DedicatedServer.init
|
||||
+ this.worldData.setGameType(((DedicatedServer) this).getProperties().gamemode); // From DedicatedServer.init
|
||||
+
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ WorldPersistentData worldpersistentdata = world.getWorldPersistentData();
|
||||
+ this.initializeScoreboards(worldpersistentdata);
|
||||
+ WorldPersistentData worldpersistentdata = world.getDataStorage();
|
||||
+ this.readScoreboard(worldpersistentdata);
|
||||
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
|
||||
+ this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ } else {
|
||||
@@ -304,108 +330,84 @@
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ }
|
||||
+
|
||||
+ worlddata.a(this.getServerModName(), this.getModded().isPresent());
|
||||
+ this.initWorld(world, worlddata, worldData, worlddata.getGeneratorSettings());
|
||||
+ worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
|
||||
+ this.initWorld(world, worlddata, worldData, worlddata.worldGenSettings());
|
||||
+
|
||||
+ this.levels.put(world.getDimensionKey(), world);
|
||||
+ this.getPlayerList().setPlayerFileData(world);
|
||||
+ this.levels.put(world.dimension(), world);
|
||||
+ this.getPlayerList().addWorldborderListener(world);
|
||||
+
|
||||
+ if (worlddata.getCustomBossEvents() != null) {
|
||||
+ this.getBossBattleCustomData().load(worlddata.getCustomBossEvents());
|
||||
+ this.getCustomBossEvents().load(worlddata.getCustomBossEvents());
|
||||
+ }
|
||||
+ }
|
||||
this.updateWorldSettings();
|
||||
- this.loadSpawn(worldloadlistener);
|
||||
+ for (WorldServer worldserver : this.getWorlds()) {
|
||||
+ this.loadSpawn(worldserver.getChunkProvider().chunkMap.progressListener, worldserver);
|
||||
+ this.forceDifficulty();
|
||||
+ for (WorldServer worldserver : this.getAllLevels()) {
|
||||
+ this.prepareLevels(worldserver.getChunkSource().chunkMap.progressListener, worldserver);
|
||||
+ worldserver.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API
|
||||
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, dimensionmanager, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
|
||||
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
+ this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
||||
+ this.connection.acceptConnections();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
protected void updateWorldSettings() {}
|
||||
- this.levels.put(World.OVERWORLD, worldserver);
|
||||
- WorldPersistentData worldpersistentdata = worldserver.getDataStorage();
|
||||
+ protected void forceDifficulty() {}
|
||||
|
||||
- protected void a(WorldLoadListener worldloadlistener) {
|
||||
- IWorldDataServer iworlddataserver = this.worldData.H();
|
||||
- GeneratorSettings generatorsettings = this.worldData.getGeneratorSettings();
|
||||
- this.readScoreboard(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ // CraftBukkit start
|
||||
+ public void initWorld(WorldServer worldserver, IWorldDataServer iworlddataserver, SaveData saveData, GeneratorSettings generatorsettings) {
|
||||
boolean flag = generatorsettings.isDebugWorld();
|
||||
- long i = generatorsettings.getSeed();
|
||||
- long j = BiomeManager.a(i);
|
||||
- List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
|
||||
- RegistryMaterials<WorldDimension> registrymaterials = generatorsettings.d();
|
||||
- WorldDimension worlddimension = (WorldDimension) registrymaterials.a(WorldDimension.OVERWORLD);
|
||||
- DimensionManager dimensionmanager;
|
||||
- Object object;
|
||||
-
|
||||
- if (worlddimension == null) {
|
||||
- dimensionmanager = (DimensionManager) this.registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).d(DimensionManager.OVERWORLD_LOCATION);
|
||||
- object = GeneratorSettings.a(this.registryHolder.d(IRegistry.BIOME_REGISTRY), this.registryHolder.d(IRegistry.NOISE_GENERATOR_SETTINGS_REGISTRY), (new Random()).nextLong());
|
||||
- } else {
|
||||
- dimensionmanager = worlddimension.b();
|
||||
- object = worlddimension.c();
|
||||
+ boolean flag = generatorsettings.isDebug();
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver.generator != null) {
|
||||
+ worldserver.getWorld().getPopulators().addAll(worldserver.generator.getDefaultPopulators(worldserver.getWorld()));
|
||||
}
|
||||
-
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, dimensionmanager, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
|
||||
-
|
||||
- this.levels.put(World.OVERWORLD, worldserver);
|
||||
- WorldPersistentData worldpersistentdata = worldserver.getWorldPersistentData();
|
||||
-
|
||||
- this.initializeScoreboards(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ }
|
||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||
|
||||
worldborder.a(iworlddataserver.r());
|
||||
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(worldserver.getWorld())); // CraftBukkit - SPIGOT-5569
|
||||
if (!iworlddataserver.p()) {
|
||||
try {
|
||||
a(worldserver, iworlddataserver, generatorsettings.c(), flag);
|
||||
@@ -421,31 +646,8 @@
|
||||
|
||||
iworlddataserver.c(true);
|
||||
if (!iworlddataserver.isInitialized()) {
|
||||
@@ -411,31 +637,10 @@
|
||||
iworlddataserver.setInitialized(true);
|
||||
}
|
||||
-
|
||||
- this.getPlayerList().setPlayerFileData(worldserver);
|
||||
|
||||
- this.getPlayerList().addWorldborderListener(worldserver);
|
||||
- if (this.worldData.getCustomBossEvents() != null) {
|
||||
- this.getBossBattleCustomData().load(this.worldData.getCustomBossEvents());
|
||||
- this.getCustomBossEvents().load(this.worldData.getCustomBossEvents());
|
||||
- }
|
||||
-
|
||||
- Iterator iterator = registrymaterials.d().iterator();
|
||||
- Iterator iterator = registrymaterials.entrySet().iterator();
|
||||
-
|
||||
- while (iterator.hasNext()) {
|
||||
- Entry<ResourceKey<WorldDimension>, WorldDimension> entry = (Entry) iterator.next();
|
||||
- ResourceKey<WorldDimension> resourcekey = (ResourceKey) entry.getKey();
|
||||
-
|
||||
- if (resourcekey != WorldDimension.OVERWORLD) {
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.a(IRegistry.DIMENSION_REGISTRY, resourcekey.a());
|
||||
- DimensionManager dimensionmanager1 = ((WorldDimension) entry.getValue()).b();
|
||||
- ChunkGenerator chunkgenerator = ((WorldDimension) entry.getValue()).c();
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.create(IRegistry.DIMENSION_REGISTRY, resourcekey.location());
|
||||
- DimensionManager dimensionmanager1 = ((WorldDimension) entry.getValue()).type();
|
||||
- ChunkGenerator chunkgenerator = ((WorldDimension) entry.getValue()).generator();
|
||||
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.worldData, iworlddataserver);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, dimensionmanager1, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), false);
|
||||
-
|
||||
- worldborder.a((IWorldBorderListener) (new IWorldBorderListener.a(worldserver1.getWorldBorder())));
|
||||
- worldborder.addListener(new IWorldBorderListener.a(worldserver1.getWorldBorder()));
|
||||
- this.levels.put(resourcekey1, worldserver1);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
worldborder.applySettings(iworlddataserver.getWorldBorder());
|
||||
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(worldserver.getWorld())); // CraftBukkit - SPIGOT-5569
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
private static void a(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
|
||||
private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
|
||||
if (flag1) {
|
||||
@@ -458,6 +660,21 @@
|
||||
return biomebase.b().b();
|
||||
}, random);
|
||||
ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
|
||||
@@ -443,6 +648,21 @@
|
||||
} else {
|
||||
ChunkGenerator chunkgenerator = worldserver.getChunkSource().getGenerator();
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkgenerator.climateSampler().findSpawnPosition());
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver.generator != null) {
|
||||
+ Random rand = new Random(worldserver.getSeed());
|
||||
@@ -413,7 +415,7 @@
|
||||
+
|
||||
+ if (spawn != null) {
|
||||
+ if (spawn.getWorld() != worldserver.getWorld()) {
|
||||
+ throw new IllegalStateException("Cannot set spawn point for " + iworlddataserver.getName() + " to be in another world (" + spawn.getWorld().getName() + ")");
|
||||
+ throw new IllegalStateException("Cannot set spawn point for " + iworlddataserver.getLevelName() + " to be in another world (" + spawn.getWorld().getName() + ")");
|
||||
+ } else {
|
||||
+ iworlddataserver.setSpawn(new BlockPosition(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()), spawn.getYaw());
|
||||
+ return;
|
||||
@@ -421,97 +423,97 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
int i = chunkgenerator.getSpawnHeight(worldserver);
|
||||
|
||||
if (blockposition == null) {
|
||||
MinecraftServer.LOGGER.warn("Unable to find spawn biome");
|
||||
@@ -532,8 +749,15 @@
|
||||
if (i < worldserver.getMinBuildHeight()) {
|
||||
@@ -500,8 +720,15 @@
|
||||
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
|
||||
}
|
||||
|
||||
- public void loadSpawn(WorldLoadListener worldloadlistener) {
|
||||
- WorldServer worldserver = this.E();
|
||||
- public void prepareLevels(WorldLoadListener worldloadlistener) {
|
||||
- WorldServer worldserver = this.overworld();
|
||||
+ // CraftBukkit start
|
||||
+ public void loadSpawn(WorldLoadListener worldloadlistener, WorldServer worldserver) {
|
||||
+ public void prepareLevels(WorldLoadListener worldloadlistener, WorldServer worldserver) {
|
||||
+ if (!worldserver.getWorld().getKeepSpawnInMemory()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // WorldServer worldserver = this.E();
|
||||
+ // WorldServer worldserver = this.overworld();
|
||||
+ this.forceTicks = true;
|
||||
+ // CraftBukkit end
|
||||
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a());
|
||||
BlockPosition blockposition = worldserver.getSpawn();
|
||||
@@ -546,16 +770,20 @@
|
||||
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
@@ -514,16 +741,20 @@
|
||||
chunkproviderserver.addRegionTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
|
||||
while (chunkproviderserver.b() != 441) {
|
||||
- this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.sleepForTick();
|
||||
while (chunkproviderserver.getTickingGenerated() != 441) {
|
||||
- this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
- this.waitUntilNextTick();
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ // this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
+ this.executeModerately();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.sleepForTick();
|
||||
- this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
- this.waitUntilNextTick();
|
||||
- Iterator iterator = this.levels.values().iterator();
|
||||
-
|
||||
- while (iterator.hasNext()) {
|
||||
- WorldServer worldserver1 = (WorldServer) iterator.next();
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ // this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
+ this.executeModerately();
|
||||
+ // Iterator iterator = this.worldServer.values().iterator();
|
||||
+ // Iterator iterator = this.levels.values().iterator();
|
||||
+
|
||||
+ if (true) {
|
||||
+ WorldServer worldserver1 = worldserver;
|
||||
+ // CraftBukkit end
|
||||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getWorldPersistentData().a(ForcedChunk::b, "chunks");
|
||||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk::load, "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
@@ -570,11 +798,18 @@
|
||||
@@ -538,11 +769,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.sleepForTick();
|
||||
- this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
- this.waitUntilNextTick();
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ // this.nextTickTime = SystemUtils.getMillis() + 10L;
|
||||
+ this.executeModerately();
|
||||
+ // CraftBukkit end
|
||||
worldloadlistener.b();
|
||||
chunkproviderserver.getLightEngine().a(5);
|
||||
- this.updateSpawnFlags();
|
||||
worldloadlistener.stop();
|
||||
chunkproviderserver.getLightEngine().setTaskPerBatch(5);
|
||||
- this.updateMobSpawningFlags();
|
||||
+ // CraftBukkit start
|
||||
+ // this.updateSpawnFlags();
|
||||
+ worldserver.setSpawnFlags(this.getSpawnMonsters(), this.getSpawnAnimals());
|
||||
+ // this.updateMobSpawningFlags();
|
||||
+ worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals());
|
||||
+
|
||||
+ this.forceTicks = false;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected void loadResourcesZip() {
|
||||
@@ -619,12 +854,16 @@
|
||||
protected void detectBundledResources() {
|
||||
@@ -587,12 +825,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - moved to WorldServer.save
|
||||
+ /*
|
||||
WorldServer worldserver1 = this.E();
|
||||
IWorldDataServer iworlddataserver = this.worldData.H();
|
||||
WorldServer worldserver1 = this.overworld();
|
||||
IWorldDataServer iworlddataserver = this.worldData.overworldData();
|
||||
|
||||
iworlddataserver.a(worldserver1.getWorldBorder().t());
|
||||
this.worldData.setCustomBossEvents(this.getBossBattleCustomData().save());
|
||||
this.storageSource.a(this.registryHolder, this.worldData, this.getPlayerList().save());
|
||||
iworlddataserver.setWorldBorder(worldserver1.getWorldBorder().createSettings());
|
||||
this.worldData.setCustomBossEvents(this.getCustomBossEvents().save());
|
||||
this.storageSource.saveDataTag(this.registryHolder, this.worldData, this.getPlayerList().getSingleplayerData());
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
if (flag1) {
|
||||
Iterator iterator1 = this.getWorlds().iterator();
|
||||
Iterator iterator1 = this.getAllLevels().iterator();
|
||||
|
||||
@@ -645,8 +884,29 @@
|
||||
this.stop();
|
||||
@@ -627,8 +869,29 @@
|
||||
this.stopServer();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@@ -524,7 +526,7 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void stop() {
|
||||
public void stopServer() {
|
||||
+ // CraftBukkit start - prevent double stopping on multiple threads
|
||||
+ synchronized(stopLock) {
|
||||
+ if (hasStopped) return;
|
||||
@@ -537,20 +539,20 @@
|
||||
+ this.server.disablePlugins();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.getServerConnection() != null) {
|
||||
this.getServerConnection().b();
|
||||
if (this.getConnection() != null) {
|
||||
this.getConnection().stop();
|
||||
}
|
||||
@@ -655,6 +915,7 @@
|
||||
@@ -638,6 +901,7 @@
|
||||
MinecraftServer.LOGGER.info("Saving players");
|
||||
this.playerList.savePlayers();
|
||||
this.playerList.shutdown();
|
||||
this.playerList.saveAll();
|
||||
this.playerList.removeAll();
|
||||
+ try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
|
||||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -732,9 +993,10 @@
|
||||
@@ -712,9 +976,10 @@
|
||||
while (this.running) {
|
||||
long i = SystemUtils.getMonotonicMillis() - this.nextTickTime;
|
||||
long i = SystemUtils.getMillis() - this.nextTickTime;
|
||||
|
||||
- if (i > 2000L && this.nextTickTime - this.lastOverloadWarning >= 15000L) {
|
||||
+ if (i > 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit
|
||||
@@ -560,62 +562,71 @@
|
||||
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;
|
||||
@@ -745,6 +1007,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.a(SystemUtils.getMonotonicNanos(), this.tickCount);
|
||||
@@ -725,6 +990,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.a(SystemUtils.getNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
this.nextTickTime += 50L;
|
||||
this.bh();
|
||||
this.profiler.enter("tick");
|
||||
@@ -790,6 +1053,12 @@
|
||||
} catch (Throwable throwable1) {
|
||||
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
|
||||
} finally {
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
@@ -775,6 +1041,12 @@
|
||||
this.profileCache.clearExecutor();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Restore terminal to original settings
|
||||
+ try {
|
||||
+ reader.getTerminal().restore();
|
||||
+ } catch (Exception ignored) {
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.exit();
|
||||
this.onServerExit();
|
||||
}
|
||||
|
||||
@@ -798,8 +1067,15 @@
|
||||
@@ -783,8 +1055,15 @@
|
||||
}
|
||||
|
||||
private boolean canSleepForTick() {
|
||||
- return this.isEntered() || SystemUtils.getMonotonicMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
private boolean haveTime() {
|
||||
- return this.runningTask() || SystemUtils.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ // CraftBukkit start
|
||||
+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ return this.forceTicks || this.runningTask() || SystemUtils.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ }
|
||||
+
|
||||
+ private void executeModerately() {
|
||||
+ this.executeAll();
|
||||
+ this.runAllTasks();
|
||||
+ java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
protected void sleepForTick() {
|
||||
this.executeAll();
|
||||
@@ -908,7 +1184,7 @@
|
||||
this.status.b().a(agameprofile);
|
||||
protected void waitUntilNextTick() {
|
||||
this.runAllTasks();
|
||||
@@ -830,7 +1109,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- protected void doRunTask(TickTask ticktask) {
|
||||
+ public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
|
||||
this.getProfiler().incrementCounter("runTask");
|
||||
super.doRunTask(ticktask);
|
||||
}
|
||||
@@ -901,7 +1180,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (this.tickCount % 6000 == 0) {
|
||||
+ if (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0) { // CraftBukkit
|
||||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.profiler.enter("save");
|
||||
this.playerList.savePlayers();
|
||||
@@ -938,22 +1214,39 @@
|
||||
this.profiler.push("save");
|
||||
this.saveEverything(true, false, false);
|
||||
@@ -920,22 +1199,39 @@
|
||||
}
|
||||
|
||||
public void b(BooleanSupplier booleansupplier) {
|
||||
public void tickChildren(BooleanSupplier booleansupplier) {
|
||||
+ this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
|
||||
this.profiler.enter("commandFunctions");
|
||||
this.getFunctionData().tick();
|
||||
this.profiler.exitEnter("levels");
|
||||
Iterator iterator = this.getWorlds().iterator();
|
||||
this.profiler.push("commandFunctions");
|
||||
this.getFunctions().tick();
|
||||
this.profiler.popPush("levels");
|
||||
Iterator iterator = this.getAllLevels().iterator();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ // Run tasks that are waiting on processing
|
||||
@@ -627,27 +638,27 @@
|
||||
+ if (this.tickCount % 20 == 0) {
|
||||
+ for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
||||
+ EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.level.getTime(), entityplayer.getPlayerTime(), entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
||||
+ entityplayer.connection.send(new PacketPlayOutUpdateTime(entityplayer.level.getGameTime(), entityplayer.getPlayerTime(), entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
this.profiler.a(() -> {
|
||||
return worldserver + " " + worldserver.getDimensionKey().a();
|
||||
this.profiler.push(() -> {
|
||||
return worldserver + " " + worldserver.dimension().location();
|
||||
});
|
||||
+ /* Drop global time updates
|
||||
if (this.tickCount % 20 == 0) {
|
||||
this.profiler.enter("timeSync");
|
||||
this.playerList.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))), worldserver.getDimensionKey());
|
||||
this.profiler.exit();
|
||||
this.profiler.push("timeSync");
|
||||
this.playerList.broadcastAll(new PacketPlayOutUpdateTime(worldserver.getGameTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)), worldserver.dimension());
|
||||
this.profiler.pop();
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
this.profiler.enter("tick");
|
||||
this.profiler.push("tick");
|
||||
|
||||
@@ -1042,7 +1335,7 @@
|
||||
@@ -1024,7 +1320,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
@@ -655,35 +666,44 @@
|
||||
+ return server.getName(); // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public SystemReport b(SystemReport systemreport) {
|
||||
@@ -1414,16 +1707,17 @@
|
||||
public SystemReport fillSystemReport(SystemReport systemreport) {
|
||||
@@ -1351,16 +1647,17 @@
|
||||
|
||||
public CompletableFuture<Void> a(Collection<String> collection) {
|
||||
public CompletableFuture<Void> reloadResources(Collection<String> collection) {
|
||||
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
|
||||
- Stream stream = collection.stream();
|
||||
+ Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
|
||||
ResourcePackRepository resourcepackrepository = this.packRepository;
|
||||
|
||||
Objects.requireNonNull(this.packRepository);
|
||||
- return (ImmutableList) stream.map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList());
|
||||
+ return stream.map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error
|
||||
- return (ImmutableList) stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(ResourcePackLoader::open).collect(ImmutableList.toImmutableList());
|
||||
+ return stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(ResourcePackLoader::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error
|
||||
}, this).thenCompose((immutablelist) -> {
|
||||
return DataPackResources.a(immutablelist, this.registryHolder, this.k() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.i(), this.executor, this);
|
||||
return DataPackResources.loadResources(immutablelist, this.registryHolder, this.isDedicatedServer() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.getFunctionCompilationLevel(), this.executor, this);
|
||||
}).thenAcceptAsync((datapackresources) -> {
|
||||
this.resources.close();
|
||||
this.resources = datapackresources;
|
||||
+ this.server.syncCommands(); // SPIGOT-5884: Lost on reload
|
||||
this.packRepository.a(collection);
|
||||
this.worldData.a(a(this.packRepository));
|
||||
datapackresources.j();
|
||||
@@ -1768,6 +2062,22 @@
|
||||
this.packRepository.setSelected(collection);
|
||||
this.worldData.setDataPackConfig(getSelectedPacks(this.packRepository));
|
||||
datapackresources.updateGlobals();
|
||||
@@ -1714,7 +2011,7 @@
|
||||
try {
|
||||
label51:
|
||||
{
|
||||
- ArrayList arraylist;
|
||||
+ ArrayList<NativeModuleLister.a> arraylist; // CraftBukkit - decompile error
|
||||
|
||||
try {
|
||||
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
|
||||
@@ -1764,6 +2061,22 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public boolean isMainThread() {
|
||||
+ return super.isMainThread() || this.isStopped(); // CraftBukkit - MC-142590
|
||||
+ public boolean isSameThread() {
|
||||
+ return super.isSameThread() || this.isStopped(); // CraftBukkit - MC-142590
|
||||
+ }
|
||||
+
|
||||
+ public boolean isDebugging() {
|
||||
@@ -696,6 +716,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private void bh() {
|
||||
private void startMetricsRecordingTick() {
|
||||
if (this.willStartRecordingMetrics) {
|
||||
this.metricsRecorder = ActiveMetricsRecorder.a(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.k()), SystemUtils.timeSource, SystemUtils.g(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
|
||||
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
|
||||
|
||||
Reference in New Issue
Block a user