This commit is contained in:
AlphaKR93
2025-02-19 12:56:37 +09:00
parent 7e1f20905c
commit 6958022ef9
26 changed files with 1515 additions and 32928 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,49 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <contact@granny.dev>
Date: Thu, 18 Jan 2024 21:01:12 +0900
Subject: [PATCH] Purpur Generated API Changes
PurpurMC
Copyright (C) 2024 PurpurMC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 35dfd25f21ca67b7f4d69326500980f4a021ef49..a9816fbfa466b3fe3f82c19aeeeb564c660e4b6a 100644
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -441,6 +441,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
+ // Purpur start
+ GoalKey<Mob> MOB_HAS_RIDER = GoalKey.of(Mob.class, NamespacedKey.minecraft("has_rider"));
+ GoalKey<AbstractHorse> HORSE_HAS_RIDER = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("horse_has_rider"));
+ GoalKey<Llama> LLAMA_HAS_RIDER = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_has_rider"));
+ GoalKey<Phantom> FIND_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("find_crystal"));
+ GoalKey<Phantom> ORBIT_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("orbit_crystal"));
+ GoalKey<Drowned> DROWNED_ATTACK_VILLAGER = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack_villager"));
+ GoalKey<Zombie> ZOMBIE_ATTACK_VILLAGER = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_villager"));
+ GoalKey<Wolf> AVOID_RABID_WOLF = GoalKey.of(Wolf.class, NamespacedKey.minecraft("avoid_rabid_wolf"));
+ GoalKey<IronGolem> RECEIVE_FLOWER = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("receive_flower"));
+ // Purpur end
+
private static <T extends Mob> GoalKey<T> create(final String key, final Class<T> type) {
return GoalKey.of(type, NamespacedKey.minecraft(key));
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,71 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 2 Nov 2024 15:26:27 +0900
Subject: [PATCH] mc dev fixes
diff --git a/src/main/java/net/minecraft/server/commands/DebugCommand.java b/src/main/java/net/minecraft/server/commands/DebugCommand.java
index 06568cc308e06b16f43ec7facd5e2c4e36f3fee9..c3374d11753d8cd152784727bf7ed08d18931136 100644
--- a/src/main/java/net/minecraft/server/commands/DebugCommand.java
+++ b/src/main/java/net/minecraft/server/commands/DebugCommand.java
@@ -271,5 +271,12 @@ public class DebugCommand {
public void close() {
IOUtils.closeQuietly((Writer)this.output);
}
+
+ // Plazma start - Decompile fixes
+ @Override
+ public org.bukkit.command.CommandSender getBukkitSender(final CommandSourceStack wrapper) {
+ return wrapper.getBukkitSender();
+ }
+ // Plazma end - Decompile fixes
}
}
diff --git a/src/main/java/net/minecraft/server/commands/ReturnCommand.java b/src/main/java/net/minecraft/server/commands/ReturnCommand.java
index 9f82ca1fee2a319d52a4106c3581f5e9a9554a9e..f5c7748117342dedd9d600881143c206e429fe5b 100644
--- a/src/main/java/net/minecraft/server/commands/ReturnCommand.java
+++ b/src/main/java/net/minecraft/server/commands/ReturnCommand.java
@@ -16,18 +16,18 @@ import net.minecraft.commands.execution.tasks.BuildContexts;
import net.minecraft.commands.execution.tasks.FallthroughTask;
public class ReturnCommand {
- public static <T extends ExecutionCommandSource<T>> void register(CommandDispatcher<T> dispatcher) {
- dispatcher.register(
- (LiteralArgumentBuilder<T>)LiteralArgumentBuilder.<ExecutionCommandSource>literal("return")
- .requires(source -> source.hasPermission(2))
- .then(
- RequiredArgumentBuilder.<T, Integer>argument("value", IntegerArgumentType.integer())
- .executes(new ReturnCommand.ReturnValueCustomExecutor<>())
- )
- .then(LiteralArgumentBuilder.<T>literal("fail").executes(new ReturnCommand.ReturnFailCustomExecutor<>()))
- .then(LiteralArgumentBuilder.<T>literal("run").forward(dispatcher.getRoot(), new ReturnCommand.ReturnFromCommandCustomModifier<>(), false))
+
+ // Plazma start - Decompile fixes
+ public static void register(CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher) {
+ dispatcher.register(net.minecraft.commands.Commands.literal("return")
+ .requires(source -> source.hasPermission(2))
+ .then(net.minecraft.commands.Commands.argument("value", IntegerArgumentType.integer())
+ .executes(new ReturnCommand.ReturnValueCustomExecutor<>()))
+ .then(net.minecraft.commands.Commands.literal("fail").executes(new ReturnCommand.ReturnFailCustomExecutor<>()))
+ .then(net.minecraft.commands.Commands.literal("run").forward(dispatcher.getRoot(), new ReturnCommand.ReturnFromCommandCustomModifier<>(), false))
);
}
+ // Plazma end - Decompile fixes
static class ReturnFailCustomExecutor<T extends ExecutionCommandSource<T>> implements CustomCommandExecutor.CommandAdapter<T> {
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java b/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java
index 3fc1ec01e1a77a169ec762a23f15b97f040ce5f8..b5464708c1fa949e7df8aed71126ccad72d66ee3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java
@@ -62,8 +62,8 @@ public class AllayAi {
Activity.CORE,
0,
ImmutableList.of(
- new Swim<>(0.8F),
- new AnimalPanic(2.5F),
+ new Swim<Allay>(0.8F), // Plazma - mc dev fixes
+ new AnimalPanic<Allay>(2.5F), // Plazma - mc dev fixes
new LookAtTargetSink(45, 90),
new MoveToTargetSink(),
new CountDownCooldownTicks(MemoryModuleType.LIKED_NOTEBLOCK_COOLDOWN_TICKS),

View File

@@ -1,425 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Wed, 21 Dec 2022 19:31:24 +0900
Subject: [PATCH] Fork-friendly Rebranding
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index be1bb14dca9367b9685841985b6198376986c496..b58f4eb26ce6bd6696b3289b5f199ab8f0ff28b6 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -592,7 +592,7 @@ public class Metrics {
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
- Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur - Purpur config files
+ Metrics metrics = new Metrics(io.papermc.paper.ServerBrandConstants.BRAND_NAME, serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur - Purpur config files // Plazma - Fork-friendly Rebranding
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index fe66e43c27e0798770e102d1385bacbaa90bda07..1ad562a95809cf7d503f5446f8645ba8c2680914 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -36,7 +36,7 @@ public class PaperVersionFetcher implements VersionFetcher {
private static final int DISTANCE_ERROR = -1;
private static final int DISTANCE_UNKNOWN = -2;
// Purpur start - Rebrand
- private static final String DOWNLOAD_PAGE = "https://purpurmc.org/downloads";
+ // private static final String DOWNLOAD_PAGE = "https://purpurmc.org/downloads"; // Plazma - Fork-friendly Rebranding
private static int distance = DISTANCE_UNKNOWN; public int distance() { return distance; }
// Purpur end - Rebrand
@@ -52,7 +52,7 @@ public class PaperVersionFetcher implements VersionFetcher {
if (build.buildNumber().isEmpty() && build.gitCommit().isEmpty()) {
updateMessage = text("You are running a development version without access to version information", color(0xFF5300));
} else {
- updateMessage = getUpdateStatusMessage("PurpurMC/Purpur", build); // Purpur - Rebrand
+ updateMessage = getUpdateStatusMessage("PlazmaMC/Plazma", build); // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
}
final @Nullable Component history = this.getHistory();
@@ -63,8 +63,12 @@ public class PaperVersionFetcher implements VersionFetcher {
//int distance = DISTANCE_ERROR; // Purpur - use field - Rebrand
final OptionalInt buildNumber = build.buildNumber();
- if (buildNumber.isPresent()) {
- distance = fetchDistanceFromSiteApi(build, buildNumber.getAsInt());
+ // Plazma start - TODO: CI Checking
+ //noinspection PointlessBooleanExpression
+ if (false && buildNumber.isPresent()) {
+ throw new UnsupportedOperationException("Version fetching from CI is not supported yet");
+ // distance = fetchDistanceFromSiteApi(build, buildNumber.getAsInt());
+ // Plazma end - TODO: CI Checking
} else {
final Optional<String> gitBranch = build.gitBranch();
final Optional<String> gitCommit = build.gitCommit();
@@ -80,12 +84,13 @@ public class PaperVersionFetcher implements VersionFetcher {
default -> text("* You are " + distance + " version(s) behind", NamedTextColor.YELLOW) // Purpur - Rebrand
.append(Component.newline())
.append(text("Download the new version at: ")
- .append(text(DOWNLOAD_PAGE, NamedTextColor.GOLD)
+ .append(text(io.papermc.paper.ServerBrandConstants.DOWNLOAD_PAGE, NamedTextColor.GOLD) // Plazma - Fork-friendly Rebranding
.hoverEvent(text("Click to open", NamedTextColor.WHITE))
- .clickEvent(ClickEvent.openUrl(DOWNLOAD_PAGE))));
+ .clickEvent(ClickEvent.openUrl(io.papermc.paper.ServerBrandConstants.DOWNLOAD_PAGE)))); // Plazma - Fork-friendly Rebranding
};
}
+ /* // Plazma - TODO: CI Checking
private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) {
try {
try (final BufferedReader reader = Resources.asCharSource(
@@ -105,6 +110,7 @@ public class PaperVersionFetcher implements VersionFetcher {
return DISTANCE_ERROR;
}
}
+ */ // Plazma - TODO: CI Checking
// Contributed by Techcable <Techcable@outlook.com> in GH-65
private static int fetchDistanceFromGitHub(final String repo, final String branch, final String hash) {
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
index bc7e4e5560708fea89c584b1d8b471f4966f311a..986be14b664e55111a590f5c1fded5a799578da0 100644
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -20,7 +20,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@Override
protected LineReader buildReader(LineReaderBuilder builder) {
builder
- .appName("Purpur") // Purpur - Rebrand
+ .appName(io.papermc.paper.ServerBrandConstants.BRAND_NAME) // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/io/papermc/paper/ServerBrandConstants.java b/src/main/java/io/papermc/paper/ServerBrandConstants.java
new file mode 100644
index 0000000000000000000000000000000000000000..3af005ce2bbd30601917987d8c831db23c733ab8
--- /dev/null
+++ b/src/main/java/io/papermc/paper/ServerBrandConstants.java
@@ -0,0 +1,29 @@
+package io.papermc.paper;
+
+import org.jetbrains.annotations.Nullable;
+
+public interface ServerBrandConstants {
+
+ // Basic brand informations
+ String BRAND_NAME = "Plazma";
+ String RESOURCE_PATH = "META-INF/maven/org.plazmamc.plazma/plazma-api/pom.properties";
+
+ @Nullable
+ String ASCII_LOGO = """
+
+ \033[38;2;215;23;133m█\033[38;2;212;24;134m█\033[38;2;209;26;134m█\033[38;2;205;27;135m█\033[38;2;202;28;136m█\033[38;2;199;30;136m█\033[38;2;196;31;137m╗\033[38;2;193;33;138m \033[38;2;190;34;138m█\033[38;2;186;35;139m█\033[38;2;183;37;140m╗\033[38;2;180;38;140m \033[38;2;177;39;141m \033[38;2;174;41;142m \033[38;2;170;42;142m \033[38;2;167;43;143m \033[38;2;164;45;144m \033[38;2;161;46;144m█\033[38;2;158;47;145m█\033[38;2;155;49;146m█\033[38;2;151;50;146m█\033[38;2;148;52;147m█\033[38;2;145;53;148m╗\033[38;2;142;54;148m \033[38;2;139;56;149m█\033[38;2;135;57;149m█\033[38;2;132;58;150m█\033[38;2;129;60;151m█\033[38;2;126;61;151m█\033[38;2;123;62;152m█\033[38;2;120;64;153m█\033[38;2;116;65;153m╗ \033[38;2;113;67;154m█\033[38;2;110;68;155m█\033[38;2;107;69;155m█\033[38;2;104;71;156m╗\033[38;2;101;72;157m \033[38;2;97;73;157m \033[38;2;94;75;158m \033[38;2;91;76;159m█\033[38;2;88;77;159m█\033[38;2;85;79;160m█\033[38;2;81;80;161m╗ \033[38;2;78;81;161m \033[38;2;75;83;162m█\033[38;2;72;84;163m█\033[38;2;69;86;163m█\033[38;2;66;87;164m█\033[38;2;62;88;165m█\033[38;2;59;90;165m╗\033[38;2;56;91;166m\s
+ \033[38;2;215;23;133m█\033[38;2;212;24;134m█\033[38;2;209;26;134m╔\033[38;2;205;27;135m═\033[38;2;202;28;136m═\033[38;2;199;30;136m█\033[38;2;196;31;137m█\033[38;2;193;33;138m╗ \033[38;2;190;34;138m█\033[38;2;186;35;139m█\033[38;2;183;37;140m║\033[38;2;180;38;140m \033[38;2;177;39;141m \033[38;2;174;41;142m \033[38;2;170;42;142m \033[38;2;167;43;143m \033[38;2;164;45;144m█\033[38;2;161;46;144m█\033[38;2;158;47;145m╔\033[38;2;155;49;146m═\033[38;2;151;50;146m═\033[38;2;148;52;147m█\033[38;2;145;53;148m█\033[38;2;142;54;148m╗ \033[38;2;139;56;149m╚\033[38;2;135;57;149m═\033[38;2;132;58;150m═\033[38;2;129;60;151m█\033[38;2;126;61;151m█\033[38;2;123;62;152m█\033[38;2;120;64;153m╔\033[38;2;116;65;153m╝ \033[38;2;113;67;154m█\033[38;2;110;68;155m█\033[38;2;107;69;155m█\033[38;2;104;71;156m█\033[38;2;101;72;157m╗\033[38;2;97;73;157m \033[38;2;94;75;158m█\033[38;2;91;76;159m█\033[38;2;88;77;159m█\033[38;2;85;79;160m█\033[38;2;81;80;161m║ \033[38;2;78;81;161m█\033[38;2;75;83;162m█\033[38;2;72;84;163m╔\033[38;2;69;86;163m═\033[38;2;66;87;164m═\033[38;2;62;88;165m█\033[38;2;59;90;165m█\033[38;2;56;91;166m╗
+ \033[38;2;215;23;133m█\033[38;2;212;24;134m█\033[38;2;209;26;134m█\033[38;2;205;27;135m█\033[38;2;202;28;136m█\033[38;2;199;30;136m█\033[38;2;196;31;137m╔\033[38;2;193;33;138m╝ \033[38;2;190;34;138m█\033[38;2;186;35;139m█\033[38;2;183;37;140m║\033[38;2;180;38;140m \033[38;2;177;39;141m \033[38;2;174;41;142m \033[38;2;170;42;142m \033[38;2;167;43;143m \033[38;2;164;45;144m█\033[38;2;161;46;144m█\033[38;2;158;47;145m█\033[38;2;155;49;146m█\033[38;2;151;50;146m█\033[38;2;148;52;147m█\033[38;2;145;53;148m█\033[38;2;142;54;148m║ \033[38;2;139;56;149m \033[38;2;135;57;149m \033[38;2;132;58;150m█\033[38;2;129;60;151m█\033[38;2;126;61;151m█\033[38;2;123;62;152m╔\033[38;2;120;64;153m╝\033[38;2;116;65;153m \033[38;2;113;67;154m█\033[38;2;110;68;155m█\033[38;2;107;69;155m╔\033[38;2;104;71;156m█\033[38;2;101;72;157m█\033[38;2;97;73;157m█\033[38;2;94;75;158m█\033[38;2;91;76;159m╔\033[38;2;88;77;159m█\033[38;2;85;79;160m█\033[38;2;81;80;161m║ \033[38;2;78;81;161m█\033[38;2;75;83;162m█\033[38;2;72;84;163m█\033[38;2;69;86;163m█\033[38;2;66;87;164m█\033[38;2;62;88;165m█\033[38;2;59;90;165m█\033[38;2;56;91;166m║
+ \033[38;2;215;23;133m█\033[38;2;212;24;134m█\033[38;2;209;26;134m╔\033[38;2;205;27;135m═\033[38;2;202;28;136m═\033[38;2;199;30;136m═\033[38;2;196;31;137m╝\033[38;2;193;33;138m \033[38;2;190;34;138m█\033[38;2;186;35;139m█\033[38;2;183;37;140m║\033[38;2;180;38;140m \033[38;2;177;39;141m \033[38;2;174;41;142m \033[38;2;170;42;142m \033[38;2;167;43;143m \033[38;2;164;45;144m█\033[38;2;161;46;144m█\033[38;2;158;47;145m╔\033[38;2;155;49;146m═\033[38;2;151;50;146m═\033[38;2;148;52;147m█\033[38;2;145;53;148m█\033[38;2;142;54;148m║ \033[38;2;139;56;149m \033[38;2;135;57;149m█\033[38;2;132;58;150m█\033[38;2;129;60;151m█\033[38;2;126;61;151m╔\033[38;2;123;62;152m╝\033[38;2;120;64;153m \033[38;2;116;65;153m \033[38;2;113;67;154m█\033[38;2;110;68;155m█\033[38;2;107;69;155m║\033[38;2;104;71;156m╚\033[38;2;101;72;157m█\033[38;2;97;73;157m█\033[38;2;94;75;158m╔\033[38;2;91;76;159m╝\033[38;2;88;77;159m█\033[38;2;85;79;160m█\033[38;2;81;80;161m║ \033[38;2;78;81;161m█\033[38;2;75;83;162m█\033[38;2;72;84;163m╔\033[38;2;69;86;163m═\033[38;2;66;87;164m═\033[38;2;62;88;165m█\033[38;2;59;90;165m█\033[38;2;56;91;166m║
+ \033[38;2;215;23;133m█\033[38;2;212;24;134m█\033[38;2;209;26;134m║\033[38;2;205;27;135m \033[38;2;202;28;136m \033[38;2;199;30;136m \033[38;2;196;31;137m \033[38;2;193;33;138m \033[38;2;190;34;138m█\033[38;2;186;35;139m█\033[38;2;183;37;140m█\033[38;2;180;38;140m█\033[38;2;177;39;141m█\033[38;2;174;41;142m█\033[38;2;170;42;142m█\033[38;2;167;43;143m╗ \033[38;2;164;45;144m█\033[38;2;161;46;144m█\033[38;2;158;47;145m║\033[38;2;155;49;146m \033[38;2;151;50;146m \033[38;2;148;52;147m█\033[38;2;145;53;148m█\033[38;2;142;54;148m║ \033[38;2;139;56;149m█\033[38;2;135;57;149m█\033[38;2;132;58;150m█\033[38;2;129;60;151m█\033[38;2;126;61;151m█\033[38;2;123;62;152m█\033[38;2;120;64;153m█\033[38;2;116;65;153m╗ \033[38;2;113;67;154m█\033[38;2;110;68;155m█\033[38;2;107;69;155m║\033[38;2;104;71;156m \033[38;2;101;72;157m╚\033[38;2;97;73;157m═\033[38;2;94;75;158m╝\033[38;2;91;76;159m \033[38;2;88;77;159m█\033[38;2;85;79;160m█\033[38;2;81;80;161m║ \033[38;2;78;81;161m█\033[38;2;75;83;162m█\033[38;2;72;84;163m║\033[38;2;69;86;163m \033[38;2;66;87;164m \033[38;2;62;88;165m█\033[38;2;59;90;165m█\033[38;2;56;91;166m║
+ \033[38;2;215;23;133m╚\033[38;2;212;24;134m═\033[38;2;209;26;134m╝\033[38;2;205;27;135m \033[38;2;202;28;136m \033[38;2;199;30;136m \033[38;2;196;31;137m \033[38;2;193;33;138m \033[38;2;190;34;138m╚\033[38;2;186;35;139m═\033[38;2;183;37;140m═\033[38;2;180;38;140m═\033[38;2;177;39;141m═\033[38;2;174;41;142m═\033[38;2;170;42;142m═\033[38;2;167;43;143m╝ \033[38;2;164;45;144m╚\033[38;2;161;46;144m═\033[38;2;158;47;145m╝\033[38;2;155;49;146m \033[38;2;151;50;146m \033[38;2;148;52;147m╚\033[38;2;145;53;148m═\033[38;2;142;54;148m╝ \033[38;2;139;56;149m╚\033[38;2;135;57;149m═\033[38;2;132;58;150m═\033[38;2;129;60;151m═\033[38;2;126;61;151m═\033[38;2;123;62;152m═\033[38;2;120;64;153m═\033[38;2;116;65;153m╝ \033[38;2;113;67;154m╚\033[38;2;110;68;155m═\033[38;2;107;69;155m╝\033[38;2;104;71;156m \033[38;2;101;72;157m \033[38;2;97;73;157m \033[38;2;94;75;158m \033[38;2;91;76;159m \033[38;2;88;77;159m╚\033[38;2;85;79;160m═\033[38;2;81;80;161m╝ \033[38;2;78;81;161m╚\033[38;2;75;83;162m═\033[38;2;72;84;163m╝\033[38;2;69;86;163m \033[38;2;66;87;164m \033[38;2;62;88;165m╚\033[38;2;59;90;165m═\033[38;2;56;91;166m╝\033[0m
+ """;
+
+ // Support URLs
+ String DOWNLOAD_PAGE = "https://plazmamc.org/downloads";
+ String CONFIG_REFERENCE = "https://docs.plazmamc.org/plazma/administration/reference/configurations";
+ String START_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started";
+ String USAGE_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started/next-step";
+ String SUPPORT_PAGE = "https://github.com/PlazmaMC/Plazma/issues";
+
+}
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
index 0843e7c5c335a58d955a0841f2e02a9e4ac824d9..f7c15d0a63f948c4f52f6e6bbcbc4dc096b3281f 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -30,10 +30,6 @@ public record ServerBuildInfoImpl(
private static final String ATTRIBUTE_GIT_BRANCH = "Git-Branch";
private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit";
- private static final String BRAND_PAPER_NAME = "Paper";
- private static final String BRAND_PUFFERFISH_NAME = "Pufferfish"; // Purpur - Fix pufferfish issues
- private static final String BRAND_PURPUR_NAME = "Purpur"; // Purpur - Rebrand
-
private static final String BUILD_DEV = "DEV";
public ServerBuildInfoImpl() {
@@ -44,9 +40,9 @@ public record ServerBuildInfoImpl(
this(
getManifestAttribute(manifest, ATTRIBUTE_BRAND_ID)
.map(Key::key)
- .orElse(BRAND_PURPUR_ID), // Purpur - Fix pufferfish issues // Purpur - Rebrand
+ .orElse(BRAND_ID), // Purpur - Fix pufferfish issues // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
getManifestAttribute(manifest, ATTRIBUTE_BRAND_NAME)
- .orElse(BRAND_PURPUR_NAME), // Purpur - Fix pufferfish issues // Purpur - Rebrand
+ .orElse(ServerBrandConstants.BRAND_NAME), // Purpur - Fix pufferfish issues // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
SharedConstants.getCurrentVersion().getId(),
SharedConstants.getCurrentVersion().getName(),
getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER)
@@ -63,7 +59,7 @@ public record ServerBuildInfoImpl(
@Override
public boolean isBrandCompatible(final @NotNull Key brandId) {
- return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID) || brandId.equals(BRAND_PUFFERFISH_ID); // Purpur - Fix pufferfish issues // Purpur - Rebrand
+ return brandId.equals(this.brandId) || SUPPORTED_BRANDS.contains(brandId); // Purpur - Fix pufferfish issues // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
}
@Override
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
index 8cf720f08514e8e4f62f4ad196f1277bd761c6b2..cda2ca940e30506807a5d12b84dbf69529051e26 100644
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
@@ -112,7 +112,7 @@ public abstract class Configurations<G, W> {
loader.save(node);
} catch (ConfigurateException ex) {
if (ex.getCause() instanceof AccessDeniedException) {
- LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex);
+ LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBrandConstants.BRAND_NAME, io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex); // Plazma - Fork-friendly Rebranding
} else throw ex;
}
}
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index 710477ae27ebc5afdf0012ef0867d05efd293c24..3a5e7546c5cc1fcec880cece3f0d0b04ec23cc18 100644
--- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java
@@ -32,13 +32,13 @@ public class CrashReport {
private boolean trackingStackTrace = true;
private StackTraceElement[] uncategorizedStackTrace = new StackTraceElement[0];
private final SystemReport systemReport = new SystemReport();
- private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER! REPORT TO PURPUR INSTEAD!", ""); // Purpur - Rebrand
+ private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER OR PURPUR! REPORT TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME.toUpperCase() + " INSTEAD!", ""); // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
public CrashReport(String message, Throwable cause) {
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(cause); // Paper
this.title = message;
this.exception = cause;
- this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
+ this.systemReport.setDetail(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit // Plazma - Fork-friendly Rebranding
}
public String getTitle() {
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index a880f4e5cf712654649ad043e58e073e9a87c0fe..c3bce9206aee05b18ddd8b2788f892a972146737 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -110,6 +110,11 @@ public class Main {
*/ // CraftBukkit end
try {
+ // Plazma start - Fork-friendly Rebranding
+ //noinspection ConstantValue
+ if (io.papermc.paper.ServerBrandConstants.ASCII_LOGO != null)
+ System.out.println(io.papermc.paper.ServerBrandConstants.ASCII_LOGO);
+ // Plazma end - Fork-friendly Rebranding
Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fa5f7bc53f3dfa5581f7c747c732ebc7737a7820..17afd1c5b9984b19b4d31711bfd7f8cc120d89fd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1281,7 +1281,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
LOGGER.info("*************************************************************************************");
LOGGER.info("This is the first time you're starting this server.");
LOGGER.info("It's recommended you read our 'Getting Started' documentation for guidance.");
- LOGGER.info("View this and more helpful information here: https://docs.papermc.io/paper/next-steps");
+ LOGGER.info("View this and more helpful information here: {}", io.papermc.paper.ServerBrandConstants.START_GUIDE); // Plazma - Fork-friendly Rebranding
LOGGER.info("*************************************************************************************");
}
// Paper end - Add onboarding message for initial server start
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 0a579af1f1ecd6e73a8440e6821c41338dd28829..b0b79b9d743cca3e6b1a33c592d66d3cdad3d819 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -788,7 +788,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.bukkit.plugin.Plugin[] plugins = this.server.getPluginManager().getPlugins();
result.append(this.server.getName());
- result.append(" on Bukkit ");
+ result.append(" on ").append(io.papermc.paper.ServerBrandConstants.BRAND_NAME).append(" "); // Plazma - Fork-friendly Rebranding
result.append(this.server.getBukkitVersion());
if (plugins.length > 0 && this.server.getQueryPlugins()) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index 05e16103af3fd276f0196ddf1a2e5b729b025c34..8f7e922ceca286b1a590181c301fbe9bff55c024 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -56,10 +56,10 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
public final boolean onlineMode = this.get("online-mode", true);
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
public final String serverIp = this.get("server-ip", "");
- public final String serverName = this.get("server-name", "Unknown Server"); // Purpur
+ public final String serverName = this.get("server-name", "A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server"); // Purpur // Plazma - Fork-friendly Rebranding
public final boolean pvp = this.get("pvp", true);
public final boolean allowFlight = this.get("allow-flight", false);
- public final String motd = this.get("motd", "A Minecraft Server");
+ public final String motd = this.get("motd", "A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server"); // Plazma - Fork-friendly Rebranding
public final String bugReportLink = this.get("bug-report-link", "");
public final boolean forceGameMode = this.get("force-gamemode", false);
public final boolean enforceWhitelist = this.get("enforce-whitelist", false);
diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
index 8f74c2ec5252b6265549589310d742337c91cb2c..ecb5a046514e3cd448cbf633c728831b1eb5d30b 100644
--- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
@@ -56,7 +56,7 @@ public class MinecraftServerGui extends JComponent {
;
}
- final JFrame jframe = new JFrame("Purpur Minecraft server"); // Purpur
+ final JFrame jframe = new JFrame(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Minecraft server"); // Purpur // Plazma - Fork-friendly Rebranding
final MinecraftServerGui servergui = new MinecraftServerGui(server);
jframe.setDefaultCloseOperation(2);
@@ -64,7 +64,7 @@ public class MinecraftServerGui extends JComponent {
jframe.pack();
jframe.setLocationRelativeTo((Component) null);
jframe.setVisible(true);
- jframe.setName("Purpur Minecraft server"); // Paper - Improve ServerGUI // Purpur
+ jframe.setName(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Minecraft server"); // Paper - Improve ServerGUI // Purpur // Plazma - Fork-friendly Rebranding
// Paper start - Improve ServerGUI
try {
@@ -76,7 +76,7 @@ public class MinecraftServerGui extends JComponent {
jframe.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowevent) {
if (!servergui.isClosing.getAndSet(true)) {
- jframe.setTitle("Purpur Minecraft server - shutting down!"); // Purpur
+ jframe.setTitle(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Minecraft server - shutting down!"); // Purpur // Plazma - Fork-friendly Rebranding
server.halt(true);
servergui.runFinalizers();
}
@@ -123,7 +123,7 @@ public class MinecraftServerGui extends JComponent {
// Paper start - Add onboarding message for initial server start
private JComponent buildOnboardingPanel() {
- String onboardingLink = "https://docs.papermc.io/paper/next-steps";
+ String onboardingLink = io.papermc.paper.ServerBrandConstants.USAGE_GUIDE; // Plazma - Fork-friendly Rebranding
JPanel jPanel = new JPanel();
javax.swing.JLabel jLabel = new javax.swing.JLabel("If you need help setting up your server you can visit:");
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 3781bca61379516d537650c79c614933454fdcd8..b669721a900c4644a5bc125a83c000af21f43692 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -90,7 +90,7 @@ public class DamageSource {
public DamageSource customEventDamager(Entity entity) {
if (this.directEntity != null) {
- throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to Paper)");
+ throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + ")"); // Plazma - Fork-friendly Rebranding
}
DamageSource damageSource = this.cloneInstance();
damageSource.customEventDamager = entity;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index a68f27288604b6f6755efe3c8ea612e295cb1656..47d19180ba80615e596e2322db24571868042a93 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -289,7 +289,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
// Paper start
private static void printOversizedLog(String msg, Path file, int x, int z) {
- org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PURPUR - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur - Rebrand
+ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
}
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 10aa600fab7146b330d46b5fd2fe596da222a70a..9c275f6f2c78c5d78736dc6921eadda2c12a5a10 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -143,7 +143,7 @@ public class Main {
this.acceptsAll(Main.asList("noconsole"), "Disables the console");
- this.acceptsAll(Main.asList("v", "version"), "Show the CraftBukkit Version");
+ this.acceptsAll(Main.asList("v", "version"), "Show the " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Version"); // Plazma - Fork-friendly Rebranding
this.acceptsAll(Main.asList("demo"), "Demo mode");
@@ -194,7 +194,7 @@ public class Main {
acceptsAll(asList("server-name"), "Name of the server")
.withRequiredArg()
.ofType(String.class)
- .defaultsTo("Unknown Server")
+ .defaultsTo("A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server") // Plazma - Fork-friendly Rebranding
.describedAs("Name");
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 2e7c3d4befeb6256ce81ecaa9ed4e8fbcb21651e..b28b2076972612d3d0b5890cf5938db53b1ceb2f 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -491,7 +491,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Purpur"); // Paper // Purpur - Rebrand
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME); // Paper // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 99eb04643fce44c37fd96c99756837ccafe7b559..0627428492e082da5dfbd93906d87bb10e8c1a6b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
public static String getBukkitVersion() {
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.purpurmc.purpur/purpur-api/pom.properties"); // Pufferfish // Purpur - Rebrand
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream(io.papermc.paper.ServerBrandConstants.RESOURCE_PATH); // Pufferfish // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
Properties properties = new Properties();
if (stream != null) {
@@ -20,7 +20,7 @@ public final class Versioning {
result = properties.getProperty("version");
} catch (IOException ex) {
- Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get Bukkit version!", ex);
+ Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " version!", ex); // Plazma - Fork-friendly Rebranding
}
}
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 47f168b2d62c9a0eebdd8ab678afd857e7622571..40342e412f3fa0ea76e8f41f5eb9995eff83daa6 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -155,14 +155,14 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
if (isLongTimeout) {
// Paper end
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Purpur bug." ); // Paper // Purpur - Rebrand
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " bug." ); // Paper // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
- log.log( Level.SEVERE, "If you are unsure or still think this is a Purpur bug, please report this to https://github.com/PurpurMC/Purpur/issues" ); // Purpur - Rebrand
+ log.log( Level.SEVERE, "If you are unsure or still think this is a " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " bug, please report this to " + io.papermc.paper.ServerBrandConstants.SUPPORT_PAGE ); // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
- log.log( Level.SEVERE, "Purpur version: " + Bukkit.getServer().getVersion() ); // Purpur - Rebrand
+ log.log( Level.SEVERE, io.papermc.paper.ServerBrandConstants.BRAND_NAME + " version: " + Bukkit.getServer().getVersion() ); // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
//
if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
{
@@ -184,12 +184,12 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
// Paper end
} else
{
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur - Rebrand
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME.toUpperCase() + " - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
}
// Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Purpur!):" ); // Paper // Purpur - Rebrand
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + "!):" ); // Paper // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(MinecraftServer.getServer(), isLongTimeout); // Paper - rewrite chunk system
this.dumpTickingInfo(); // Paper - log detailed tick information
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
@@ -205,7 +205,7 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
WatchdogThread.dumpThread( thread, log );
}
} else {
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH ---"); // Purpur - Rebrand
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " - THIS IS NOT A BUG OR A CRASH ---"); // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
}
log.log( Level.SEVERE, "------------------------------" );

View File

@@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Wed, 25 Dec 2024 18:16:50 +0900
Subject: [PATCH] Enable CI version tracking
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index 1ad562a95809cf7d503f5446f8645ba8c2680914..21a3761f075ace896c981936b2810fccb0b5d610 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -90,19 +90,18 @@ public class PaperVersionFetcher implements VersionFetcher {
};
}
- /* // Plazma - TODO: CI Checking
private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) {
try {
try (final BufferedReader reader = Resources.asCharSource(
- URI.create("https://api.purpurmc.org/v2/purpur/" + build.minecraftVersionId()).toURL(), // Purpur - Rebrand
+ URI.create("https://ci.codemc.io/job/PlazmaMC/job/Plazma/job/" + build.gitBranch().orElseThrow().replace("/", "%2F") + "/api/json").toURL(), // Purpur - Rebrand // Plazma - Rebrand
Charsets.UTF_8
).openBufferedStream()) {
final JsonObject json = new Gson().fromJson(reader, JsonObject.class);
//final JsonArray builds = json.getAsJsonArray("builds"); // Purpur - Rebrand
- final int latest = json.getAsJsonObject("builds").getAsJsonPrimitive("latest").getAsInt(); // Purpur - Rebrand
+ final int latest = json.getAsJsonObject("lastSuccessfulBuild").getAsJsonPrimitive("number").getAsInt(); // Purpur - Rebrand // Plazma - Rebrand
return latest - jenkinsBuild;
} catch (final JsonSyntaxException ex) {
- LOGGER.error("Error parsing json from Purpur's downloads API", ex); // Purpur - Rebrand
+ LOGGER.error("Error parsing json from CI", ex); // Purpur - Rebrand // Plazma - Rebrand
return DISTANCE_ERROR;
}
} catch (final IOException e) {
@@ -110,7 +109,6 @@ public class PaperVersionFetcher implements VersionFetcher {
return DISTANCE_ERROR;
}
}
- */ // Plazma - TODO: CI Checking
// Contributed by Techcable <Techcable@outlook.com> in GH-65
private static int fetchDistanceFromGitHub(final String repo, final String branch, final String hash) {

View File

@@ -4,6 +4,19 @@ Date: Fri, 3 Nov 2023 00:11:50 +0900
Subject: [PATCH] Plazma Configurations
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
index 8cf720f08514e8e4f62f4ad196f1277bd761c6b2..cda2ca940e30506807a5d12b84dbf69529051e26 100644
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
@@ -112,7 +112,7 @@ public abstract class Configurations<G, W> {
loader.save(node);
} catch (ConfigurateException ex) {
if (ex.getCause() instanceof AccessDeniedException) {
- LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex);
+ LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBrandConstants.BRAND_NAME, io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex); // Plazma - Fork-friendly Rebranding
} else throw ex;
}
}
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
index cda2ca940e30506807a5d12b84dbf69529051e26..150556ba594eae2214e4d1f0243ee97a7beb1e99 100644
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java

View File

View File

@@ -0,0 +1,95 @@
--- a/net/minecraft/CrashReport.java
+++ b/net/minecraft/CrashReport.java
@@ -22,15 +_,16 @@
public class CrashReport {
private static final Logger LOGGER = LogUtils.getLogger();
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss", Locale.ROOT);
+ private static final List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER OR PURPUR! REPORT TO PLAZMA INSTEAD!", ""); // Purpur - Rebrand // Plazma - Use modern method // Plazma - Rebrand
private final String title;
private final Throwable exception;
private final List<CrashReportCategory> details = Lists.newArrayList();
@Nullable
private Path saveFile;
private boolean trackingStackTrace = true;
+ @Nullable // Plazma - Fix IDE warning
private StackTraceElement[] uncategorizedStackTrace = new StackTraceElement[0];
private final SystemReport systemReport = new SystemReport();
- private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER! REPORT TO PURPUR INSTEAD!", ""); // Purpur - Rebrand
public CrashReport(String title, Throwable exception) {
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); // Paper
@@ -54,8 +_,8 @@
}
public void getDetails(StringBuilder builder) {
- if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length <= 0) && !this.details.isEmpty()) {
- this.uncategorizedStackTrace = ArrayUtils.subarray(this.details.get(0).getStacktrace(), 0, 1);
+ if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length == 0) && !this.details.isEmpty()) {
+ this.uncategorizedStackTrace = ArrayUtils.subarray(this.details.getFirst().getStacktrace(), 0, 1); // Plazma - Use modern method
}
if (this.uncategorizedStackTrace != null && this.uncategorizedStackTrace.length > 0) {
@@ -84,13 +_,14 @@
PrintWriter printWriter = null;
Throwable throwable = this.exception;
if (throwable.getMessage() == null) {
- if (throwable instanceof NullPointerException) {
- throwable = new NullPointerException(this.title);
- } else if (throwable instanceof StackOverflowError) {
- throwable = new StackOverflowError(this.title);
- } else if (throwable instanceof OutOfMemoryError) {
- throwable = new OutOfMemoryError(this.title);
+ // Plazma start - Use modern method
+ switch (throwable) {
+ case NullPointerException ignore -> throwable = new NullPointerException(this.title);
+ case StackOverflowError ignore -> throwable = new StackOverflowError(this.title);
+ case OutOfMemoryError ignore -> throwable = new OutOfMemoryError(this.title);
+ default -> {}
}
+ // Plazma end - Use modern method
throwable.setStackTrace(this.exception.getStackTrace());
}
@@ -102,8 +_,8 @@
throwable.printStackTrace(printWriter);
var4 = stringWriter.toString();
} finally {
- IOUtils.closeQuietly((Writer)stringWriter);
- IOUtils.closeQuietly((Writer)printWriter);
+ IOUtils.closeQuietly(stringWriter); // Plazma - Remove unnecessary type cast
+ IOUtils.closeQuietly(printWriter); // Plazma - Remove unnecessary type cast
}
return var4;
@@ -120,12 +_,7 @@
stringBuilder.append("\n\n");
stringBuilder.append(this.getExceptionMessage());
stringBuilder.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n");
-
- for (int i = 0; i < 87; i++) {
- stringBuilder.append("-");
- }
-
- stringBuilder.append("\n\n");
+ stringBuilder.repeat("-", 87).append("\n\n"); // Plazma - Use modern method
this.getDetails(stringBuilder);
return stringBuilder.toString();
}
@@ -185,7 +_,7 @@
LOGGER.error("Negative index in crash report handler ({}/{})", stackTrace.length, i);
}
- if (stackTrace != null && 0 <= i1 && i1 < stackTrace.length) {
+ if (0 <= i1 && i1 < stackTrace.length) {
stackTraceElement = stackTrace[i1];
if (stackTrace.length + 1 - i < stackTrace.length) {
stackTraceElement1 = stackTrace[stackTrace.length + 1 - i];
@@ -193,7 +_,7 @@
}
this.trackingStackTrace = crashReportCategory.validateStackTrace(stackTraceElement, stackTraceElement1);
- if (stackTrace != null && stackTrace.length >= i && 0 <= i1 && i1 < stackTrace.length) {
+ if (stackTrace.length >= i && 0 <= i1 && i1 < stackTrace.length) {
this.uncategorizedStackTrace = new StackTraceElement[i1];
System.arraycopy(stackTrace, 0, this.uncategorizedStackTrace, 0, this.uncategorizedStackTrace.length);
} else {

View File

@@ -0,0 +1,74 @@
--- a/net/minecraft/CrashReportCategory.java
+++ b/net/minecraft/CrashReportCategory.java
@@ -133,7 +_,7 @@
public int fillInStackTrace(int size) {
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
- if (stackTrace.length <= 0) {
+ if (stackTrace.length == 0) { // Plazma - Fix IDE warning
return 0;
} else {
this.stackTrace = new StackTraceElement[stackTrace.length - 3 - size];
@@ -143,28 +_,32 @@
}
}
- public boolean validateStackTrace(StackTraceElement s1, StackTraceElement s2) {
- if (this.stackTrace.length != 0 && s1 != null) {
- StackTraceElement stackTraceElement = this.stackTrace[0];
- if (stackTraceElement.isNativeMethod() == s1.isNativeMethod()
- && stackTraceElement.getClassName().equals(s1.getClassName())
- && stackTraceElement.getFileName().equals(s1.getFileName())
- && stackTraceElement.getMethodName().equals(s1.getMethodName())) {
- if (s2 != null != this.stackTrace.length > 1) {
- return false;
- } else if (s2 != null && !this.stackTrace[1].equals(s2)) {
- return false;
- } else {
- this.stackTrace[0] = s1;
- return true;
- }
- } else {
- return false;
- }
- } else {
- return false;
- }
+ // Plazma start - Improve code style/safety
+ public boolean validateStackTrace(@Nullable StackTraceElement s1, @Nullable StackTraceElement s2) {
+ if (this.stackTrace.length == 0 || s1 == null) {
+ return false;
+ }
+
+ StackTraceElement element = this.stackTrace[0];
+ if (element.isNativeMethod() != s1.isNativeMethod()
+ || !element.getClassName().equals(s1.getClassName())
+ || (element.getFileName() != null && !element.getFileName().equals(s1.getFileName()))
+ || !element.getMethodName().equals(s1.getMethodName())) {
+ return false;
+ }
+
+ if (s2 == null == this.stackTrace.length > 1) {
+ return false;
+ }
+
+ if (s2 != null && !this.stackTrace[1].equals(s2)) {
+ return false;
+ }
+
+ this.stackTrace[0] = s1;
+ return true;
}
+ // Plazma end - Improve code style/safety
public void trimStacktrace(int amount) {
StackTraceElement[] stackTraceElements = new StackTraceElement[this.stackTrace.length - amount];
@@ -183,7 +_,7 @@
builder.append(entry.getValue());
}
- if (this.stackTrace != null && this.stackTrace.length > 0) {
+ if (this.stackTrace.length > 0) { // Plazma - Remove unnecessary null check
builder.append("\nStacktrace:");
for (StackTraceElement stackTraceElement : this.stackTrace) {

View File

@@ -0,0 +1,146 @@
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -63,40 +_,24 @@
public class Main {
private static final Logger LOGGER = LogUtils.getLogger();
- @SuppressForbidden(
- reason = "System.out needed before bootstrap"
- )
+ @SuppressWarnings("ConfusingMainMethod") // Plazma - replaced with org.bukkit.craftbukkit.Main#main
+ @SuppressForbidden(reason = "System.out needed before bootstrap")
@DontObfuscate
public static void main(final OptionSet optionSet) { // CraftBukkit - replaces main(String[] args)
io.papermc.paper.util.LogManagerShutdownThread.hook(); // Paper - Improved watchdog support
SharedConstants.tryDetectVersion();
- /* CraftBukkit start - Replace everything
- OptionParser optionParser = new OptionParser();
- OptionSpec<Void> optionSpec = optionParser.accepts("nogui");
- OptionSpec<Void> optionSpec1 = optionParser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
- OptionSpec<Void> optionSpec2 = optionParser.accepts("demo");
- OptionSpec<Void> optionSpec3 = optionParser.accepts("bonusChest");
- OptionSpec<Void> optionSpec4 = optionParser.accepts("forceUpgrade");
- OptionSpec<Void> optionSpec5 = optionParser.accepts("eraseCache");
- OptionSpec<Void> optionSpec6 = optionParser.accepts("recreateRegionFiles");
- OptionSpec<Void> optionSpec7 = optionParser.accepts("safeMode", "Loads level with vanilla datapack only");
- OptionSpec<Void> optionSpec8 = optionParser.accepts("help").forHelp();
- OptionSpec<String> optionSpec9 = optionParser.accepts("universe").withRequiredArg().defaultsTo(".");
- OptionSpec<String> optionSpec10 = optionParser.accepts("world").withRequiredArg();
- OptionSpec<Integer> optionSpec11 = optionParser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1);
- OptionSpec<String> optionSpec12 = optionParser.accepts("serverId").withRequiredArg();
- OptionSpec<Void> optionSpec13 = optionParser.accepts("jfrProfile");
- OptionSpec<Path> optionSpec14 = optionParser.accepts("pidFile").withRequiredArg().withValuesConvertedBy(new PathConverter());
- OptionSpec<String> optionSpec15 = optionParser.nonOptions();
try {
- OptionSet optionSet = optionParser.parse(args);
- if (optionSet.has(optionSpec8)) {
- optionParser.printHelpOn(System.err);
- return;
- }
- */ // CraftBukkit end
- try {
+ // Plazma start - Branding
+ System.out.println("""
+ \\033[38;2;215;23;133m█\\033[38;2;212;24;134m█\\033[38;2;209;26;134m█\\033[38;2;205;27;135m█\\033[38;2;202;28;136m█\\033[38;2;199;30;136m█\\033[38;2;196;31;137m╗\\033[38;2;193;33;138m \\033[38;2;190;34;138m█\\033[38;2;186;35;139m█\\033[38;2;183;37;140m╗\\033[38;2;180;38;140m \\033[38;2;177;39;141m \\033[38;2;174;41;142m \\033[38;2;170;42;142m \\033[38;2;167;43;143m \\033[38;2;164;45;144m \\033[38;2;161;46;144m█\\033[38;2;158;47;145m█\\033[38;2;155;49;146m█\\033[38;2;151;50;146m█\\033[38;2;148;52;147m█\\033[38;2;145;53;148m╗\\033[38;2;142;54;148m \\033[38;2;139;56;149m█\\033[38;2;135;57;149m█\\033[38;2;132;58;150m█\\033[38;2;129;60;151m█\\033[38;2;126;61;151m█\\033[38;2;123;62;152m█\\033[38;2;120;64;153m█\\033[38;2;116;65;153m╗ \\033[38;2;113;67;154m█\\033[38;2;110;68;155m█\\033[38;2;107;69;155m█\\033[38;2;104;71;156m╗\\033[38;2;101;72;157m \\033[38;2;97;73;157m \\033[38;2;94;75;158m \\033[38;2;91;76;159m█\\033[38;2;88;77;159m█\\033[38;2;85;79;160m█\\033[38;2;81;80;161m╗ \\033[38;2;78;81;161m \\033[38;2;75;83;162m█\\033[38;2;72;84;163m█\\033[38;2;69;86;163m█\\033[38;2;66;87;164m█\\033[38;2;62;88;165m█\\033[38;2;59;90;165m╗\\033[38;2;56;91;166m\\s
+ \\033[38;2;215;23;133m█\\033[38;2;212;24;134m█\\033[38;2;209;26;134m╔\\033[38;2;205;27;135m═\\033[38;2;202;28;136m═\\033[38;2;199;30;136m█\\033[38;2;196;31;137m█\\033[38;2;193;33;138m╗ \\033[38;2;190;34;138m█\\033[38;2;186;35;139m█\\033[38;2;183;37;140m║\\033[38;2;180;38;140m \\033[38;2;177;39;141m \\033[38;2;174;41;142m \\033[38;2;170;42;142m \\033[38;2;167;43;143m \\033[38;2;164;45;144m█\\033[38;2;161;46;144m█\\033[38;2;158;47;145m╔\\033[38;2;155;49;146m═\\033[38;2;151;50;146m═\\033[38;2;148;52;147m█\\033[38;2;145;53;148m█\\033[38;2;142;54;148m╗ \\033[38;2;139;56;149m╚\\033[38;2;135;57;149m═\\033[38;2;132;58;150m═\\033[38;2;129;60;151m█\\033[38;2;126;61;151m█\\033[38;2;123;62;152m█\\033[38;2;120;64;153m╔\\033[38;2;116;65;153m╝ \\033[38;2;113;67;154m█\\033[38;2;110;68;155m█\\033[38;2;107;69;155m█\\033[38;2;104;71;156m█\\033[38;2;101;72;157m╗\\033[38;2;97;73;157m \\033[38;2;94;75;158m█\\033[38;2;91;76;159m█\\033[38;2;88;77;159m█\\033[38;2;85;79;160m█\\033[38;2;81;80;161m║ \\033[38;2;78;81;161m█\\033[38;2;75;83;162m█\\033[38;2;72;84;163m╔\\033[38;2;69;86;163m═\\033[38;2;66;87;164m═\\033[38;2;62;88;165m█\\033[38;2;59;90;165m█\\033[38;2;56;91;166m╗
+ \\033[38;2;215;23;133m█\\033[38;2;212;24;134m█\\033[38;2;209;26;134m█\\033[38;2;205;27;135m█\\033[38;2;202;28;136m█\\033[38;2;199;30;136m█\\033[38;2;196;31;137m╔\\033[38;2;193;33;138m╝ \\033[38;2;190;34;138m█\\033[38;2;186;35;139m█\\033[38;2;183;37;140m║\\033[38;2;180;38;140m \\033[38;2;177;39;141m \\033[38;2;174;41;142m \\033[38;2;170;42;142m \\033[38;2;167;43;143m \\033[38;2;164;45;144m█\\033[38;2;161;46;144m█\\033[38;2;158;47;145m█\\033[38;2;155;49;146m█\\033[38;2;151;50;146m█\\033[38;2;148;52;147m█\\033[38;2;145;53;148m█\\033[38;2;142;54;148m║ \\033[38;2;139;56;149m \\033[38;2;135;57;149m \\033[38;2;132;58;150m█\\033[38;2;129;60;151m█\\033[38;2;126;61;151m█\\033[38;2;123;62;152m╔\\033[38;2;120;64;153m╝\\033[38;2;116;65;153m \\033[38;2;113;67;154m█\\033[38;2;110;68;155m█\\033[38;2;107;69;155m╔\\033[38;2;104;71;156m█\\033[38;2;101;72;157m█\\033[38;2;97;73;157m█\\033[38;2;94;75;158m█\\033[38;2;91;76;159m╔\\033[38;2;88;77;159m█\\033[38;2;85;79;160m█\\033[38;2;81;80;161m║ \\033[38;2;78;81;161m█\\033[38;2;75;83;162m█\\033[38;2;72;84;163m█\\033[38;2;69;86;163m█\\033[38;2;66;87;164m█\\033[38;2;62;88;165m█\\033[38;2;59;90;165m█\\033[38;2;56;91;166m║
+ \\033[38;2;215;23;133m█\\033[38;2;212;24;134m█\\033[38;2;209;26;134m╔\\033[38;2;205;27;135m═\\033[38;2;202;28;136m═\\033[38;2;199;30;136m═\\033[38;2;196;31;137m╝\\033[38;2;193;33;138m \\033[38;2;190;34;138m█\\033[38;2;186;35;139m█\\033[38;2;183;37;140m║\\033[38;2;180;38;140m \\033[38;2;177;39;141m \\033[38;2;174;41;142m \\033[38;2;170;42;142m \\033[38;2;167;43;143m \\033[38;2;164;45;144m█\\033[38;2;161;46;144m█\\033[38;2;158;47;145m╔\\033[38;2;155;49;146m═\\033[38;2;151;50;146m═\\033[38;2;148;52;147m█\\033[38;2;145;53;148m█\\033[38;2;142;54;148m║ \\033[38;2;139;56;149m \\033[38;2;135;57;149m█\\033[38;2;132;58;150m█\\033[38;2;129;60;151m█\\033[38;2;126;61;151m╔\\033[38;2;123;62;152m╝\\033[38;2;120;64;153m \\033[38;2;116;65;153m \\033[38;2;113;67;154m█\\033[38;2;110;68;155m█\\033[38;2;107;69;155m║\\033[38;2;104;71;156m╚\\033[38;2;101;72;157m█\\033[38;2;97;73;157m█\\033[38;2;94;75;158m╔\\033[38;2;91;76;159m╝\\033[38;2;88;77;159m█\\033[38;2;85;79;160m█\\033[38;2;81;80;161m║ \\033[38;2;78;81;161m█\\033[38;2;75;83;162m█\\033[38;2;72;84;163m╔\\033[38;2;69;86;163m═\\033[38;2;66;87;164m═\\033[38;2;62;88;165m█\\033[38;2;59;90;165m█\\033[38;2;56;91;166m║
+ \\033[38;2;215;23;133m█\\033[38;2;212;24;134m█\\033[38;2;209;26;134m║\\033[38;2;205;27;135m \\033[38;2;202;28;136m \\033[38;2;199;30;136m \\033[38;2;196;31;137m \\033[38;2;193;33;138m \\033[38;2;190;34;138m█\\033[38;2;186;35;139m█\\033[38;2;183;37;140m█\\033[38;2;180;38;140m█\\033[38;2;177;39;141m█\\033[38;2;174;41;142m█\\033[38;2;170;42;142m█\\033[38;2;167;43;143m╗ \\033[38;2;164;45;144m█\\033[38;2;161;46;144m█\\033[38;2;158;47;145m║\\033[38;2;155;49;146m \\033[38;2;151;50;146m \\033[38;2;148;52;147m█\\033[38;2;145;53;148m█\\033[38;2;142;54;148m║ \\033[38;2;139;56;149m█\\033[38;2;135;57;149m█\\033[38;2;132;58;150m█\\033[38;2;129;60;151m█\\033[38;2;126;61;151m█\\033[38;2;123;62;152m█\\033[38;2;120;64;153m█\\033[38;2;116;65;153m╗ \\033[38;2;113;67;154m█\\033[38;2;110;68;155m█\\033[38;2;107;69;155m║\\033[38;2;104;71;156m \\033[38;2;101;72;157m╚\\033[38;2;97;73;157m═\\033[38;2;94;75;158m╝\\033[38;2;91;76;159m \\033[38;2;88;77;159m█\\033[38;2;85;79;160m█\\033[38;2;81;80;161m║ \\033[38;2;78;81;161m█\\033[38;2;75;83;162m█\\033[38;2;72;84;163m║\\033[38;2;69;86;163m \\033[38;2;66;87;164m \\033[38;2;62;88;165m█\\033[38;2;59;90;165m█\\033[38;2;56;91;166m║
+ \\033[38;2;215;23;133m╚\\033[38;2;212;24;134m═\\033[38;2;209;26;134m╝\\033[38;2;205;27;135m \\033[38;2;202;28;136m \\033[38;2;199;30;136m \\033[38;2;196;31;137m \\033[38;2;193;33;138m \\033[38;2;190;34;138m╚\\033[38;2;186;35;139m═\\033[38;2;183;37;140m═\\033[38;2;180;38;140m═\\033[38;2;177;39;141m═\\033[38;2;174;41;142m═\\033[38;2;170;42;142m═\\033[38;2;167;43;143m╝ \\033[38;2;164;45;144m╚\\033[38;2;161;46;144m═\\033[38;2;158;47;145m╝\\033[38;2;155;49;146m \\033[38;2;151;50;146m \\033[38;2;148;52;147m╚\\033[38;2;145;53;148m═\\033[38;2;142;54;148m╝ \\033[38;2;139;56;149m╚\\033[38;2;135;57;149m═\\033[38;2;132;58;150m═\\033[38;2;129;60;151m═\\033[38;2;126;61;151m═\\033[38;2;123;62;152m═\\033[38;2;120;64;153m═\\033[38;2;116;65;153m╝ \\033[38;2;113;67;154m╚\\033[38;2;110;68;155m═\\033[38;2;107;69;155m╝\\033[38;2;104;71;156m \\033[38;2;101;72;157m \\033[38;2;97;73;157m \\033[38;2;94;75;158m \\033[38;2;91;76;159m \\033[38;2;88;77;159m╚\\033[38;2;85;79;160m═\\033[38;2;81;80;161m╝ \\033[38;2;78;81;161m╚\\033[38;2;75;83;162m═\\033[38;2;72;84;163m╝\\033[38;2;69;86;163m \\033[38;2;66;87;164m \\033[38;2;62;88;165m╚\\033[38;2;59;90;165m═\\033[38;2;56;91;166m╝\\033[0m
+ """);
+ // Plazma end - Branding
Path path = (Path) optionSet.valueOf("pidFile"); // CraftBukkit
if (path != null) {
@@ -243,12 +_,12 @@
}
File mcMeta = new File(bukkitDataPackFolder, "pack.mcmeta");
try {
- com.google.common.io.Files.write("{\n"
- + " \"pack\": {\n"
- + " \"description\": \"Data pack for resources provided by Bukkit plugins\",\n"
- + " \"pack_format\": " + SharedConstants.getCurrentVersion().getPackVersion(net.minecraft.server.packs.PackType.SERVER_DATA) + "\n"
- + " }\n"
- + "}\n", mcMeta, com.google.common.base.Charsets.UTF_8);
+ com.google.common.io.Files.asCharSink(mcMeta, com.google.common.base.Charsets.UTF_8).write("{\n"
+ + " \"pack\": {\n"
+ + " \"description\": \"Data pack for resources provided by Bukkit plugins\",\n"
+ + " \"pack_format\": " + SharedConstants.getCurrentVersion().getPackVersion(net.minecraft.server.packs.PackType.SERVER_DATA) + "\n"
+ + " }\n"
+ + "}\n");
} catch (java.io.IOException ex) {
throw new RuntimeException("Could not initialize Bukkit datapack", ex);
}
@@ -309,24 +_,11 @@
)
)
.get();
- } catch (Exception var39) {
- LOGGER.warn(
- "Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode",
- (Throwable)var39
- );
+ } catch (final Exception e) { // Plazma
+ LOGGER.warn("Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode", e); // Plazma
return;
}
- /*
- RegistryAccess.Frozen frozen = worldStem.registries().compositeAccess();
- boolean hasOptionSpec1 = optionSet.has(optionSpec6);
- if (optionSet.has(optionSpec4) || hasOptionSpec1) {
- forceUpgrade(levelStorageAccess, DataFixers.getDataFixer(), optionSet.has(optionSpec5), () -> true, frozen, hasOptionSpec1);
- }
-
- WorldData worldData = worldStem.worldData();
- levelStorageAccess.saveDataTag(frozen, worldData);
- */
Class.forName(net.minecraft.world.entity.npc.VillagerTrades.class.getName()); // Paper - load this sync so it won't fail later async
final DedicatedServer dedicatedServer = MinecraftServer.spin(
thread1 -> {
@@ -343,18 +_,12 @@
services,
LoggerChunkProgressListener::createFromGameruleRadius
);
- /*
- dedicatedServer1.setPort(optionSet.valueOf(optionSpec11));
- */
// Paper start
if (optionSet.has("serverId")) {
dedicatedServer1.setId((String) optionSet.valueOf("serverId"));
}
dedicatedServer1.setDemo(optionSet.has("demo"));
// Paper end
- /*
- dedicatedServer1.setId(optionSet.valueOf(optionSpec12));
- */
boolean flag = !optionSet.has("nogui") && !optionSet.nonOptionArguments().contains("nogui");
if (flag && !GraphicsEnvironment.isHeadless()) {
dedicatedServer1.showGui();
@@ -370,16 +_,6 @@
return dedicatedServer1;
}
);
- /* CraftBukkit start
- Thread thread = new Thread("Server Shutdown Thread") {
- @Override
- public void run() {
- dedicatedServer.halt(true);
- }
- };
- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
- Runtime.getRuntime().addShutdownHook(thread);
- */ // CraftBukkit end
} catch (Exception var42) {
LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", (Throwable)var42);
}
@@ -443,7 +_,7 @@
} else {
try {
Thread.sleep(1000L);
- } catch (InterruptedException var12) {
+ } catch (InterruptedException ignore) { // Plazma - Fix IDE warning
}
}
}

View File

@@ -0,0 +1,177 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -105,47 +_,12 @@
public void run() {
// CraftBukkit start
if (!org.bukkit.craftbukkit.Main.useConsole) return;
+ // Plazma start - Improve code quality
// Paper start - Use TerminalConsoleAppender
- if (DedicatedServer.this.gui == null || System.console() != null) // Purpur - GUI Improvements - has no GUI or has console (did not double-click)
+ if (DedicatedServer.this.gui != null && System.console() == null) return;
new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start();
- /*
- jline.console.ConsoleReader bufferedreader = DedicatedServer.this.reader;
- // MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return
- try {
- System.in.available();
- } catch (IOException ex) {
- return;
- }
- // CraftBukkit end
- String string1;
- try {
- // CraftBukkit start - JLine disabling compatibility
- while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning()) {
- if (org.bukkit.craftbukkit.Main.useJline) {
- string1 = bufferedreader.readLine(">", null);
- } else {
- string1 = bufferedreader.readLine();
- }
-
- // SPIGOT-5220: Throttle if EOF (ctrl^d) or stdin is /dev/null
- if (string1 == null) {
- try {
- Thread.sleep(50L);
- } catch (InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- continue;
- }
- if (string1.trim().length() > 0) { // Trim to filter lines which are just spaces
- DedicatedServer.this.issueCommand(s, DedicatedServer.this.getServerCommandListener());
- }
- // CraftBukkit end
- }
- } catch (IOException var4) {
- DedicatedServer.LOGGER.error("Exception handling console input", (Throwable)var4);
- }
- */
- // Paper end
+ // Paper end - Use TerminalConsoleAppender
+ // Plazma end - Improve code quality
}
};
// CraftBukkit start - TODO: handle command-line logging arguments
@@ -156,21 +_,7 @@
}
global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler());
- // Paper start - Not needed with TerminalConsoleAppender
- final org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getRootLogger();
- /*
- final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger());
- for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) {
- if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) {
- logger.removeAppender(appender);
- }
- }
-
- TerminalConsoleWriterThread writerThread = new TerminalConsoleWriterThread(System.out, this.reader);
- this.reader.setCompletionHandler(new TerminalCompletionHandler(writerThread, this.reader.getCompletionHandler()));
- writerThread.start();
- */
- // Paper end - Not needed with TerminalConsoleAppender
+ final org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getRootLogger(); // Paper - Not needed with TCA // Plazma - Remove commented codes
System.setOut(org.apache.logging.log4j.io.IoBuilder.forLogger(logger).setLevel(org.apache.logging.log4j.Level.INFO).buildPrintStream());
System.setErr(org.apache.logging.log4j.io.IoBuilder.forLogger(logger).setLevel(org.apache.logging.log4j.Level.WARN).buildPrintStream());
@@ -208,6 +_,7 @@
org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
org.spigotmc.SpigotConfig.registerCommands();
// Spigot end
+ // noinspection ResultOfMethodCallIgnored // Plazma - For preloading
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc.
// Purpur start - Configurable void damage height and damage
try {
@@ -234,15 +_,7 @@
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
- /*// Purpur start - Purpur config files // Purpur - Configurable void damage height and damage
- try {
- org.purpurmc.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
- } catch (Exception e) {
- DedicatedServer.LOGGER.error("Unable to load server configuration", e);
- return false;
- }
- org.purpurmc.purpur.PurpurConfig.registerCommands();
- */// Purpur end - Purpur config files // Purpur - Configurable void damage height and damage
+ // noinspection ResultOfMethodCallIgnored // Plazma - For preloading
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
this.setPvpAllowed(properties.pvp);
@@ -287,8 +_,7 @@
LOGGER.warn("**** FAILED TO BIND TO PORT!");
LOGGER.warn("The exception was: {}", var10.toString());
LOGGER.warn("Perhaps a server is already running on that port?");
- if (true) throw new IllegalStateException("Failed to bind to port", var10); // Paper - Propagate failed to bind to port error
- return false;
+ throw new IllegalStateException("Failed to bind to port", var10); // Paper - Propagate failed to bind to port error
}
// Purpur start - UPnP Port Forwarding
if (org.purpurmc.purpur.PurpurConfig.useUPnP) {
@@ -380,14 +_,6 @@
this.rconThread = RconThread.create(this);
}
- if (false && this.getMaxTickLength() > 0L) { // Spigot - disable
- Thread thread1 = new Thread(new ServerWatchdog(this));
- thread1.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandlerWithName(LOGGER));
- thread1.setName("Server Watchdog");
- thread1.setDaemon(true);
- thread1.start();
- }
-
if (properties.enableJmxMonitoring) {
MinecraftServerStatistics.registerJmxMonitoring(this);
LOGGER.info("JMX monitoring enabled");
@@ -459,10 +_,6 @@
this.rconThread.stopNonBlocking(); // Paper - don't wait for remote connections
}
- if (this.queryThreadGs4 != null) {
- // this.remoteStatusListener.stop(); // Paper - don't wait for remote connections
- }
-
this.hasFullyShutdown = true; // Paper - Improved watchdog support
System.exit(this.abnormalExit ? 70 : 0); // CraftBukkit // Paper - Improved watchdog support
}
@@ -728,7 +_,7 @@
private void waitForRetry() {
try {
Thread.sleep(5000L);
- } catch (InterruptedException var2) {
+ } catch (InterruptedException ignore) { // Plazma - Fix IDE warning
}
}
@@ -748,7 +_,7 @@
org.bukkit.plugin.Plugin[] plugins = this.server.getPluginManager().getPlugins();
result.append(this.server.getName());
- result.append(" on Bukkit ");
+ result.append(" on Plazma "); // Plazma - Rebrand
result.append(this.server.getBukkitVersion());
if (plugins.length > 0 && this.server.getQueryPlugins()) {
@@ -759,9 +_,9 @@
result.append("; ");
}
- result.append(plugins[i].getDescription().getName());
+ result.append(plugins[i].getPluginMeta().getName()); // Plazma - Use modern method
result.append(" ");
- result.append(plugins[i].getDescription().getVersion().replaceAll(";", ","));
+ result.append(plugins[i].getPluginMeta().getVersion().replaceAll(";", ",")); // Plazma - Use modern method
}
}
@@ -876,7 +_,7 @@
private static ServerLinks createServerLinks(DedicatedServerSettings settings) {
Optional<URI> optional = parseBugReportLink(settings.getProperties());
- return optional.<ServerLinks>map(uri -> new ServerLinks(List.of(ServerLinks.KnownLinkType.BUG_REPORT.create(uri)))).orElse(ServerLinks.EMPTY);
+ return optional.map(uri -> new ServerLinks(List.of(ServerLinks.KnownLinkType.BUG_REPORT.create(uri)))).orElse(ServerLinks.EMPTY); // Plazma - Remove unnecessary type parameter
}
private static Optional<URI> parseBugReportLink(DedicatedServerProperties properties) {

View File

@@ -0,0 +1,17 @@
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -49,11 +_,11 @@
public final boolean onlineMode = this.get("online-mode", true);
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
public final String serverIp = this.get("server-ip", "");
- public final String serverName = this.get("server-name", "Unknown Server"); // Purpur - Bring back server name
+ public final String serverName = this.get("server-name", "A Plazma Server"); // Purpur - Bring back server name // Plazma - no
public final boolean pvp = this.get("pvp", true);
public final boolean allowFlight = this.get("allow-flight", false);
- public final String motd = this.get("motd", "A Minecraft Server");
- public final String bugReportLink = this.get("bug-report-link", "");
+ public final String motd = this.get("motd", "A Plazma Server"); // Plazma - Rebrand
+ public final String bugReportLink = this.get("bug-report-link", "https://github.com/PlazmaMC/PlazmaBukkit/issues"); // Plazma - Rebrand
public final boolean forceGameMode = this.get("force-gamemode", false);
public final boolean enforceWhitelist = this.get("enforce-whitelist", false);
public final Difficulty difficulty = this.get(

View File

@@ -0,0 +1,137 @@
--- a/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/net/minecraft/server/gui/MinecraftServerGui.java
@@ -3,25 +_,14 @@
import com.google.common.collect.Lists;
import com.mojang.logging.LogQueues;
import com.mojang.logging.LogUtils;
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Font;
+import java.awt.*; // Plazma - Improve code quality
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollBar;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
+import javax.swing.*; // Plazma - Improve code quality
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.text.BadLocationException;
@@ -31,11 +_,10 @@
import org.slf4j.Logger;
public class MinecraftServerGui extends JComponent {
- private static final Font MONOSPACED = new Font("Monospaced", 0, 12);
+ private static final Font MONOSPACED = new Font("Monospaced", Font.PLAIN, 12); // Plazma - Improve code quality
private static final Logger LOGGER = LogUtils.getLogger();
- private static final String TITLE = "Minecraft server";
- private static final String SHUTDOWN_TITLE = "Minecraft server - shutting down!";
private final DedicatedServer server;
+ @org.jspecify.annotations.Nullable // Plazma - Improve code quality
private Thread logAppenderThread;
private final Collection<Runnable> finalizers = Lists.newArrayList();
final AtomicBoolean isClosing = new AtomicBoolean();
@@ -48,12 +_,12 @@
public static MinecraftServerGui showFrameFor(final DedicatedServer server) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception var3) {
+ } catch (Exception ignore) { // Plazma - Fix IDE warning
}
- final JFrame jFrame = new JFrame("Purpur Minecraft server"); // Purpur - Improve GUI
+ final JFrame jFrame = new JFrame("Plazma Minecraft server"); // Purpur - Improve GUI // Plazma - Rebrand
final MinecraftServerGui minecraftServerGui = new MinecraftServerGui(server);
- jFrame.setDefaultCloseOperation(2);
+ jFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); // Plazma - Improve code quality
jFrame.add(minecraftServerGui);
jFrame.pack();
jFrame.setLocationRelativeTo(null);
@@ -110,7 +_,7 @@
private JComponent buildPlayerPanel() {
JList<?> jList = new PlayerListComponent(this.server);
- JScrollPane jScrollPane = new JScrollPane(jList, 22, 30);
+ JScrollPane jScrollPane = new JScrollPane(jList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); // Plazma - Improve code quality
jScrollPane.setBorder(new TitledBorder(new EtchedBorder(), "Players"));
return jScrollPane;
}
@@ -118,7 +_,7 @@
private JComponent buildChatPanel() {
JPanel jPanel = new JPanel(new BorderLayout());
org.purpurmc.purpur.gui.JColorTextPane jTextArea = new org.purpurmc.purpur.gui.JColorTextPane(); // Purpur - GUI Improvements
- JScrollPane jScrollPane = new JScrollPane(jTextArea, 22, 30);
+ JScrollPane jScrollPane = new JScrollPane(jTextArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); // Plazma - Improve code quality
jTextArea.setEditable(false);
jTextArea.setFont(MONOSPACED);
JTextField jTextField = new JTextField();
@@ -163,11 +_,6 @@
}
});
// Purpur end - GUI Improvements
- jTextArea.addFocusListener(new FocusAdapter() {
- @Override
- public void focusGained(FocusEvent event) {
- }
- });
jPanel.add(jScrollPane, "Center");
jPanel.add(jTextField, "South");
jPanel.setBorder(new TitledBorder(new EtchedBorder(), "Log and chat"));
@@ -183,7 +_,7 @@
}
public void start() {
- this.logAppenderThread.start();
+ java.util.Objects.requireNonNull(this.logAppenderThread).start(); // Plazma - Improve code quality
}
public void close() {
@@ -196,22 +_,16 @@
this.finalizers.forEach(Runnable::run);
}
- private static final java.util.regex.Pattern ANSI = java.util.regex.Pattern.compile("\\e\\[[\\d;]*[^\\d;]"); // CraftBukkit // Paper
public void print(org.purpurmc.purpur.gui.JColorTextPane textArea, JScrollPane scrollPane, String line) { // Purpur - GUI Improvements
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(() -> this.print(textArea, scrollPane, line));
} else {
- Document document = textArea.getDocument();
JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
boolean flag = false;
if (scrollPane.getViewport().getView() == textArea) {
flag = verticalScrollBar.getValue() + verticalScrollBar.getSize().getHeight() + MONOSPACED.getSize() * 4 > verticalScrollBar.getMaximum();
}
- /*try { // Purpur - GUI Improvements
- document.insertString(document.getLength(), MinecraftServerGui.ANSI.matcher(line).replaceAll(""), null); // CraftBukkit
- } catch (BadLocationException var8) {
- }*/ // Purpur - GUI Improvements
textArea.append(line); // Purpur - GUI Improvements
if (flag) {
@@ -249,11 +_,11 @@
try {
java.awt.Desktop.getDesktop().browse(java.net.URI.create(onboardingLink));
} catch (java.io.IOException exception) {
- LOGGER.error("Unable to find a default browser. Please manually visit the website: " + onboardingLink, exception);
+ LOGGER.error("Unable to find a default browser. Please manually visit the website: {}", onboardingLink, exception); // Plazma - Improve code quality
} catch (UnsupportedOperationException exception) {
- LOGGER.error("This platform does not support the BROWSE action. Please manually visit the website: " + onboardingLink, exception);
+ LOGGER.error("This platform does not support the BROWSE action. Please manually visit the website: {}", onboardingLink, exception); // Plazma - Improve code quality
} catch (SecurityException exception) {
- LOGGER.error("This action has been denied by the security manager. Please manually visit the website: " + onboardingLink, exception);
+ LOGGER.error("This action has been denied by the security manager. Please manually visit the website: {}", onboardingLink, exception); // Plazma - Improve code quality
}
}
});

View File

@@ -0,0 +1,29 @@
--- a/net/minecraft/world/damagesource/DamageSource.java
+++ b/net/minecraft/world/damagesource/DamageSource.java
@@ -56,7 +_,7 @@
}
// Purpur end - Dont run with scissors!
- // Purpur start - - Stonecutter damage
+ // Purpur start - Stonecutter damages // Plazma - Fix typo ;)
public DamageSource stonecutter() {
this.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.CONTACT);
this.stonecutter = true;
@@ -75,7 +_,7 @@
public DamageSource eventEntityDamager(final Entity entity) {
if (this.directEntity != null) {
- throw new IllegalStateException("Cannot set an event damager when a direct entity is already set (report a bug to Paper)");
+ throw new IllegalStateException("Cannot set an event damager when a direct entity is already set (report a bug to Plazma)"); // Plazma - Rebrand
}
final DamageSource damageSource = this.copy();
damageSource.eventEntityDamager = entity;
@@ -104,7 +_,7 @@
public DamageSource causingBlockSnapshot(final @Nullable org.bukkit.block.BlockState blockState) {
if (this.eventBlockDamager != null) {
- throw new IllegalStateException("Cannot set a block snapshot when an event block damager is already set (report a bug to Paper)");
+ throw new IllegalStateException("Cannot set a block snapshot when an event block damager is already set (report a bug to Plazma)"); // Plazma - Rebrand
}
final DamageSource damageSource = this.copy();
damageSource.fromBlockSnapshot = blockState;

View File

@@ -0,0 +1,10 @@
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -171,6 +_,7 @@
public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - Purpur config files
+ @Nullable // Plazma - Null safety
public static BlockPos lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter;
private org.spigotmc.TickLimiter tileLimiter;

View File

@@ -0,0 +1,20 @@
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -16,8 +_,6 @@
public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.io.ChunkSystemRegionFileStorage { // Paper - rewrite chunk system
private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper
- public static final String ANVIL_EXTENSION = ".mca";
- private static final int MAX_CACHE_SIZE = 256;
public final Long2ObjectLinkedOpenHashMap<RegionFile> regionCache = new Long2ObjectLinkedOpenHashMap<>();
private final RegionStorageInfo info;
private final Path folder;
@@ -283,7 +_,7 @@
// Paper start
private static void printOversizedLog(String msg, Path file, int x, int z) {
- org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PURPUR - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur - Rebrand
+ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PLAZMA - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur - Rebrand // Plazma - Rebrand
}
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {

View File

@@ -0,0 +1,100 @@
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -109,7 +_,7 @@
}
/**
- * Gets the plugin specific data.
+ * Gets the plugin-specific data.
*
* @return The plugin specific data.
*/
@@ -132,7 +_,7 @@
}
/**
- * Gets the server specific data.
+ * Gets the server-specific data.
*
* @return The server specific data.
*/
@@ -186,7 +_,7 @@
if (data == null) {
throw new IllegalArgumentException("Data cannot be null!");
}
- HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
+ HttpsURLConnection connection = (HttpsURLConnection) new java.net.URI(URL).toURL().openConnection(); // Plazma - Use modern method
// Compress the data to save bandwidth
byte[] compressedData = compress(data.toString());
@@ -211,10 +_,10 @@
}
/**
- * Gzips the given String.
+ * Compresses the given String using Gzip.
*
- * @param str The string to gzip.
- * @return The gzipped String.
+ * @param str The string to compress.
+ * @return The compressed String.
* @throws IOException If the compression failed.
*/
private static byte[] compress(final String str) throws IOException {
@@ -223,7 +_,7 @@
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
- gzip.write(str.getBytes("UTF-8"));
+ gzip.write(str.getBytes(java.nio.charset.StandardCharsets.UTF_8)); // Plazma - Use modern method
gzip.close();
return outputStream.toByteArray();
}
@@ -396,7 +_,7 @@
}
/**
- * Represents a custom single line chart.
+ * Represents a custom single-line chart.
*/
public static class SingleLineChart extends CustomChart {
@@ -576,12 +_,14 @@
config.addDefault("logFailedRequests", false);
// Inform the server owners about bStats
- config.options().header(
- "bStats collects some data for plugin authors like how many servers are using their plugins.\n" +
- "To honor their work, you should not disable it.\n" +
- "This has nearly no effect on the server performance!\n" +
- "Check out https://bStats.org/ to learn more :)"
- ).copyDefaults(true);
+ // Plazma start - Use modern method
+ config.options().setHeader(List.of(
+ "bStats collects some data for plugin authors like how many servers are using their plugins.",
+ "To honor their work, you should not disable it.",
+ "This has nearly no effect on the server performance!",
+ "Check out https://bStats.org/ to learn more :)"
+ )).copyDefaults(true);
+ // Plazma end - Use modern method
try {
config.save(configFile);
} catch (IOException ignored) {
@@ -592,7 +_,7 @@
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
- Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur - Purpur config files
+ Metrics metrics = new Metrics("Plazma", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur - Purpur config files // Plazma - Rebrand
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
@@ -602,7 +_,7 @@
metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size()));
metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() ? "bungee" : "offline"))); // Purpur - Purpur config files
- metrics.addCustomChart(new Metrics.SimplePie("purpur_version", () -> (org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() != null) ? org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() : "unknown")); // Purpur - Purpur config files
+ metrics.addCustomChart(new Metrics.SimplePie("plazma_version", () -> (org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() != null) ? org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() : "unknown")); // Purpur - Purpur config files // Plazma - Rebrand
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();

View File

@@ -0,0 +1,53 @@
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -36,7 +_,7 @@
private static final int DISTANCE_ERROR = -1;
private static final int DISTANCE_UNKNOWN = -2;
// Purpur start - Rebrand
- private static final String DOWNLOAD_PAGE = "https://purpurmc.org/downloads";
+ private static final String DOWNLOAD_PAGE = "https://plazmamc.org/downloads";
private static int distance = DISTANCE_UNKNOWN; public int distance() { return distance; }
// Purpur end - Rebrand
@@ -52,7 +_,7 @@
if (build.buildNumber().isEmpty() && build.gitCommit().isEmpty()) {
updateMessage = text("You are running a development version without access to version information", color(0xFF5300));
} else {
- updateMessage = getUpdateStatusMessage("PurpurMC/Purpur", build); // Purpur - Rebrand
+ updateMessage = getUpdateStatusMessage("PlazmaMC/Plazma", build); // Purpur - Rebrand // Plazma - Configurable Plazma
}
final @Nullable Component history = this.getHistory();
@@ -87,23 +_,23 @@
}
private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) {
- try {
- try (final BufferedReader reader = Resources.asCharSource(
- URI.create("https://api.purpurmc.org/v2/purpur/" + build.minecraftVersionId()).toURL(), // Purpur - Rebrand
- Charsets.UTF_8
- ).openBufferedStream()) {
+ // Plazma start - Configurable Plazma
+ final String branch = build.gitBranch().orElse("ver/" + build.minecraftVersionId());
+
+ try (final BufferedReader reader = Resources.asCharSource(URI.create(branch).toURL(), java.nio.charset.StandardCharsets.UTF_8).openBufferedStream()) {
+ try {
final JsonObject json = new Gson().fromJson(reader, JsonObject.class);
- //final JsonArray builds = json.getAsJsonArray("builds"); // Purpur - Rebrand
- final int latest = json.getAsJsonObject("builds").getAsJsonPrimitive("latest").getAsInt(); // Purpur - Rebrand
+ final int latest = json.getAsJsonObject("lastSuccessfulBuild").getAsJsonPrimitive("number").getAsInt();
return latest - jenkinsBuild;
- } catch (final JsonSyntaxException ex) {
- LOGGER.error("Error parsing json from Purpur's downloads API", ex); // Purpur - Rebrand
+ } catch (final JsonSyntaxException e) {
+ LOGGER.error("Error parsing json from Jenkins API", e);
return DISTANCE_ERROR;
}
} catch (final IOException e) {
LOGGER.error("Error while parsing version", e);
return DISTANCE_ERROR;
}
+ // Plazma end - Configurable Plazma
}
// Contributed by Techcable <Techcable@outlook.com> in GH-65

View File

@@ -0,0 +1,11 @@
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -20,7 +_,7 @@
@Override
protected LineReader buildReader(LineReaderBuilder builder) {
builder
- .appName("Purpur") // Purpur - Rebrand
+ .appName("Plazma") // Purpur - Rebrand // Plazma - Configurable Plazma
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);

View File

@@ -0,0 +1,38 @@
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -30,8 +_,12 @@
private static final String ATTRIBUTE_GIT_BRANCH = "Git-Branch";
private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit";
- private static final String BRAND_PAPER_NAME = "Paper";
- private static final String BRAND_PURPUR_NAME = "Purpur"; // Purpur - Rebrand
+ // Plazma start - Rebrand
+ private static final java.util.Set<Key> COMPATIBLE = new java.util.HashSet<>() {{
+ add(BRAND_PAPER_ID);
+ add(BRAND_PURPUR_ID);
+ }};
+ // Plazma end - Rebrand
private static final String BUILD_DEV = "DEV";
@@ -43,9 +_,9 @@
this(
getManifestAttribute(manifest, ATTRIBUTE_BRAND_ID)
.map(Key::key)
- .orElse(BRAND_PURPUR_ID), // Purpur - Fix pufferfish issues // Purpur - Rebrand
+ .orElse(BRAND_PLAZMA_ID), // Purpur - Fix pufferfish issues // Purpur - Rebrand
getManifestAttribute(manifest, ATTRIBUTE_BRAND_NAME)
- .orElse(BRAND_PURPUR_NAME), // Purpur - Fix pufferfish issues // Purpur - Rebrand
+ .orElse("Plazma"), // Purpur - Fix pufferfish issues // Purpur - Rebrand // Plazma - Rebrand
SharedConstants.getCurrentVersion().getId(),
SharedConstants.getCurrentVersion().getName(),
getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER)
@@ -62,7 +_,7 @@
@Override
public boolean isBrandCompatible(final @NotNull Key brandId) {
- return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); // Purpur - Fix pufferfish issues // Purpur - Rebrand
+ return brandId.equals(this.brandId) || COMPATIBLE.contains(brandId); // Purpur - Fix pufferfish issues // Purpur - Rebrand // Plazma - Rebrand
}
@Override

View File

@@ -0,0 +1,92 @@
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -26,13 +_,6 @@
// Paper end - Reset loggers after shutdown
public static void main(String[] args) {
- // Paper start
- final String warnWhenLegacyFormattingDetected = String.join(".", "net", "kyori", "adventure", "text", "warnWhenLegacyFormattingDetected");
- if (false && System.getProperty(warnWhenLegacyFormattingDetected) == null) {
- System.setProperty(warnWhenLegacyFormattingDetected, String.valueOf(true));
- }
- // Paper end
- // Todo: Installation script
if (System.getProperty("jdk.nio.maxCachedBufferSize") == null) System.setProperty("jdk.nio.maxCachedBufferSize", "262144"); // Paper - cap per-thread NIO cache size; https://www.evanjones.ca/java-bytebuffer-leak.html
OptionParser parser = new OptionParser() {
{
@@ -143,7 +_,7 @@
this.acceptsAll(Main.asList("noconsole"), "Disables the console");
- this.acceptsAll(Main.asList("v", "version"), "Show the CraftBukkit Version");
+ this.acceptsAll(Main.asList("v", "version"), "Show the Plazma Version"); // Plazma - Rebrand
this.acceptsAll(Main.asList("demo"), "Demo mode");
@@ -183,13 +_,6 @@
.defaultsTo(new File("purpur.yml"))
.describedAs("Yml file");
// Purpur end - Purpur config files
- // Paper start
- acceptsAll(asList("server-name"), "Name of the server")
- .withRequiredArg()
- .ofType(String.class)
- .defaultsTo("Unknown Server")
- .describedAs("Name");
- // Paper end
}
};
@@ -234,26 +_,6 @@
try {
// Paper start - Handled by TerminalConsoleAppender
- /*
- // This trick bypasses Maven Shade's clever rewriting of our getProperty call when using String literals
- String jline_UnsupportedTerminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 'U', 'n', 's', 'u', 'p', 'p', 'o', 'r', 't', 'e', 'd', 'T', 'e', 'r', 'm', 'i', 'n', 'a', 'l'});
- String jline_terminal = new String(new char[]{'j', 'l', 'i', 'n', 'e', '.', 't', 'e', 'r', 'm', 'i', 'n', 'a', 'l'});
-
- Main.useJline = !(jline_UnsupportedTerminal).equals(System.getProperty(jline_terminal));
-
- if (options.has("nojline")) {
- System.setProperty("user.language", "en");
- Main.useJline = false;
- }
-
- if (Main.useJline) {
- AnsiConsole.systemInstall();
- } else {
- // This ensures the terminal literal will always match the jline implementation
- System.setProperty(jline.TerminalFactory.JLINE_TERMINAL, jline.UnsupportedTerminal.class.getName());
- }
- */
-
if (options.has("nojline")) {
System.setProperty(net.minecrell.terminalconsole.TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false");
useJline = false;
@@ -266,25 +_,8 @@
System.setProperty(net.minecrell.terminalconsole.TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
}
- if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { // Purpur - Disable outdated build check
- Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper
-
- Calendar deadline = Calendar.getInstance();
- deadline.add(Calendar.DAY_OF_YEAR, -14);
- if (buildDate.before(deadline.getTime())) {
- // Paper start - This is some stupid bullshit
- System.err.println("*** Warning, you've not updated in a while! ***");
- System.err.println("*** Please download a new build from https://papermc.io/downloads/paper ***"); // Paper
- //System.err.println("*** Server will start in 20 seconds ***");
- //Thread.sleep(TimeUnit.SECONDS.toMillis(20));
- // Paper end
- }
- }
-
System.setProperty("library.jansi.version", "Paper"); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows
System.setProperty("jdk.console", "java.base"); // Paper - revert default console provider back to java.base so we can have our own jline
- //System.out.println("Loading libraries, please wait...");
- //net.minecraft.server.Main.main(options);
io.papermc.paper.PaperBootstrap.boot(options);
} catch (Throwable t) {
t.printStackTrace();

View File

@@ -0,0 +1,436 @@
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -23,6 +_,7 @@
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.scheduler.BukkitWorker;
+import org.jspecify.annotations.NonNull; // Plazma - Null safety
/**
* The fundamental concepts for this implementation:
@@ -34,7 +_,7 @@
* Adding to the tail is atomic and very efficient; utility method is {@link #handle(CraftTask, long)} or {@link #addTask(CraftTask)}. </li>
* <li>Changing the period on a task is delicate.
* Any future task needs to notify waiting threads.
- * Async tasks must be synchronized to make sure that any thread that's finishing will remove itself from {@link #runners}.
+ * Async tasks must be synchronised to make sure that any thread that's finishing will remove itself from {@link #runners}.
* Another utility method is provided for this, {@link #cancelTask(int)}</li>
* <li>{@link #runners} provides a moderately up-to-date view of active tasks.
* If the linked head to tail set is read, all remaining tasks that were active at the time execution started will be located in runners.</li>
@@ -65,56 +_,31 @@
*/
private final AtomicInteger ids = new AtomicInteger(CraftScheduler.START_ID);
/**
- * Current head of linked-list. This reference is always stale, {@link CraftTask#next} is the live reference.
+ * Current head of a linked-list. This reference is always stale, {@link CraftTask#getNext} is the live reference.
*/
private volatile CraftTask head = new CraftTask();
/**
- * Tail of a linked-list. AtomicReference only matters when adding to queue
- */
- private final AtomicReference<CraftTask> tail = new AtomicReference<CraftTask>(this.head);
- /**
- * Main thread logic only
- */
- final PriorityQueue<CraftTask> pending = new PriorityQueue<CraftTask>(10, // Paper
- new Comparator<CraftTask>() {
- @Override
- public int compare(final CraftTask o1, final CraftTask o2) {
- int value = Long.compare(o1.getNextRun(), o2.getNextRun());
-
- // If the tasks should run on the same tick they should be run FIFO
- return value != 0 ? value : Long.compare(o1.getCreatedAt(), o2.getCreatedAt());
- }
- });
- /**
- * Main thread logic only
- */
- private final List<CraftTask> temp = new ArrayList<CraftTask>();
+ * Tail of a linked-list. AtomicReference only matters when adding to a queue
+ */
+ private final AtomicReference<CraftTask> tail = new AtomicReference<>(this.head); // Plazma - Remove unnecessary type parameter
+ /**
+ * Main thread logic only
+ */
+ final PriorityQueue<CraftTask> pending = new PriorityQueue<>(10, Comparator.comparingLong(CraftTask::getNextRun).thenComparingLong(CraftTask::getCreatedAt)); // Plazma - Remove unnecessary type parameter
+ /**
+ * Main thread logic only
+ */
+ private final List<CraftTask> temp = new ArrayList<>(); // Plazma - Remove unnecessary type parameter
/**
* These are tasks that are currently active. It's provided for 'viewing' the current state.
*/
- final ConcurrentHashMap<Integer, CraftTask> runners = new ConcurrentHashMap<Integer, CraftTask>(); // Paper
+ final ConcurrentHashMap<Integer, CraftTask> runners = new ConcurrentHashMap<>(); // Paper // Plazma - Remove unnecessary type parameter
/**
* The sync task that is currently running on the main thread.
*/
private volatile CraftTask currentTask = null;
// Paper start - Improved Async Task Scheduler
- volatile int currentTick = -1;/*
- private final Executor executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %d").build());
- private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {
- @Override
- StringBuilder debugTo(StringBuilder string) {
- return string;
- }
- };
- private CraftAsyncDebugger debugTail = this.debugHead;
-
- */ // Paper end
- private static final int RECENT_TICKS;
-
- static {
- RECENT_TICKS = 30;
- }
-
+ volatile int currentTick = -1; // Plazma
// Paper start
private final CraftScheduler asyncScheduler;
@@ -125,96 +_,98 @@
public CraftScheduler(boolean isAsync) {
this.isAsyncScheduler = isAsync;
- if (isAsync) {
- this.asyncScheduler = this;
- } else {
- this.asyncScheduler = new CraftAsyncScheduler();
- }
+ this.asyncScheduler = isAsync ? this : new CraftAsyncScheduler(); // Plazma - Improve code quality
}
// Paper end
@Override
- public int scheduleSyncDelayedTask(final Plugin plugin, final Runnable task) {
+ public int scheduleSyncDelayedTask(final @NonNull Plugin plugin, final @NonNull Runnable task) { // Plazma - Null safety
return this.scheduleSyncDelayedTask(plugin, task, 0L);
}
@Override
- public BukkitTask runTask(Plugin plugin, Runnable runnable) {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTask(final @NonNull Plugin plugin, final @NonNull Runnable runnable) { // Plazma - Null safety
return this.runTaskLater(plugin, runnable, 0L);
}
@Override
- public void runTask(Plugin plugin, Consumer<? super BukkitTask> task) throws IllegalArgumentException {
+ public void runTask(final @NonNull Plugin plugin, final @NonNull Consumer<? super BukkitTask> task) throws IllegalArgumentException { // Plazma - Null safety
this.runTaskLater(plugin, task, 0L);
}
@Deprecated
@Override
- public int scheduleAsyncDelayedTask(final Plugin plugin, final Runnable task) {
+ public int scheduleAsyncDelayedTask(final @NonNull Plugin plugin, final @NonNull Runnable task) { // Plazma - Null safety
return this.scheduleAsyncDelayedTask(plugin, task, 0L);
}
@Override
- public BukkitTask runTaskAsynchronously(Plugin plugin, Runnable runnable) {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskAsynchronously(final @NonNull Plugin plugin, final @NonNull Runnable runnable) { // Plazma - Null safety
return this.runTaskLaterAsynchronously(plugin, runnable, 0L);
}
@Override
- public void runTaskAsynchronously(Plugin plugin, Consumer<? super BukkitTask> task) throws IllegalArgumentException {
+ public void runTaskAsynchronously(final @NonNull Plugin plugin, final @NonNull Consumer<? super BukkitTask> task) throws IllegalArgumentException { // Plazma - Null safety
this.runTaskLaterAsynchronously(plugin, task, 0L);
}
@Override
- public int scheduleSyncDelayedTask(final Plugin plugin, final Runnable task, final long delay) {
+ public int scheduleSyncDelayedTask(final @NonNull Plugin plugin, final @NonNull Runnable task, long delay) { // Plazma - Null safety
return this.scheduleSyncRepeatingTask(plugin, task, delay, CraftTask.NO_REPEATING);
}
@Override
- public BukkitTask runTaskLater(Plugin plugin, Runnable runnable, long delay) {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskLater(final @NonNull Plugin plugin, final @NonNull Runnable runnable, long delay) { // Plazma - Null safety
return this.runTaskTimer(plugin, runnable, delay, CraftTask.NO_REPEATING);
}
@Override
- public void runTaskLater(Plugin plugin, Consumer<? super BukkitTask> task, long delay) throws IllegalArgumentException {
+ public void runTaskLater(final @NonNull Plugin plugin, final @NonNull Consumer<? super BukkitTask> task, long delay) throws IllegalArgumentException { // Plazma - Null safety
this.runTaskTimer(plugin, task, delay, CraftTask.NO_REPEATING);
}
@Deprecated
@Override
- public int scheduleAsyncDelayedTask(final Plugin plugin, final Runnable task, final long delay) {
+ public int scheduleAsyncDelayedTask(final @NonNull Plugin plugin, final @NonNull Runnable task, long delay) { // Plazma - Null safety
return this.scheduleAsyncRepeatingTask(plugin, task, delay, CraftTask.NO_REPEATING);
}
@Override
- public BukkitTask runTaskLaterAsynchronously(Plugin plugin, Runnable runnable, long delay) {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskLaterAsynchronously(final @NonNull Plugin plugin, final @NonNull Runnable runnable, long delay) { // Plazma - Null safety
return this.runTaskTimerAsynchronously(plugin, runnable, delay, CraftTask.NO_REPEATING);
}
@Override
- public void runTaskLaterAsynchronously(Plugin plugin, Consumer<? super BukkitTask> task, long delay) throws IllegalArgumentException {
+ public void runTaskLaterAsynchronously(final @NonNull Plugin plugin, final @NonNull Consumer<? super BukkitTask> task, long delay) throws IllegalArgumentException { // Plazma - Null safety
this.runTaskTimerAsynchronously(plugin, task, delay, CraftTask.NO_REPEATING);
}
@Override
- public void runTaskTimerAsynchronously(Plugin plugin, Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException {
+ public void runTaskTimerAsynchronously(final @NonNull Plugin plugin, final @NonNull Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException { // Plazma - Null safety
this.runTaskTimerAsynchronously(plugin, (Object) task, delay, period); // Paper
}
@Override
- public int scheduleSyncRepeatingTask(final Plugin plugin, final Runnable runnable, long delay, long period) {
+ public int scheduleSyncRepeatingTask(final @NonNull Plugin plugin, final @NonNull Runnable runnable, long delay, long period) { // Plazma - Null safety
return this.runTaskTimer(plugin, runnable, delay, period).getTaskId();
}
@Override
- public BukkitTask runTaskTimer(Plugin plugin, Runnable runnable, long delay, long period) {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskTimer(final @NonNull Plugin plugin, final @NonNull Runnable runnable, long delay, long period) { // Plazma - Null safety
return this.runTaskTimer(plugin, (Object) runnable, delay, period);
}
@Override
- public void runTaskTimer(Plugin plugin, Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException {
+ public void runTaskTimer(final @NonNull Plugin plugin, final @NonNull Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException { // Plazma - Null safety
this.runTaskTimer(plugin, (Object) task, delay, period);
}
- public BukkitTask runTaskTimer(Plugin plugin, Object runnable, long delay, long period) {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskTimer(final @NonNull Plugin plugin, final @NonNull Object runnable, long delay, long period) { // Plazma - Null safety
CraftScheduler.validate(plugin, runnable);
if (delay < 0L) {
delay = 0;
@@ -229,16 +_,18 @@
@Deprecated
@Override
- public int scheduleAsyncRepeatingTask(final Plugin plugin, final Runnable runnable, long delay, long period) {
+ public int scheduleAsyncRepeatingTask(final @NonNull Plugin plugin, final @NonNull Runnable runnable, long delay, long period) { // Plazma - Null safety
return this.runTaskTimerAsynchronously(plugin, runnable, delay, period).getTaskId();
}
@Override
- public BukkitTask runTaskTimerAsynchronously(Plugin plugin, Runnable runnable, long delay, long period) {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskTimerAsynchronously(final @NonNull Plugin plugin, final @NonNull Runnable runnable, long delay, long period) { // Plazma - Null safety
return this.runTaskTimerAsynchronously(plugin, (Object) runnable, delay, period);
}
- public BukkitTask runTaskTimerAsynchronously(Plugin plugin, Object runnable, long delay, long period) {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskTimerAsynchronously(final @NonNull Plugin plugin, final @NonNull Object runnable, long delay, long period) { // Plazma - Null safety
CraftScheduler.validate(plugin, runnable);
if (delay < 0L) {
delay = 0;
@@ -252,9 +_,10 @@
}
@Override
- public <T> Future<T> callSyncMethod(final Plugin plugin, final Callable<T> task) {
+ @NonNull // Plazma - Null safety
+ public <T> Future<T> callSyncMethod(final @NonNull Plugin plugin, final @NonNull Callable<T> task) { // Plazma - Null safety
CraftScheduler.validate(plugin, task);
- final CraftFuture<T> future = new CraftFuture<T>(task, plugin, this.nextId());
+ final CraftFuture<T> future = new CraftFuture<>(task, plugin, this.nextId()); // Plazma - Remove unnecessary type parameter
this.handle(future, 0L);
return future;
}
@@ -309,8 +_,7 @@
}
@Override
- public void cancelTasks(final Plugin plugin) {
- Preconditions.checkArgument(plugin != null, "Cannot cancel tasks of null plugin");
+ public void cancelTasks(final @NonNull Plugin plugin) { // Plazma - Null safety
// Paper start
if (!this.isAsyncScheduler) {
this.asyncScheduler.cancelTasks(plugin);
@@ -395,6 +_,7 @@
}
@Override
+ @NonNull // Plazma - Null safety
public List<BukkitWorker> getActiveWorkers() {
// Paper start
if (!isAsyncScheduler) {
@@ -402,7 +_,7 @@
return this.asyncScheduler.getActiveWorkers();
}
// Paper end
- final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
+ final ArrayList<BukkitWorker> workers = new ArrayList<>(); // Plazma - Remove unnecessary type parameter
for (final CraftTask taskObj : this.runners.values()) {
// Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
if (taskObj.isSync()) {
@@ -418,8 +_,9 @@
}
@Override
+ @NonNull // Plazma - Null safety
public List<BukkitTask> getPendingTasks() {
- final ArrayList<CraftTask> truePending = new ArrayList<CraftTask>();
+ final ArrayList<CraftTask> truePending = new ArrayList<>(); // Plazma - Remove unnecessary type parameter
for (CraftTask task = this.head.getNext(); task != null; task = task.getNext()) {
if (task.getTaskId() != -1) {
// -1 is special code
@@ -427,7 +_,7 @@
}
}
- final ArrayList<BukkitTask> pending = new ArrayList<BukkitTask>();
+ final ArrayList<BukkitTask> pending = new ArrayList<>(); // Plazma - Remove unnecessary type parameter
for (CraftTask task : this.runners.values()) {
if (task.getPeriod() >= CraftTask.NO_REPEATING) {
pending.add(task);
@@ -477,7 +_,7 @@
final String logMessage = String.format(
"Task #%s for %s generated an exception",
task.getTaskId(),
- task.getOwner().getDescription().getFullName());
+ task.getOwner().getPluginMeta().getDisplayName()); // Plazma - Use modern method
task.getOwner().getLogger().log(
Level.WARNING,
logMessage,
@@ -491,7 +_,7 @@
this.parsePending();
} else {
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Purpur"); // Paper // Purpur - Rebrand
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Plazma"); // Paper // Purpur - Rebrand // Plazma - Rebrand
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
@@ -508,12 +_,13 @@
//this.debugHead = this.debugHead.getNextHead(this.currentTick); // Paper
}
- protected void addTask(final CraftTask task) {
+ protected void addTask(final @NonNull CraftTask task) { // Plazma - Null safety
final CraftTask tailTask = this.tail.getAndSet(task);
tailTask.setNext(task);
}
- protected CraftTask handle(final CraftTask task, final long delay) { // Paper
+ @NonNull // Plazma - Null safety
+ protected CraftTask handle(final @NonNull CraftTask task, final long delay) { // Paper // Plazma - Null safety
// Paper start
if (!this.isAsyncScheduler && !task.isSync()) {
this.asyncScheduler.handle(task, delay);
@@ -525,8 +_,7 @@
return task;
}
- private static void validate(final Plugin plugin, final Object task) {
- Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
+ private static void validate(final @NonNull Plugin plugin, final @NonNull Object task) { // Plazma - Null safety
Preconditions.checkArgument(task instanceof Runnable || task instanceof Consumer || task instanceof Callable, "Task must be Runnable, Consumer, or Callable");
if (!plugin.isEnabled()) {
throw new IllegalPluginAccessException("Plugin attempted to register task while disabled");
@@ -569,79 +_,74 @@
@Override
public String toString() {
- // Paper start
- return "";
- /*
- int debugTick = this.currentTick;
- StringBuilder string = new StringBuilder("Recent tasks from ").append(debugTick - CraftScheduler.RECENT_TICKS).append('-').append(debugTick).append('{');
- this.debugHead.debugTo(string);
- return string.append('}').toString();
- */
- // Paper end
+ return ""; // Paper // Plazma
}
@Deprecated
@Override
- public int scheduleSyncDelayedTask(Plugin plugin, BukkitRunnable task, long delay) {
+ public int scheduleSyncDelayedTask(final @NonNull Plugin plugin, final @NonNull BukkitRunnable task, long delay) { // Plazma - Null safety
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskLater(Plugin, long)");
}
@Deprecated
@Override
- public int scheduleSyncDelayedTask(Plugin plugin, BukkitRunnable task) {
+ public int scheduleSyncDelayedTask(final @NonNull Plugin plugin, final @NonNull BukkitRunnable task) { // Plazma - Null safety
throw new UnsupportedOperationException("Use BukkitRunnable#runTask(Plugin)");
}
@Deprecated
@Override
- public int scheduleSyncRepeatingTask(Plugin plugin, BukkitRunnable task, long delay, long period) {
+ public int scheduleSyncRepeatingTask(final @NonNull Plugin plugin, final @NonNull BukkitRunnable task, long delay, long period) { // Plazma - Null safety
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskTimer(Plugin, long, long)");
}
@Deprecated
@Override
- public BukkitTask runTask(Plugin plugin, BukkitRunnable task) throws IllegalArgumentException {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTask(final @NonNull Plugin plugin, final @NonNull BukkitRunnable task) throws IllegalArgumentException { // Plazma - Null safety
throw new UnsupportedOperationException("Use BukkitRunnable#runTask(Plugin)");
}
@Deprecated
@Override
- public BukkitTask runTaskAsynchronously(Plugin plugin, BukkitRunnable task) throws IllegalArgumentException {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskAsynchronously(final @NonNull Plugin plugin, final @NonNull BukkitRunnable task) throws IllegalArgumentException { // Plazma - Null safety
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskAsynchronously(Plugin)");
}
@Deprecated
@Override
- public BukkitTask runTaskLater(Plugin plugin, BukkitRunnable task, long delay) throws IllegalArgumentException {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskLater(final @NonNull Plugin plugin, final @NonNull BukkitRunnable task, long delay) throws IllegalArgumentException { // Plazma - Null safety
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskLater(Plugin, long)");
}
@Deprecated
@Override
- public BukkitTask runTaskLaterAsynchronously(Plugin plugin, BukkitRunnable task, long delay) throws IllegalArgumentException {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskLaterAsynchronously(final @NonNull Plugin plugin, final @NonNull BukkitRunnable task, long delay) throws IllegalArgumentException { // Plazma - Null safety
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskLaterAsynchronously(Plugin, long)");
}
@Deprecated
@Override
- public BukkitTask runTaskTimer(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskTimer(final @NonNull Plugin plugin, final @NonNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException { // Plazma - Null safety
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskTimer(Plugin, long, long)");
}
@Deprecated
@Override
- public BukkitTask runTaskTimerAsynchronously(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException {
+ @NonNull // Plazma - Null safety
+ public BukkitTask runTaskTimerAsynchronously(final @NonNull Plugin plugin, final @NonNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException { // Plazma - Null safety
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskTimerAsynchronously(Plugin, long, long)");
}
// Paper start - add getMainThreadExecutor
@Override
- public Executor getMainThreadExecutor(Plugin plugin) {
- Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
- return command -> {
- Preconditions.checkArgument(command != null, "Command cannot be null");
- this.runTask(plugin, command);
- };
+ @NonNull // Plazma - Null safety
+ public Executor getMainThreadExecutor(final @NonNull Plugin plugin) { // Plazma - Null safety
+ return command -> this.runTask(plugin, command); // Plazma - Null safety
}
// Paper end
}

View File

@@ -0,0 +1,20 @@
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +_,7 @@
public static String getBukkitVersion() {
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.purpurmc.purpur/purpur-api/pom.properties"); // Pufferfish // Purpur - Rebrand
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.plazmamc.plazma/plazma-api/pom.properties"); // Pufferfish // Purpur - Rebrand // Plazma - Rebrand
Properties properties = new Properties();
if (stream != null) {
@@ -20,7 +_,7 @@
result = properties.getProperty("version");
} catch (IOException ex) {
- Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get Bukkit version!", ex);
+ Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get Plazma version!", ex); // Plazma - Rebrand
}
}

View File

@@ -0,0 +1,47 @@
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -77,14 +_,14 @@
if (isLongTimeout) {
// Paper end
logger.log(Level.SEVERE, "------------------------------");
- logger.log(Level.SEVERE, "The server has stopped responding! This is (probably) not a Purpur bug."); // Paper // Purpur - Rebrand
+ logger.log(Level.SEVERE, "The server has stopped responding! This is (probably) not a Plazma bug."); // Paper // Purpur - Rebrand // Plazma - Rebrand
logger.log(Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author");
logger.log(Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring");
logger.log(Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once");
logger.log(Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes");
- logger.log(Level.SEVERE, "If you are unsure or still think this is a Purpur bug, please report this to https://github.com/PurpurMC/Purpur/issues"); // Purpur - Rebrand
+ logger.log(Level.SEVERE, "If you are unsure or still think this is a Plazma bug, please report this to https://github.com/PlazmaMC/PlazmaBukkit/issues"); // Purpur - Rebrand // Plazma - Rebrand
logger.log(Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports");
- logger.log(Level.SEVERE, "Purpur version: " + Bukkit.getServer().getVersion()); // Purpur - Rebrand
+ logger.log(Level.SEVERE, "Plazma version: " + Bukkit.getServer().getVersion()); // Purpur - Rebrand // Plazma - Rebrand
if (net.minecraft.world.level.Level.lastPhysicsProblem != null) {
logger.log(Level.SEVERE, "------------------------------");
@@ -104,14 +_,14 @@
}
// Paper end
} else {
- logger.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur - Rebrand
+ logger.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PLAZMA - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur - Rebrand // Plazma - Rebrand
logger.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
}
// Paper end - Different message for short timeout
logger.log(Level.SEVERE, "------------------------------");
- logger.log(Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Purpur!):" ); // Paper // Purpur - Rebrand
+ logger.log(Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Plazma!):" ); // Paper // Purpur - Rebrand // Plazma - Rebrand
FeatureHooks.dumpAllChunkLoadInfo(MinecraftServer.getServer(), isLongTimeout); // Paper - log detailed tick information
- WatchdogThread.dumpThread(ManagementFactory.getThreadMXBean().getThreadInfo(MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE), logger);
+ WatchdogThread.dumpThread(ManagementFactory.getThreadMXBean().getThreadInfo(MinecraftServer.getServer().serverThread.threadId(), Integer.MAX_VALUE), logger); // Plazma - Use modern method
logger.log(Level.SEVERE, "------------------------------");
// Paper start - Only print full dump on long timeouts
@@ -122,7 +_,7 @@
WatchdogThread.dumpThread(thread, logger);
}
} else {
- logger.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH ---"); // Purpur - Rebrand
+ logger.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PLAZMA - THIS IS NOT A BUG OR A CRASH ---"); // Purpur - Rebrand // Plazma - Rebrand
}
logger.log(Level.SEVERE, "------------------------------");