105 lines
6.6 KiB
Diff
105 lines
6.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
|
Date: Thu, 9 Jul 2026 10:11:39 +0800
|
|
Subject: [PATCH] Add config to enable tick command
|
|
|
|
only freeze/unfreeze/step/query can run when enabled
|
|
|
|
diff --git a/io/papermc/paper/threadedregions/RegionizedServer.java b/io/papermc/paper/threadedregions/RegionizedServer.java
|
|
index aa575f3b76ef70ffb9f0410e7e5cfe7af384bfbd..a00b086962b68d6f86cfb55eee6f61afdb162d5f 100644
|
|
--- a/io/papermc/paper/threadedregions/RegionizedServer.java
|
|
+++ b/io/papermc/paper/threadedregions/RegionizedServer.java
|
|
@@ -233,6 +233,11 @@ public final class RegionizedServer {
|
|
|
|
private void globalTick(final long tickCount) {
|
|
++this.tickCount;
|
|
+ // Shiroha start - Add a config to enable tick command
|
|
+ if (moe.monnairealms.camellia.config.modules.experiment.CommandConfig.tick) {
|
|
+ MinecraftServer.getServer().tickRateManager().tick();
|
|
+ }
|
|
+ // Shiroha end - Add a config to enable tick command
|
|
// expire invalid click command callbacks
|
|
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.ADVENTURE_CLICK_MANAGER.handleQueue((int)this.tickCount); // Paper // Folia - region threading - moved to global tick
|
|
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.DIALOG_CLICK_MANAGER.handleQueue((int)this.tickCount); // Paper // Folia - region threading - moved to global tick
|
|
@@ -409,7 +414,7 @@ public final class RegionizedServer {
|
|
}
|
|
|
|
private void tickTime(final ServerLevel world, final long tickCount) {
|
|
- if (world.tickTime) {
|
|
+ if ((!moe.monnairealms.camellia.config.modules.experiment.CommandConfig.tick || world.tickRateManager().runsNormally()) && world.tickTime) { // Shiroha - Add a config to enable tick command
|
|
world.serverLevelData.setGameTime(world.serverLevelData.getGameTime() + tickCount);
|
|
}
|
|
}
|
|
diff --git a/io/papermc/paper/threadedregions/TickRegionScheduler.java b/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
|
index 913161732b0affa70fb114dd4087a6102b611cba..ccd86db7b384d99d290869a155792b49385dc9a6 100644
|
|
--- a/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
|
+++ b/io/papermc/paper/threadedregions/TickRegionScheduler.java
|
|
@@ -479,6 +479,11 @@ public final class TickRegionScheduler {
|
|
try {
|
|
// next start isn't updated until the end of this tick
|
|
this.tickRegion(tickCount, tickStart, scheduledEnd);
|
|
+ // Shiroha start - Add a config to enable tick command
|
|
+ if (moe.monnairealms.camellia.config.modules.experiment.CommandConfig.tick) {
|
|
+ MinecraftServer.getServer().tickRateManager().endTickWork();
|
|
+ }
|
|
+ // Shiroha end - Add a config to enable tick command
|
|
} catch (final Throwable thr) {
|
|
this.scheduler.regionFailed(this, false, thr);
|
|
// regionFailed will schedule a shutdown, so we should avoid letting this region tick further
|
|
diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
|
|
index 6b91eab354d8e7c93bf148bfc1f5a611f8ffcf86..d971cc9669aca1005c026133e7e7e7f9b170ed0d 100644
|
|
--- a/net/minecraft/commands/Commands.java
|
|
+++ b/net/minecraft/commands/Commands.java
|
|
@@ -259,7 +259,11 @@ public class Commands {
|
|
TeleportCommand.register(this.dispatcher);
|
|
TellRawCommand.register(this.dispatcher, context);
|
|
//TestCommand.register(this.dispatcher, context); // Folia - region threading
|
|
- //TickCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
|
+ // Shiroha start - Add a config to enable tick command
|
|
+ if (moe.monnairealms.camellia.config.modules.experiment.CommandConfig.tick) {
|
|
+ TickCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
|
+ }
|
|
+ // Shiroha end - Add a config to enable tick command
|
|
TimeCommand.register(this.dispatcher, context);
|
|
TitleCommand.register(this.dispatcher, context);
|
|
//TriggerCommand.register(this.dispatcher); // Folia - region threading - TODO later
|
|
diff --git a/net/minecraft/server/commands/TickCommand.java b/net/minecraft/server/commands/TickCommand.java
|
|
index e8d6a67143f3f0b4813e51bb273498bc404899b9..12ff74e46d39d3bf6f025cc59a27ba8925724d80 100644
|
|
--- a/net/minecraft/server/commands/TickCommand.java
|
|
+++ b/net/minecraft/server/commands/TickCommand.java
|
|
@@ -23,14 +23,14 @@ public class TickCommand {
|
|
Commands.literal("tick")
|
|
.requires(Commands.hasPermission(Commands.LEVEL_ADMINS))
|
|
.then(Commands.literal("query").executes(c -> tickQuery(c.getSource())))
|
|
- .then(
|
|
+/* .then( // Shiroha - Add config to enable tick command - limit unsupported functions
|
|
Commands.literal("rate")
|
|
.then(
|
|
Commands.argument("rate", FloatArgumentType.floatArg(1.0F, 10000.0F))
|
|
.suggests((c, b) -> SharedSuggestionProvider.suggest(new String[]{DEFAULT_TICKRATE}, b))
|
|
.executes(c -> setTickingRate(c.getSource(), FloatArgumentType.getFloat(c, "rate")))
|
|
)
|
|
- )
|
|
+ )*/ // Shiroha - Add config to enable tick command - limit unsupported functions
|
|
.then(
|
|
Commands.literal("step")
|
|
.executes(c -> step(c.getSource(), 1))
|
|
@@ -41,7 +41,7 @@ public class TickCommand {
|
|
.executes(c -> step(c.getSource(), IntegerArgumentType.getInteger(c, "time")))
|
|
)
|
|
)
|
|
- .then(
|
|
+/* .then( // Shiroha - Add config to enable tick command - limit unsupported functions
|
|
Commands.literal("sprint")
|
|
.then(Commands.literal("stop").executes(c -> stopSprinting(c.getSource())))
|
|
.then(
|
|
@@ -49,7 +49,7 @@ public class TickCommand {
|
|
.suggests((c, b) -> SharedSuggestionProvider.suggest(new String[]{"60s", "1d", "3d"}, b))
|
|
.executes(c -> sprint(c.getSource(), IntegerArgumentType.getInteger(c, "time")))
|
|
)
|
|
- )
|
|
+ )*/ // Shiroha - Add config to enable tick command - limit unsupported functions
|
|
.then(Commands.literal("unfreeze").executes(c -> setFreeze(c.getSource(), false)))
|
|
.then(Commands.literal("freeze").executes(c -> setFreeze(c.getSource(), true)))
|
|
);
|