Push forward

This commit is contained in:
2026-07-14 12:22:17 +08:00
parent 576a9a44c8
commit 969cd5c5f8
135 changed files with 551 additions and 551 deletions
@@ -37,20 +37,20 @@ index f32d118e1e925b2155cef3fcdcb1e194c541e242..fe17157c4c6fc9ec745c5c11f6837e71
}
+ // Shiroha start - Add portal rate limiter
+ public final moe.monnairealms.camellia.utils.RateThrottler portalRateThrottler = new moe.monnairealms.camellia.utils.RateThrottler();
+ public final net.objecthunter.exp4j.Expression portalRateCapExpression = moe.monnairealms.camellia.config.modules.function.PortalRateLimiterConfig.getExpressionIfConfigured();
+ public final io.nanachiyo0721.shiroha.utils.RateThrottler portalRateThrottler = new io.nanachiyo0721.shiroha.utils.RateThrottler();
+ public final net.objecthunter.exp4j.Expression portalRateCapExpression = io.nanachiyo0721.shiroha.config.modules.function.PortalRateLimiterConfig.getExpressionIfConfigured();
+
+ private int computePortalRateCap() {
+ // expression mode is disabled
+ if (this.portalRateCapExpression == null) {
+ return moe.monnairealms.camellia.config.modules.function.PortalRateLimiterConfig.maxPortalTeleportsPerTick;
+ return io.nanachiyo0721.shiroha.config.modules.function.PortalRateLimiterConfig.maxPortalTeleportsPerTick;
+ }
+
+ final int tickingEntityCount = this.entityTickList.size();
+ final int tickingChunkCount = this.tickingChunks.size();
+ final int playerCount = this.localPlayers.size();
+
+ return moe.monnairealms.camellia.config.modules.function.PortalRateLimiterConfig.computeExpression(
+ return io.nanachiyo0721.shiroha.config.modules.function.PortalRateLimiterConfig.computeExpression(
+ this.portalRateCapExpression,
+ tickingEntityCount,
+ tickingChunkCount,
@@ -58,7 +58,7 @@ index f32d118e1e925b2155cef3fcdcb1e194c541e242..fe17157c4c6fc9ec745c5c11f6837e71
+ );
+ }
+ public boolean isPortalTeleportationOutOfRate() {
+ if (!moe.monnairealms.camellia.config.modules.function.PortalRateLimiterConfig.enabled) {
+ if (!io.nanachiyo0721.shiroha.config.modules.function.PortalRateLimiterConfig.enabled) {
+ return false;
+ }
+