Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
276afaa2ea
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: c2d72c82 SPIGOT-3102: Add EXPLOSION SpawnReason CraftBukkit Changes:fca41573
SPIGOT-5136: EntityPortalEvent getting called on interdimensional entity teleports604c8bf0
SPIGOT-3102: Add EXPLOSION SpawnReason375969a6
Re-add chunk GC for plugin chunk loads58151368
SPIGOT-5123: Snapshot tile entities can end up with a non-null world491c8482
SPIGOT-5130: PersistentDataContainer not removing values on TileEntities Spigot Changes: d05d3c1f Rebuild patches
103 Zeilen
5.1 KiB
Diff
103 Zeilen
5.1 KiB
Diff
From d029d7a61a76120f7d9e20a632d6bb6e467fea1c Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Mon, 17 Sep 2018 23:05:31 -0400
|
|
Subject: [PATCH] Support Overriding World Seeds
|
|
|
|
Allows you to add to paper.yml
|
|
|
|
seed-overrides:
|
|
world_name: some seed value
|
|
|
|
This will ignore every where a seed is set/created/loaded and force
|
|
a world to use the specified seed.
|
|
|
|
This seed will end up being saved to the world data file, so it is
|
|
a permanent change in that it won't go back if you remove it from paper.yml
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
index a13c8c68b6..ea3695b021 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -11,6 +11,7 @@ import java.lang.reflect.Modifier;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
+import java.util.Set;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
@@ -20,6 +21,7 @@ import com.google.common.collect.Lists;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.command.Command;
|
|
+import org.bukkit.configuration.ConfigurationSection;
|
|
import org.bukkit.configuration.InvalidConfigurationException;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
import co.aikar.timings.Timings;
|
|
@@ -334,4 +336,23 @@ public class PaperConfig {
|
|
}
|
|
tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
|
|
}
|
|
+
|
|
+ public static Map<String, Long> seedOverride = new java.util.HashMap<>();
|
|
+ private static void worldSeedOverrides() {
|
|
+ ConfigurationSection seeds = config.getConfigurationSection("seed-overrides");
|
|
+ if (seeds != null) {
|
|
+ TimingsManager.hiddenConfigs.add("seed-overrides");
|
|
+ for (String key : seeds.getKeys(false)) {
|
|
+ String seedString = seeds.getString(key);
|
|
+ long seed;
|
|
+ try {
|
|
+ seed = Long.parseLong(seedString);
|
|
+ } catch (Exception e) {
|
|
+ seed = (long) seedString.hashCode();
|
|
+ }
|
|
+ log("Seed Override: " + key + " => " + seed);
|
|
+ seedOverride.put(key, seed);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 6c7ce47c5a..ac80ec7aeb 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -362,7 +362,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
this.convertWorld(name); // Run conversion now
|
|
|
|
org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
|
|
- WorldSettings worldsettings = new WorldSettings(i, this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype);
|
|
+ WorldSettings worldsettings = new WorldSettings(com.destroystokyo.paper.PaperConfig.seedOverride.getOrDefault(name, i), this.getGamemode(), this.getGenerateStructures(), this.isHardcore(), worldtype); // Paper
|
|
worldsettings.setGeneratorSettings(jsonelement);
|
|
|
|
if (j == 0) {
|
|
diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java
|
|
index cbf10c0bce..ca4c314589 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldData.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldData.java
|
|
@@ -115,7 +115,7 @@ public class WorldData {
|
|
this.d = nbttagcompound2.getBoolean("Snapshot");
|
|
}
|
|
|
|
- this.e = nbttagcompound.getLong("RandomSeed");
|
|
+ this.e = com.destroystokyo.paper.PaperConfig.seedOverride.getOrDefault(nbttagcompound.getString("LevelName"), nbttagcompound.getLong("RandomSeed")); // Paper
|
|
if (nbttagcompound.hasKeyOfType("generatorName", 8)) {
|
|
String s = nbttagcompound.getString("generatorName");
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index e7ac058fc7..711f282663 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -990,7 +990,7 @@ public final class CraftServer implements Server {
|
|
WorldSettings worldSettings;
|
|
// See MinecraftServer.a(String, String, long, WorldType, JsonElement)
|
|
if (worlddata == null) {
|
|
- worldSettings = new WorldSettings(creator.seed(), EnumGamemode.getById(getDefaultGameMode().getValue()), generateStructures, hardcore, type);
|
|
+ worldSettings = new WorldSettings(com.destroystokyo.paper.PaperConfig.seedOverride.getOrDefault(name, creator.seed()), EnumGamemode.getById(getDefaultGameMode().getValue()), generateStructures, hardcore, type); // Paper
|
|
JsonElement parsedSettings = new JsonParser().parse(creator.generatorSettings());
|
|
if (parsedSettings.isJsonObject()) {
|
|
worldSettings.setGeneratorSettings(parsedSettings.getAsJsonObject());
|
|
--
|
|
2.22.0
|
|
|