Skip to content

Commit e4d410a

Browse files
committed
[Bukkit] 26.1.1
1 parent e45263a commit e4d410a

File tree

14 files changed

+5025
-2
lines changed

14 files changed

+5025
-2
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ errorprone-annotations = { module = "com.google.errorprone:error_prone_annotatio
5050
# https://maven.fabricmc.net/net/fabricmc/sponge-mixin/
5151
fabric-mixin = "net.fabricmc:sponge-mixin:0.17.0+mixin.0.8.7"
5252

53-
paperweight = "io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:2.0.0-beta.19"
53+
paperweight = "io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:2.0.0-beta.21"
5454

5555
linBus-bom = "org.enginehub.lin-bus:lin-bus-bom:0.2.0"
5656
linBus-common.module = "org.enginehub.lin-bus:lin-bus-common"

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ includeBuild("build-logic")
8383

8484
include("worldedit-libs")
8585

86-
listOf("1.21.4", "1.21.5", "1.21.6", "1.21.9", "1.21.11").forEach {
86+
listOf("1.21.4", "1.21.5", "1.21.6", "1.21.9", "1.21.11", "26.1").forEach {
8787
include("worldedit-bukkit:adapters:adapter-$it")
8888
}
8989

worldedit-bukkit/adapters/adapter-1.21.11/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/v1_21_11/PaperweightAdapter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
237237
if (dataVersion != Constants.DATA_VERSION_MC_1_21_11) {
238238
logger.warning(WRONG_VERSION);
239239
}
240+
if (dataVersion >= Constants.DATA_VERSION_MC_26_1) {
241+
throw new RuntimeException("Force prevent this loading on 26.1+");
242+
}
240243

241244
serverWorldsField = CraftServer.class.getDeclaredField("worlds");
242245
serverWorldsField.setAccessible(true);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension
2+
3+
plugins {
4+
id("buildlogic.adapter-mojmap")
5+
}
6+
7+
dependencies {
8+
// https://artifactory.papermc.io/ui/native/universe/io/papermc/paper/dev-bundle/
9+
the<PaperweightUserDependenciesExtension>().paperDevBundle("26.1.1.build.14-alpha")
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* WorldEdit, a Minecraft world manipulation toolkit
3+
* Copyright (C) sk89q <http://www.sk89q.com>
4+
* Copyright (C) WorldEdit team and contributors
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
*/
19+
20+
package com.sk89q.worldedit.bukkit.adapter.impl.v26_1;
21+
22+
import com.google.gson.Gson;
23+
import com.google.gson.GsonBuilder;
24+
import com.google.gson.JsonElement;
25+
import com.google.gson.JsonParseException;
26+
import com.google.gson.JsonParser;
27+
import com.google.gson.Strictness;
28+
import com.google.gson.stream.JsonReader;
29+
import com.mojang.serialization.JsonOps;
30+
import net.minecraft.core.HolderLookup;
31+
import net.minecraft.network.chat.Component;
32+
import net.minecraft.network.chat.ComponentSerialization;
33+
import net.minecraft.network.chat.MutableComponent;
34+
35+
import java.io.StringReader;
36+
import javax.annotation.Nullable;
37+
38+
public class ComponentConverter {
39+
40+
public static class Serializer {
41+
private static final Gson GSON = new GsonBuilder().disableHtmlEscaping().create();
42+
43+
private Serializer() {
44+
}
45+
46+
static MutableComponent deserialize(JsonElement json, HolderLookup.Provider registries) {
47+
return (MutableComponent) ComponentSerialization.CODEC.parse(registries.createSerializationContext(JsonOps.INSTANCE), json).getOrThrow(JsonParseException::new);
48+
}
49+
50+
static JsonElement serialize(Component text, HolderLookup.Provider registries) {
51+
return ComponentSerialization.CODEC.encodeStart(registries.createSerializationContext(JsonOps.INSTANCE), text).getOrThrow(JsonParseException::new);
52+
}
53+
54+
public static String toJson(Component text, HolderLookup.Provider registries) {
55+
return GSON.toJson(serialize(text, registries));
56+
}
57+
58+
@Nullable
59+
public static MutableComponent fromJson(String json, HolderLookup.Provider registries) {
60+
JsonElement jsonelement = JsonParser.parseString(json);
61+
return jsonelement == null ? null : deserialize(jsonelement, registries);
62+
}
63+
64+
@Nullable
65+
public static MutableComponent fromJson(@Nullable JsonElement json, HolderLookup.Provider registries) {
66+
return json == null ? null : deserialize(json, registries);
67+
}
68+
69+
@Nullable
70+
public static MutableComponent fromJsonLenient(String json, HolderLookup.Provider registries) {
71+
JsonReader jsonreader = new JsonReader(new StringReader(json));
72+
jsonreader.setStrictness(Strictness.LENIENT);
73+
JsonElement jsonelement = JsonParser.parseReader(jsonreader);
74+
return jsonelement == null ? null : deserialize(jsonelement, registries);
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)