This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package io.papermc.paper;
|
package io.papermc.paper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
|
import me.sashegdev.delta.DeltaBuild;
|
||||||
import net.minecraft.SharedConstants;
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.server.Main;
|
import net.minecraft.server.Main;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -32,7 +34,9 @@ public final class PaperBootstrap {
|
|||||||
final String osArch = System.getProperty("os.arch");
|
final String osArch = System.getProperty("os.arch");
|
||||||
|
|
||||||
final ServerBuildInfo bi = ServerBuildInfo.buildInfo();
|
final ServerBuildInfo bi = ServerBuildInfo.buildInfo();
|
||||||
return List.of(
|
// Delta start - experimental core banner
|
||||||
|
final List<String> messages = new ArrayList<>(4 + 16);
|
||||||
|
messages.add(
|
||||||
String.format(
|
String.format(
|
||||||
"Running Java %s (%s %s; %s %s) on %s %s (%s)",
|
"Running Java %s (%s %s; %s %s) on %s %s (%s)",
|
||||||
javaSpecVersion,
|
javaSpecVersion,
|
||||||
@@ -43,7 +47,9 @@ public final class PaperBootstrap {
|
|||||||
osName,
|
osName,
|
||||||
osVersion,
|
osVersion,
|
||||||
osArch
|
osArch
|
||||||
),
|
)
|
||||||
|
);
|
||||||
|
messages.add(
|
||||||
String.format(
|
String.format(
|
||||||
"Loading %s %s for Minecraft %s",
|
"Loading %s %s for Minecraft %s",
|
||||||
bi.brandName(),
|
bi.brandName(),
|
||||||
@@ -51,5 +57,8 @@ public final class PaperBootstrap {
|
|||||||
bi.minecraftVersionId()
|
bi.minecraftVersionId()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
messages.addAll(DeltaBuild.startupMessages(bi));
|
||||||
|
return List.copyOf(messages);
|
||||||
|
// Delta end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package me.sashegdev.delta;
|
||||||
|
|
||||||
|
import io.papermc.paper.ServerBuildInfo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delta — экспериментальное ядро на базе Paper для узких задач.
|
||||||
|
*
|
||||||
|
* <p>Совместимость намеренно полная: группа и версия артефакта остаются
|
||||||
|
* стоковыми ({@code io.papermc.paper} / {@code 1.21.8-R0.1-SNAPSHOT}), все
|
||||||
|
* публичные пакеты Bukkit/Paper на месте. Отличие — только брендинг
|
||||||
|
* ({@code Brand-Name} => Delta, видно в F3 как {@code server: Delta})
|
||||||
|
* и набор патчей, перечисленных ниже.
|
||||||
|
*/
|
||||||
|
public final class DeltaBuild {
|
||||||
|
|
||||||
|
public static final String BRAND = "Delta";
|
||||||
|
public static final String PACKAGE = "me.sashegdev.delta";
|
||||||
|
|
||||||
|
private DeltaBuild() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Зарегистрированные кастомные возможности: имя -> краткое описание состояния. */
|
||||||
|
private static final Map<String, Supplier<String>> FEATURES = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Зарегистрировать кастомную фичу ядра. Вызывается из инициализаторов
|
||||||
|
* модулей до {@link #startupMessages(ServerBuildInfo)}.
|
||||||
|
*/
|
||||||
|
public static synchronized void register(final String name, final Supplier<String> status) {
|
||||||
|
FEATURES.put(name, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Баннер + предупреждение, которые печатаются в лог при старте. */
|
||||||
|
public static List<String> startupMessages(final ServerBuildInfo buildInfo) {
|
||||||
|
final List<String> lines = new ArrayList<>();
|
||||||
|
lines.add("-----------------------------------------------------");
|
||||||
|
lines.add(" " + BRAND + " - experimental server core");
|
||||||
|
lines.add(" version : " + buildInfo.brandName() + " " + buildInfo.asString(ServerBuildInfo.StringRepresentation.VERSION_FULL));
|
||||||
|
lines.add(" mc : " + buildInfo.minecraftVersionId());
|
||||||
|
lines.add(" api : " + buildInfo.brandId().asString());
|
||||||
|
lines.add(" built : " + buildInfo.buildTime());
|
||||||
|
if (buildInfo.gitCommit().isPresent()) {
|
||||||
|
lines.add(" commit : " + buildInfo.gitCommit().get()
|
||||||
|
+ (buildInfo.gitBranch().isPresent() ? " (" + buildInfo.gitBranch().get() + ")" : ""));
|
||||||
|
}
|
||||||
|
lines.add(" NOTE : this core is built for a specific workload and is");
|
||||||
|
lines.add(" NOT intended for public/general distribution.");
|
||||||
|
lines.add(" No stability or security guarantees are provided.");
|
||||||
|
lines.add("-----------------------------------------------------");
|
||||||
|
if (FEATURES.isEmpty()) {
|
||||||
|
lines.add(" delta : no custom features registered");
|
||||||
|
} else {
|
||||||
|
lines.add(" delta : custom features enabled");
|
||||||
|
synchronized (DeltaBuild.class) {
|
||||||
|
FEATURES.forEach((name, status) -> lines.add(" - " + name + ": " + status.get()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lines.add("-----------------------------------------------------");
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user