mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
fix chat_type issue
This commit is contained in:
parent
fca0167880
commit
8a37019dc2
4 changed files with 74 additions and 11 deletions
|
@ -5638,11 +5638,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer$Provider
|
+++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer$Provider
|
||||||
@@ -0,0 +1 @@
|
@@ -0,0 +1 @@
|
||||||
+io.papermc.paper.adventure.providers.PlainTextComponentSerializerProviderImpl
|
+io.papermc.paper.adventure.providers.PlainTextComponentSerializerProviderImpl
|
||||||
diff --git a/src/main/resources/data/paper/chat_type/raw.json b/src/main/resources/data/paper/chat_type/raw.json
|
diff --git a/src/main/resources/data/minecraft/datapacks/paper/data/paper/chat_type/raw.json b/src/main/resources/data/minecraft/datapacks/paper/data/paper/chat_type/raw.json
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/resources/data/paper/chat_type/raw.json
|
+++ b/src/main/resources/data/minecraft/datapacks/paper/data/paper/chat_type/raw.json
|
||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
+{
|
+{
|
||||||
+ "chat": {
|
+ "chat": {
|
||||||
|
|
|
@ -110,6 +110,52 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
.applyDevelopmentConfig()
|
.applyDevelopmentConfig()
|
||||||
.pushJarResources()
|
.pushJarResources()
|
||||||
.build(VANILLA_PACK_INFO);
|
.build(VANILLA_PACK_INFO);
|
||||||
|
@@ -0,0 +0,0 @@ public class ServerPacksSource extends BuiltInPackSource {
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
protected Pack createBuiltinPack(String fileName, Pack.ResourcesSupplier packFactory, Component displayName) {
|
||||||
|
- return Pack.readMetaAndCreate(createBuiltInPackLocation(fileName, displayName), packFactory, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG);
|
||||||
|
+ // Paper start - custom built-in pack
|
||||||
|
+ final PackLocationInfo info;
|
||||||
|
+ if ("paper".equals(fileName)) {
|
||||||
|
+ info = new PackLocationInfo(fileName, displayName, PackSource.BUILT_IN, Optional.empty());
|
||||||
|
+ } else {
|
||||||
|
+ info = createBuiltInPackLocation(fileName, displayName);
|
||||||
|
+ }
|
||||||
|
+ return Pack.readMetaAndCreate(info, packFactory, PackType.SERVER_DATA, FEATURE_SELECTION_CONFIG);
|
||||||
|
+ // Paper end - custom built-in pack
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PackRepository createPackRepository(Path dataPacksPath, DirectoryValidator symlinkFinder) {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/DataPackConfig.java b/src/main/java/net/minecraft/world/level/DataPackConfig.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/DataPackConfig.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/DataPackConfig.java
|
||||||
|
@@ -0,0 +0,0 @@ public class DataPackConfig {
|
||||||
|
public static final DataPackConfig DEFAULT = new DataPackConfig(ImmutableList.of("vanilla"), ImmutableList.of());
|
||||||
|
public static final Codec<DataPackConfig> CODEC = RecordCodecBuilder.create(
|
||||||
|
instance -> instance.group(
|
||||||
|
- Codec.STRING.listOf().fieldOf("Enabled").forGetter(settings -> settings.enabled),
|
||||||
|
- Codec.STRING.listOf().fieldOf("Disabled").forGetter(settings -> settings.disabled)
|
||||||
|
+ Codec.STRING.listOf().validate(DataPackConfig::ensureEnabled).fieldOf("Enabled").forGetter(settings -> settings.enabled), // Paper - ensure "paper" is always enabled
|
||||||
|
+ Codec.STRING.listOf().validate(DataPackConfig::ensureNotDisabled).fieldOf("Disabled").forGetter(settings -> settings.disabled) // Paper - ensure "paper" is always enabled
|
||||||
|
)
|
||||||
|
.apply(instance, DataPackConfig::new)
|
||||||
|
);
|
||||||
|
@@ -0,0 +0,0 @@ public class DataPackConfig {
|
||||||
|
public List<String> getDisabled() {
|
||||||
|
return this.disabled;
|
||||||
|
}
|
||||||
|
+ // Paper start - ensure "paper" datapack is always enabled
|
||||||
|
+ private static com.mojang.serialization.DataResult<List<String>> ensureEnabled(final List<String> enabled) {
|
||||||
|
+ return com.mojang.serialization.DataResult.success(enabled.contains("paper") ? enabled: io.papermc.paper.util.MCUtil.copyListAndAdd(enabled, "paper"));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static com.mojang.serialization.DataResult<List<String>> ensureNotDisabled(final List<String> disabled) {
|
||||||
|
+ return com.mojang.serialization.DataResult.success(io.papermc.paper.util.MCUtil.copyListAndRemoveIf(disabled, "paper"::equals));
|
||||||
|
+ }
|
||||||
|
+ // Paper end - ensure "paper" datapack is always enabled
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
|
@ -139,6 +185,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
diff --git a/src/main/resources/data/.paperassetsroot b/src/main/resources/data/.paperassetsroot
|
diff --git a/src/main/resources/data/.paperassetsroot b/src/main/resources/data/.paperassetsroot
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
diff --git a/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta b/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta
|
||||||
|
@@ -0,0 +0,0 @@
|
||||||
|
+{
|
||||||
|
+ "pack": {
|
||||||
|
+ "description": "Built-in Paper Datapack",
|
||||||
|
+ "pack_format": 41
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
||||||
|
|
|
@ -35,11 +35,20 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
private final StructureTemplateManager structureTemplateManager;
|
||||||
|
private final ServerTickRateManager tickRateManager;
|
||||||
|
protected WorldData worldData;
|
||||||
|
- private final PotionBrewing potionBrewing;
|
||||||
|
+ public PotionBrewing potionBrewing; // Paper - private -> public (remove final)
|
||||||
|
private volatile boolean isSaving;
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
this.worldData.setDataConfiguration(worlddataconfiguration);
|
this.worldData.setDataConfiguration(worlddataconfiguration);
|
||||||
this.resources.managers.updateRegistryTags();
|
this.resources.managers.updateRegistryTags();
|
||||||
+ this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
|
+ this.potionBrewing = this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
|
||||||
this.getPlayerList().saveAll();
|
this.getPlayerList().saveAll();
|
||||||
this.getPlayerList().reloadResources();
|
this.getPlayerList().reloadResources();
|
||||||
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
|
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
|
||||||
|
@ -146,12 +155,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ return CUSTOM_MIXES.remove(key) != null;
|
+ return CUSTOM_MIXES.remove(key) != null;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public void reload(FeatureFlagSet flags) {
|
+ public PotionBrewing reload(FeatureFlagSet flags) {
|
||||||
+ potionMixes.clear();
|
+ return bootstrap(flags);
|
||||||
+ containerMixes.clear();
|
|
||||||
+ containers.clear();
|
|
||||||
+ CUSTOM_MIXES.clear();
|
|
||||||
+ bootstrap(flags);
|
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Custom Potion Mixes
|
+ // Paper end - Custom Potion Mixes
|
||||||
+
|
+
|
||||||
|
@ -286,7 +291,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void resetPotionMixes() {
|
+ public void resetPotionMixes() {
|
||||||
+ this.minecraftServer.potionBrewing().reload(this.minecraftServer.getWorldData().enabledFeatures());
|
+ this.minecraftServer.potionBrewing = this.minecraftServer.potionBrewing().reload(this.minecraftServer.getWorldData().enabledFeatures());
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+}
|
+}
|
||||||
|
|
|
@ -219,7 +219,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
this.worldData.setDataConfiguration(worlddataconfiguration);
|
this.worldData.setDataConfiguration(worlddataconfiguration);
|
||||||
this.resources.managers.updateRegistryTags();
|
this.resources.managers.updateRegistryTags();
|
||||||
this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
|
this.potionBrewing = this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
|
||||||
- this.getPlayerList().saveAll();
|
- this.getPlayerList().saveAll();
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ if (Thread.currentThread() != this.serverThread) {
|
+ if (Thread.currentThread() != this.serverThread) {
|
||||||
|
|
Loading…
Reference in a new issue