Push forward
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Wed, 8 Jul 2026 18:15:19 +0800
|
||||
Subject: [PATCH] Rebrand to Shiroha
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index 08745a35b1ce8cc56d970472088de3cd17b9e43a..287cff1f4d994584457f00b1e42f283e92585033 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
@@ -593,7 +593,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("Folia", serverUUID, logFailedRequests, Bukkit.getLogger()); // Folia - we have our own bstats page
|
||||
+ Metrics metrics = new Metrics("Shiroha", serverUUID, logFailedRequests, Bukkit.getLogger()); // Folia - we have our own bstats page // Shiroha - Rebrand to Shiroha
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||
String minecraftVersion = Bukkit.getVersion();
|
||||
@@ -607,11 +607,11 @@ public class Metrics {
|
||||
final String implVersion = org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion();
|
||||
if (implVersion != null) {
|
||||
final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
|
||||
- paperVersion = "git-Folia-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Folia - we have our own bstats page
|
||||
+ paperVersion = "git-Shiroha-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Folia - we have our own bstats page // Shiroha - Rebrand to Shiroha
|
||||
} else {
|
||||
paperVersion = "unknown";
|
||||
}
|
||||
- metrics.addCustomChart(new Metrics.SimplePie("folia_version", () -> paperVersion)); // Folia - we have our own bstats page
|
||||
+ metrics.addCustomChart(new Metrics.SimplePie("shiroha_version", () -> paperVersion)); // Folia - we have our own bstats page // Shiroha - Rebrand to Shiroha
|
||||
|
||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
index 30815c8970b1f1c88a3c7bb5fd36efd915f1687d..05f159bb5a8499f8957367ed11a9f11035de418a 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -40,8 +40,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
private static final ComponentLogger COMPONENT_LOGGER = ComponentLogger.logger(LogManager.getRootLogger().getName());
|
||||
private static final int DISTANCE_ERROR = -1;
|
||||
private static final int DISTANCE_UNKNOWN = -2;
|
||||
- private static final String DOWNLOAD_PAGE = "https://papermc.io/downloads/folia"; // Folia
|
||||
- private static final String REPOSITORY = "PaperMC/Folia"; // Folia
|
||||
+ private static final String DOWNLOAD_PAGE = "https://github.com/Nanachiyo0721/Shiroha"; // Folia // Shiroha - Rebrand to Shiroha
|
||||
+ private static final String REPOSITORY = "Nanachiyo0721/Shiroha"; // Folia // Shiroha - Rebrand to Shiroha
|
||||
private static final ServerBuildInfo BUILD_INFO = ServerBuildInfo.buildInfo();
|
||||
private static final String USER_AGENT = BUILD_INFO.brandName() + "/" + BUILD_INFO.asString(VERSION_SIMPLE) + " (https://papermc.io)";
|
||||
private static final Gson GSON = new Gson();
|
||||
@@ -72,7 +72,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
COMPONENT_LOGGER.warn(text("*** You are running a development version without access to version information ***"));
|
||||
} else {
|
||||
final Optional<MinecraftVersionFetcher> apiResult = fetchMinecraftVersionList();
|
||||
- if (buildNumber.isPresent()) {
|
||||
+ if (buildNumber.isPresent() && false) { // Shiroha - Rebrand to Shiroha - we do not have a version manager api currently, disable it
|
||||
distance = fetchDistanceFromSiteApi(buildNumber.getAsInt());
|
||||
} else {
|
||||
final Optional<String> gitBranch = BUILD_INFO.gitBranch();
|
||||
@@ -111,7 +111,7 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
int distance = DISTANCE_ERROR;
|
||||
|
||||
final OptionalInt buildNumber = PaperVersionFetcher.BUILD_INFO.buildNumber();
|
||||
- if (buildNumber.isPresent()) {
|
||||
+ if (buildNumber.isPresent() && false) { // Shiroha - Rebrand to Shiroha - we do not have a version manager api currently, disable it
|
||||
distance = fetchDistanceFromSiteApi(buildNumber.getAsInt());
|
||||
} else {
|
||||
final Optional<String> gitBranch = PaperVersionFetcher.BUILD_INFO.gitBranch();
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
index 10a0be7a4db1a51579d113d279af7a9effe7f438..45cf7c5c9a4de2c7422e4d9c27fa0064f81f11cf 100644
|
||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
@@ -31,6 +31,7 @@ public record ServerBuildInfoImpl(
|
||||
private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit";
|
||||
|
||||
private static final String BRAND_PAPER_NAME = "Paper";
|
||||
+ private static final String BRAND_CAMELLIA_NAME = "Shiroha"; // Shiroha - Rebrand to Shiroha
|
||||
|
||||
private static final String BUILD_DEV = "DEV";
|
||||
|
||||
@@ -42,9 +43,9 @@ public record ServerBuildInfoImpl(
|
||||
this(
|
||||
getManifestAttribute(manifest, ATTRIBUTE_BRAND_ID)
|
||||
.map(Key::key)
|
||||
- .orElse(Key.key("papermc", "folia")), // Folia
|
||||
+ .orElse(BRAND_CAMELLIA_ID), // Folia // Shiroha - Rebrand to Shiroha
|
||||
getManifestAttribute(manifest, ATTRIBUTE_BRAND_NAME)
|
||||
- .orElse("Folia"), // Folia
|
||||
+ .orElse(BRAND_CAMELLIA_NAME), // Folia // Shiroha - Rebrand to Shiroha
|
||||
SharedConstants.getCurrentVersion().id(),
|
||||
SharedConstants.getCurrentVersion().name(),
|
||||
getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER)
|
||||
@@ -61,7 +62,7 @@ public record ServerBuildInfoImpl(
|
||||
|
||||
@Override
|
||||
public boolean isBrandCompatible(final @NotNull Key brandId) {
|
||||
- return brandId.equals(this.brandId);
|
||||
+ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID) || brandId.equals(BRAND_FOLIA_ID); // Shiroha - Rebrand to Shiroha
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index 5607f4cc8ca2f620461eb5e97d01d9db0d6b2303..5a86fa68007bc00fcf3ceda2d24923227410c42e 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -80,9 +80,9 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
|
||||
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 Paper bug, please report this to https://github.com/PaperMC/Paper/issues");
|
||||
+ logger.log(Level.SEVERE, "If you are unsure or still think this is a Shiroha bug, please report this to https://github.com/Nanachiyo0721/Shiroha/issues"); // Shiroha - Rebrand to Shiroha
|
||||
logger.log(Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports");
|
||||
- logger.log(Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion());
|
||||
+ logger.log(Level.SEVERE, "Shiroha version: " + Bukkit.getServer().getVersion()); // Shiroha - Rebrand to Shiroha
|
||||
|
||||
if (net.minecraft.world.level.Level.lastPhysicsProblem != null) {
|
||||
logger.log(Level.SEVERE, "------------------------------");
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Wed, 8 Jul 2026 20:59:03 +0800
|
||||
Subject: [PATCH] Correct thread unsafe random sources
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
index 70e21e1fc337c6ea40e64020fa1832d1630cae97..f4af14dfd277fa0261a6e0623f8d11f266e6d7c0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
@@ -40,7 +40,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
public final class CraftItemFactory implements ItemFactory {
|
||||
static final Color DEFAULT_LEATHER_COLOR = Color.fromRGB(0xA06540);
|
||||
private static final CraftItemFactory instance;
|
||||
- private static final RandomSource randomSource = RandomSource.create();
|
||||
+ private static final RandomSource randomSource = io.papermc.paper.threadedregions.util.ThreadLocalRandomSource.INSTANCE; // Shiroha - Correct thread unsafe random sources
|
||||
|
||||
static {
|
||||
instance = new CraftItemFactory();
|
||||
@@ -0,0 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Thu, 9 Jul 2026 09:53:07 +0800
|
||||
Subject: [PATCH] Force disable reload command and api
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 9d0dc8815842a0583b212891680bd0c6461c30b9..9968f5064571b0917c8897c23fe06a148c63a305 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -981,6 +981,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
+ if (true) throw new UnsupportedOperationException(); // Shiroha - Force disable reload command and api
|
||||
// Paper start - lifecycle events
|
||||
if (io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.blocksPluginReloading()) {
|
||||
throw new IllegalStateException(org.bukkit.command.defaults.ReloadCommand.RELOADING_DISABLED_MESSAGE);
|
||||
@@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Wed, 8 Jul 2026 23:45:12 +0800
|
||||
Subject: [PATCH] Force disable builtin spark plugin
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/source/FileProviderSource.java b/src/main/java/io/papermc/paper/plugin/provider/source/FileProviderSource.java
|
||||
index 9661f033bbb2c00073f1c891e1411c2a9943a37a..70fccec55edb67c24c7ecbf3687682de41c73eed 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/provider/source/FileProviderSource.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/source/FileProviderSource.java
|
||||
@@ -76,7 +76,7 @@ public class FileProviderSource implements ProviderSource<Path, Path> {
|
||||
}
|
||||
|
||||
final PluginMeta config = type.getConfig(file);
|
||||
- if ((config.getName().equals("spark") && config.getMainClass().equals("me.lucko.spark.bukkit.BukkitSparkPlugin")) && !SparksFly.isPluginPreferred()) {
|
||||
+ if ((config.getName().equals("spark") && config.getMainClass().equals("me.lucko.spark.bukkit.BukkitSparkPlugin")) && !SparksFly.isPluginPreferred() && false) { // Shiroha - Force disable builtin spark
|
||||
LOGGER.info("The spark plugin will not be loaded as this server bundles the spark profiler.");
|
||||
return;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 9968f5064571b0917c8897c23fe06a148c63a305..3c46e2cc23ac57df52996e3d2c5ae416a9633a67 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -302,7 +302,7 @@ public final class CraftServer implements Server {
|
||||
public static Exception excessiveVelEx;
|
||||
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher();
|
||||
private final io.papermc.paper.potion.PaperPotionBrewer potionBrewer;
|
||||
- public final io.papermc.paper.SparksFly spark;
|
||||
+ public io.papermc.paper.SparksFly spark; // Paper - spark // Shiroha - Force disable builtin spark
|
||||
private final ServerConfiguration serverConfig = new PaperServerConfiguration();
|
||||
|
||||
// Paper start - Folia region threading API
|
||||
@@ -478,7 +478,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
this.potionBrewer = new io.papermc.paper.potion.PaperPotionBrewer(console); // Paper - custom potion mixes
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
- this.spark = new io.papermc.paper.SparksFly(this); // Paper - spark
|
||||
+ if (false) this.spark = new io.papermc.paper.SparksFly(this); // Paper - spark // Shiroha - Force disable builtin spark
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -1050,7 +1050,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
- this.spark.registerCommandBeforePlugins(this); // Paper - spark
|
||||
+ if (false) this.spark.registerCommandBeforePlugins(this); // Paper - spark // Shiroha - Force disable builtin spark
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
@@ -1079,7 +1079,7 @@ public final class CraftServer implements Server {
|
||||
this.loadPlugins();
|
||||
this.enablePlugins(PluginLoadOrder.STARTUP);
|
||||
this.enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||
- this.spark.registerCommandAfterPlugins(this); // Paper - spark
|
||||
+ if (false) this.spark.registerCommandAfterPlugins(this); // Paper - spark // Shiroha - Force disable builtin spark
|
||||
// Paper start - brigadier command API
|
||||
io.papermc.paper.command.brigadier.PaperCommands.INSTANCE.setValid(); // to clear invalid state for event fire below
|
||||
io.papermc.paper.plugin.lifecycle.event.LifecycleEventRunner.INSTANCE.callReloadableRegistrarEvent(io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents.COMMANDS, io.papermc.paper.command.brigadier.PaperCommands.INSTANCE, org.bukkit.plugin.Plugin.class, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.RELOAD); // call commands event for regular plugins
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Wed, 8 Jul 2026 23:46:10 +0800
|
||||
Subject: [PATCH] Add config for server mod name
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
|
||||
index 13b03dab807c5d83e086993af705e1d9a2676b4d..83894904de29c01a4e105c1fae625f912232f8f2 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
|
||||
@@ -14,7 +14,7 @@ class PaperServerListPingEventImpl extends PaperServerListPingEvent {
|
||||
|
||||
PaperServerListPingEventImpl(MinecraftServer server, StatusClient client, int protocolVersion, @Nullable CachedServerIcon icon) {
|
||||
super(client, server.motd(), server.getPlayerCount(), server.getMaxPlayers(),
|
||||
- server.getServerModName() + ' ' + server.getServerVersion(), protocolVersion, icon);
|
||||
+ io.nanachiyo0721.shiroha.config.modules.misc.ServerModNameConfig.fakeVanilla ? server.getServerVersion() : server.getServerModName() + ' ' + server.getServerVersion(), protocolVersion, icon); // Shiroha - Add config for server mod name
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Wed, 8 Jul 2026 23:48:59 +0800
|
||||
Subject: [PATCH] Add config to disable async catchers
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
index 6c74787321748702022787b65ff5465f8bcec4ad..5d7a4f42ed274d78e79f0d4e5dd974ffa8b560dc 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
@@ -48,14 +48,14 @@ public class TickThread extends Thread {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void ensureTickThread(final String reason) {
|
||||
- if (!isTickThread()) {
|
||||
+ if (!isTickThread() && !io.nanachiyo0721.shiroha.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Shiroha - Add config to disable async catchers
|
||||
LOGGER.error("Thread failed main thread check: " + reason + ", context=" + getThreadContext(), new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final Level world, final BlockPos pos, final String reason) {
|
||||
- if (!isTickThreadFor(world, pos)) {
|
||||
+ if (!isTickThreadFor(world, pos) && !io.nanachiyo0721.shiroha.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Shiroha - Add config to disable async catchers
|
||||
final String ex = "Thread failed main thread check: " +
|
||||
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", block_pos=" + pos;
|
||||
LOGGER.error(ex, new Throwable());
|
||||
@@ -64,7 +64,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final Level world, final BlockPos pos, final int blockRadius, final String reason) {
|
||||
- if (!isTickThreadFor(world, pos, blockRadius)) {
|
||||
+ if (!isTickThreadFor(world, pos, blockRadius) && !io.nanachiyo0721.shiroha.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Shiroha - Add config to disable async catchers
|
||||
final String ex = "Thread failed main thread check: " +
|
||||
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", block_pos=" + pos + ", block_radius=" + blockRadius;
|
||||
LOGGER.error(ex, new Throwable());
|
||||
@@ -73,7 +73,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final Level world, final ChunkPos pos, final String reason) {
|
||||
- if (!isTickThreadFor(world, pos)) {
|
||||
+ if (!isTickThreadFor(world, pos) && !io.nanachiyo0721.shiroha.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Shiroha - Add config to disable async catchers
|
||||
final String ex = "Thread failed main thread check: " +
|
||||
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", chunk_pos=" + pos;
|
||||
LOGGER.error(ex, new Throwable());
|
||||
@@ -82,7 +82,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final Level world, final int chunkX, final int chunkZ, final String reason) {
|
||||
- if (!isTickThreadFor(world, chunkX, chunkZ)) {
|
||||
+ if (!isTickThreadFor(world, chunkX, chunkZ) && !io.nanachiyo0721.shiroha.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Shiroha - Add config to disable async catchers
|
||||
final String ex = "Thread failed main thread check: " +
|
||||
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", chunk_pos=" + new ChunkPos(chunkX, chunkZ);
|
||||
LOGGER.error(ex, new Throwable());
|
||||
@@ -91,7 +91,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final Entity entity, final String reason) {
|
||||
- if (!isTickThreadFor(entity)) {
|
||||
+ if (!isTickThreadFor(entity) && !io.nanachiyo0721.shiroha.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Shiroha - Add config to disable async catchers
|
||||
final String ex = "Thread failed main thread check: " +
|
||||
reason + ", context=" + getThreadContext() + ", entity=" + EntityUtil.dumpEntity(entity);
|
||||
LOGGER.error(ex, new Throwable());
|
||||
@@ -100,7 +100,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final Level world, final AABB aabb, final String reason) {
|
||||
- if (!isTickThreadFor(world, aabb)) {
|
||||
+ if (!isTickThreadFor(world, aabb) && !io.nanachiyo0721.shiroha.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Shiroha - Add config to disable async catchers
|
||||
final String ex = "Thread failed main thread check: " +
|
||||
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", aabb=" + aabb;
|
||||
LOGGER.error(ex, new Throwable());
|
||||
@@ -109,7 +109,7 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static void ensureTickThread(final Level world, final double blockX, final double blockZ, final String reason) {
|
||||
- if (!isTickThreadFor(world, blockX, blockZ)) {
|
||||
+ if (!isTickThreadFor(world, blockX, blockZ) && !io.nanachiyo0721.shiroha.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Shiroha - Add config to disable async catchers
|
||||
final String ex = "Thread failed main thread check: " +
|
||||
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", block_pos=" + new Vec3(blockX, 0.0, blockZ);
|
||||
LOGGER.error(ex, new Throwable());
|
||||
diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
index 7e7a0ed944961af5ab7a49bc659da2862d2e2c82..1dc664a97442744d0a9364805cc6d6c5b8b647a2 100644
|
||||
--- a/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
+++ b/src/main/java/org/spigotmc/AsyncCatcher.java
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
public class AsyncCatcher {
|
||||
|
||||
public static void catchOp(String reason) {
|
||||
- if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThread()) { // Paper - chunk system
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThread() && !io.nanachiyo0721.shiroha.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Paper - chunk system // Shiroha - Add config to disable async catchers
|
||||
MinecraftServer.LOGGER.error("Thread {} failed main thread check: {}", Thread.currentThread().getName(), reason, new Throwable()); // Paper
|
||||
throw new IllegalStateException("Asynchronous " + reason + "!");
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 18 Apr 2026 09:47:28 +0800
|
||||
Subject: [PATCH] Add config to avoid of folia-supported check
|
||||
|
||||
This is in dangerous zone, we won't support it if you find any plugin bug if you enable it
|
||||
|
||||
Co-authored-by: Helvetica Volubi <88063803+suisuroru@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
|
||||
index 6369b13e1fcdbdb25dd9d6e4d3bffdedbee4f739..ea27ce9d08b3b8bbb0cd4918dbf51fd8077c3bb4 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/paper/PaperPluginProviderFactory.java
|
||||
@@ -25,7 +25,7 @@ class PaperPluginProviderFactory implements PluginTypeFactory<PaperPluginParent,
|
||||
@Override
|
||||
public PaperPluginParent build(JarFile file, PaperPluginMeta configuration, Path source) {
|
||||
// Folia start - block plugins not marked as supported
|
||||
- if (!configuration.isFoliaSupported()) {
|
||||
+ if (!configuration.isFoliaSupported() && !io.nanachiyo0721.shiroha.config.modules.unsupported.DisableCheckForFoliaSupported.disableForPaper) { // Shiroha - disable check for folia supported
|
||||
throw new RuntimeException("Could not load plugin '" + configuration.getDisplayName() + "' as it is not marked as supporting Folia!");
|
||||
}
|
||||
// Folia end - block plugins not marked as supported
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
|
||||
index 6ef0042a355c65262bdb89dcf151bd644653216d..7da13c7a2c5303d8f3bee2db4b5b76a1e8ad1c74 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/provider/type/spigot/SpigotPluginProviderFactory.java
|
||||
@@ -27,7 +27,7 @@ class SpigotPluginProviderFactory implements PluginTypeFactory<SpigotPluginProvi
|
||||
@Override
|
||||
public SpigotPluginProvider build(JarFile file, PluginDescriptionFile configuration, Path source) throws InvalidDescriptionException {
|
||||
// Folia start - block plugins not marked as supported
|
||||
- if (!configuration.isFoliaSupported()) {
|
||||
+ if (!configuration.isFoliaSupported() && !io.nanachiyo0721.shiroha.config.modules.unsupported.DisableCheckForFoliaSupported.disableForPaper) { // Shiroha - disable check for folia supported
|
||||
throw new RuntimeException("Could not load plugin '" + configuration.getDisplayName() + "' as it is not marked as supporting Folia!");
|
||||
}
|
||||
// Folia end - block plugins not marked as supported
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 55a095e00bfe15321d8a1d69beb232e9956b0df7..844d6211ae34b3136806b8513e30d48c219884d9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -323,7 +323,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
}
|
||||
|
||||
// Folia start - block plugins not marked as supported
|
||||
- if (!descriptionFile.isFoliaSupported()) {
|
||||
+ if (!descriptionFile.isFoliaSupported() && !io.nanachiyo0721.shiroha.config.modules.unsupported.DisableCheckForFoliaSupported.disableForPaper) { // Shiroha - disable check for folia supported
|
||||
throw new InvalidPluginException("Plugin " + descriptionFile.getFullName() + " is not marked as supporting regionised multithreading");
|
||||
}
|
||||
// Folia end - block plugins not marked as supported
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Wed, 8 Jul 2026 23:56:00 +0800
|
||||
Subject: [PATCH] Add config for cpu affinity
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java b/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java
|
||||
index b9f788693b0c4be48e8a923a3dec50555d135e7e..1ce8304688ff3751d2de3ada14539842d2cca4e1 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/MoonriseCommon.java
|
||||
@@ -22,7 +22,7 @@ public final class MoonriseCommon {
|
||||
|
||||
@Override
|
||||
public Thread newThread(final Runnable run) {
|
||||
- final Thread thread = new Thread(run, PlatformHooks.get().getBrand() + " Common Worker #" + this.idGenerator.getAndIncrement());
|
||||
+ final Thread thread = new Thread(io.nanachiyo0721.shiroha.config.modules.optimizations.CpuAffinityConfig.wrapForChunkSystemWorker(run), PlatformHooks.get().getBrand() + " Common Worker #" + this.idGenerator.getAndIncrement()); // Shiroha - Add config for cpu affinity
|
||||
|
||||
thread.setDaemon(true);
|
||||
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@@ -70,7 +70,7 @@ public final class MoonriseCommon {
|
||||
|
||||
@Override
|
||||
public Thread newThread(final Runnable run) {
|
||||
- final Thread thread = new Thread(run, PlatformHooks.get().getBrand() + " I/O Worker #" + this.idGenerator.getAndIncrement());
|
||||
+ final Thread thread = new Thread(io.nanachiyo0721.shiroha.config.modules.optimizations.CpuAffinityConfig.wrapForChunkSystemIo(run), PlatformHooks.get().getBrand() + " I/O Worker #" + this.idGenerator.getAndIncrement()); // Shiroha - Add config for cpu affinity
|
||||
|
||||
thread.setDaemon(true);
|
||||
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Thu, 9 Jul 2026 12:12:08 +0800
|
||||
Subject: [PATCH] Add status bar
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
index f020f310c4bca49a23de91bea72ccd9941c0b03c..10b351d8bd6b0e117ecbe961ae2f101686a38fe4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
@@ -406,4 +406,12 @@ public class CraftChunk implements Chunk {
|
||||
static {
|
||||
Arrays.fill(FULL_LIGHT, (byte) 0xFF);
|
||||
}
|
||||
+
|
||||
+ // KioCG start - ChunkHot
|
||||
+ @Override
|
||||
+ public long getChunkHotAvg() {
|
||||
+ final net.minecraft.world.level.chunk.LevelChunk target = this.level.getChunkIfLoaded(this.x,this.z);
|
||||
+ return target == null ? -1 : target.getChunkHot().getAverage();
|
||||
+ }
|
||||
+ // KioCG end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 3d7def71d03d3ec3b3c3565ec07b46a3c1263aab..e655c6b817b1ef2b3186c4b16a1039081139e97f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -3396,4 +3396,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa
|
||||
super.knockback(strength, directionX, directionZ);
|
||||
this.entity.hurtMarked = true;
|
||||
}
|
||||
+
|
||||
+ // KioCG start - ChunkHot
|
||||
+ @Override
|
||||
+ public long getNearbyChunkHot() {
|
||||
+ return this.getHandle().getNearbyChunkHot();
|
||||
+ }
|
||||
+ // KioCG end
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Wed, 8 Jul 2026 23:56:26 +0800
|
||||
Subject: [PATCH] Add back BlockPos transform to Position support
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
index 532076c7358aa355ce5144075fe6bd79de6ef9e6..fa940f0dfc19aa2853b7a0d19743321d3c4ce292 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
@@ -183,6 +183,12 @@ public final class MCUtil {
|
||||
return CraftLocation.toBukkit(pos, world);
|
||||
}
|
||||
|
||||
+ // Shiroha start - add BlockPos support
|
||||
+ public static Location toLocation(Level world, BlockPos pos) {
|
||||
+ return CraftLocation.toBukkit(pos, world);
|
||||
+ }
|
||||
+ // Shiroha end - add BlockPos support
|
||||
+
|
||||
/**
|
||||
* Converts a NMS World/Vector to Bukkit Location
|
||||
*
|
||||
@@ -0,0 +1,25 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 18 Apr 2026 10:48:33 +0800
|
||||
Subject: [PATCH] Purpur: Lobotomize stuck villagers
|
||||
|
||||
Co-authored by: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
As part of: Purpur (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/purpur-server/minecraft-patches/features/0001-Ridables.patch)
|
||||
Licensed under: MIT (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/LICENSE)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
|
||||
index 92eab10ec20f44e81d9e38bd9d4b6cf64dd6ef37..df26b41bf1516fac3124b0fc4a0ab71277ce2004 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
|
||||
@@ -244,4 +244,11 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
|
||||
public void restock() {
|
||||
this.getHandle().restock();
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public boolean isLobotomized() {
|
||||
+ return getHandle().isLobotomized();
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 18 Apr 2026 09:04:34 +0800
|
||||
Subject: [PATCH] Leaf Skip event if no listeners
|
||||
|
||||
As part of: Leaf
|
||||
Licensed under: GPL-3.0 (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/licenses/GPL-3.0.txt)
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..9180f23529a31b6b0a5b38bb7cda3e32d487f691 100644
|
||||
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||
@@ -36,15 +36,17 @@ class PaperEventManager {
|
||||
|
||||
// SimplePluginManager
|
||||
public void callEvent(@NotNull Event event) {
|
||||
+ // Leaf start - Skip event if no listeners
|
||||
+ RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
|
||||
+ if (listeners.length == 0) return;
|
||||
+ // Leaf end - Skip event if no listeners
|
||||
+
|
||||
if (event.isAsynchronous() && this.server.isPrimaryThread()) {
|
||||
throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
|
||||
} else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) {
|
||||
throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
|
||||
}
|
||||
|
||||
- HandlerList handlers = event.getHandlers();
|
||||
- RegisteredListener[] listeners = handlers.getRegisteredListeners();
|
||||
-
|
||||
for (RegisteredListener registration : listeners) {
|
||||
if (!registration.getPlugin().isEnabled()) {
|
||||
continue;
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 18 Apr 2026 10:31:41 +0800
|
||||
Subject: [PATCH] Leaf Secure seed and matter seed command
|
||||
|
||||
As part of: Leaf
|
||||
Licensed under: GPL-3.0 (https://github.com/Winds-Studio/Leaf/blob/7f3e240bbe0970683c40279a7a65f0fde47503b6/licenses/GPL-3.0.txt)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
index 10b351d8bd6b0e117ecbe961ae2f101686a38fe4..7a93251c575870235a0aabf2fad846353025f5f2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
|
||||
@@ -191,7 +191,12 @@ public class CraftChunk implements Chunk {
|
||||
@Override
|
||||
public boolean isSlimeChunk() {
|
||||
// 987234911L is taken from Slime when seeing if a slime can spawn in a chunk
|
||||
- return this.level.paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), level.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper
|
||||
+ // Leaf start - Matter - Secure Seed
|
||||
+ boolean isSlimeChunk = io.nanachiyo0721.shiroha.config.modules.function.SecureSeedConfig.enabled
|
||||
+ ? level.getChunk(this.getX(), this.getZ()).isSlimeChunk()
|
||||
+ : WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), level.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper
|
||||
+ return this.level.paperConfig().entities.spawning.allChunksAreSlimeChunks || isSlimeChunk;
|
||||
+ // Leaf end - Matter - Secure Seed
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3c46e2cc23ac57df52996e3d2c5ae416a9633a67..e0b1a7c8bc4e69afe5f78638e8fddbe8fe81da40 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1261,7 +1261,11 @@ public final class CraftServer implements Server {
|
||||
.orElse(null);
|
||||
RegistryAccess contextRegistryAccess = registryAccess;
|
||||
if (worldGenSettings == null) {
|
||||
- WorldOptions worldOptions = new WorldOptions(creator.seed(), creator.generateStructures(), creator.bonusChest());
|
||||
+ // Leaf start - Matter - Secure Seed
|
||||
+ WorldOptions worldOptions = io.nanachiyo0721.shiroha.config.modules.function.SecureSeedConfig.enabled
|
||||
+ ? new WorldOptions(creator.seed(), su.plo.matter.Globals.createRandomWorldSeed(), creator.generateStructures(), false)
|
||||
+ : new WorldOptions(creator.seed(), creator.generateStructures(), creator.bonusChest());
|
||||
+ // Leaf end - Matter - Secure Seed
|
||||
|
||||
String flatGenSettings = creator.generatorSettings();
|
||||
if (flatGenSettings.isEmpty()) {
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 27 Jun 2026 17:39:33 +0800
|
||||
Subject: [PATCH] Leaf Configurable vanilla username check
|
||||
|
||||
A part of Leaf(https://github.com/Winds-Studio/Leaf/blob/edb0504069139beaa6f39efa4702370c2576b3fc/leaf-server/paper-patches/features/0061-Configurable-vanilla-username-check.patch)
|
||||
|
||||
License: https://github.com/Winds-Studio/Leaf/blob/edb0504069139beaa6f39efa4702370c2576b3fc/LICENSE.md
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
index ceaf63c76272b2a11b92f877b9828e93ec79d47f..be8319e3548eeac6cc7a333e95ec9a0b092b8a3e 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
|
||||
@@ -67,6 +67,14 @@ public class CraftPlayerProfile implements PlayerProfile, SharedPlayerProfile {
|
||||
copyProfileProperties(resolvableProfile.partialProfile(), this.profile);
|
||||
}
|
||||
|
||||
+ // Leaf start - Configurable vanilla username check
|
||||
+ public CraftPlayerProfile(UUID id, String name, boolean useCustomValidation) {
|
||||
+ this.profile = createAuthLibProfile(id, name, useCustomValidation);
|
||||
+ this.emptyName = name == null;
|
||||
+ this.emptyUUID = id == null;
|
||||
+ }
|
||||
+ // Leaf end - Configurable vanilla username check
|
||||
+
|
||||
@Override
|
||||
public boolean hasProperty(String property) {
|
||||
return profile.properties().containsKey(property);
|
||||
@@ -205,6 +213,14 @@ public class CraftPlayerProfile implements PlayerProfile, SharedPlayerProfile {
|
||||
return clone;
|
||||
}
|
||||
|
||||
+ // Leaf start - Configurable vanilla username check
|
||||
+ public CraftPlayerProfile cloneCustom() {
|
||||
+ CraftPlayerProfile clone = new CraftPlayerProfile(this.getId(), this.getName(), io.nanachiyo0721.shiroha.config.modules.misc.UsernameCheckConfig.useCustomUsernameRegex());
|
||||
+ clone.setProperties(getProperties());
|
||||
+ return clone;
|
||||
+ }
|
||||
+ // Leaf end - Configurable vanilla username check
|
||||
+
|
||||
@Override
|
||||
public boolean isComplete() {
|
||||
return this.getId() != null && StringUtils.isNotBlank(this.getName());
|
||||
@@ -324,9 +340,10 @@ public class CraftPlayerProfile implements PlayerProfile, SharedPlayerProfile {
|
||||
}
|
||||
}
|
||||
|
||||
- private static GameProfile createAuthLibProfile(UUID uniqueId, String name) {
|
||||
+ // Leaf start - Configurable vanilla username check
|
||||
+ private static GameProfile createAuthLibProfile(UUID uniqueId, String name, boolean useCustomValidation) {
|
||||
Preconditions.checkArgument(name == null || name.length() <= 16, "Name cannot be longer than 16 characters");
|
||||
- Preconditions.checkArgument(name == null || StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name);
|
||||
+ Preconditions.checkArgument(name == null || (useCustomValidation ? StringUtil.isReasonablePlayerName(name) : StringUtil.isValidPlayerName(name)), "The name of the profile contains invalid characters: %s", name);
|
||||
return new GameProfile(
|
||||
uniqueId != null ? uniqueId : Util.NIL_UUID,
|
||||
name != null ? name : "",
|
||||
@@ -334,6 +351,11 @@ public class CraftPlayerProfile implements PlayerProfile, SharedPlayerProfile {
|
||||
);
|
||||
}
|
||||
|
||||
+ private static GameProfile createAuthLibProfile(UUID uniqueId, String name) {
|
||||
+ return createAuthLibProfile(uniqueId, name, false);
|
||||
+ }
|
||||
+ // Leaf end - Configurable vanilla username check
|
||||
+
|
||||
private static ProfileProperty toBukkit(Property property) {
|
||||
return new ProfileProperty(property.name(), property.value(), property.signature());
|
||||
}
|
||||
@@ -346,6 +368,13 @@ public class CraftPlayerProfile implements PlayerProfile, SharedPlayerProfile {
|
||||
return new Property(property.getName(), property.getValue(), property.getSignature());
|
||||
}
|
||||
|
||||
+ // Leaf start - Configurable vanilla username check
|
||||
+ public static GameProfile asAuthlibCopyCustomValidation(PlayerProfile profile) {
|
||||
+ CraftPlayerProfile craft = ((CraftPlayerProfile) profile);
|
||||
+ return asAuthlibCopy(craft.cloneCustom());
|
||||
+ }
|
||||
+ // Leaf end - Configurable vanilla username check
|
||||
+
|
||||
public static GameProfile asAuthlibCopy(PlayerProfile profile) {
|
||||
CraftPlayerProfile craft = ((CraftPlayerProfile) profile);
|
||||
return craft.getGameProfile();
|
||||
Reference in New Issue
Block a user