Compare commits
14 Commits
1.21.5-bcd
...
1.21.5-7bc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bc857b294 | ||
|
|
e963af5628 | ||
|
|
b74abd342b | ||
|
|
63507137a0 | ||
|
|
7b7fe5c62a | ||
|
|
0a00e23143 | ||
|
|
c935e6bdc8 | ||
|
|
31d22035f3 | ||
|
|
064d0b5595 | ||
|
|
aa863608b1 | ||
|
|
f16bbf1c97 | ||
|
|
c8daaf7d24 | ||
|
|
b620644bcb | ||
|
|
c9772c3e88 |
8
.github/workflows/build_1.21.5.yml
vendored
8
.github/workflows/build_1.21.5.yml
vendored
@@ -1,10 +1,10 @@
|
||||
name: Luminol CI - dev/1.21.5
|
||||
name: Luminol CI - ver/1.21.5
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "dev/1.21.5" ]
|
||||
branches: [ "ver/1.21.5" ]
|
||||
pull_request:
|
||||
branches: [ "dev/1.21.5" ]
|
||||
branches: [ "ver/1.21.5" ]
|
||||
|
||||
permissions: write-all
|
||||
|
||||
@@ -67,6 +67,6 @@ jobs:
|
||||
artifacts: |
|
||||
${{ env.jar_dir }}
|
||||
generateReleaseNotes: true
|
||||
prerelease: true
|
||||
prerelease: false
|
||||
makeLatest: ${{ env.make_latest }}
|
||||
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
- `git`
|
||||
- `JDK 21 或更高版本`
|
||||
|
||||
特别提醒:在操作前,您需要启用系统和Git的长路径支持,以下为部分平台的相关描述。
|
||||
|
||||
[`Windows`](https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation)
|
||||
[`Git for Windows`](https://gitforwindows.org/faq.html#i-get-errors-trying-to-check-out-files-with-long-path-names)
|
||||
|
||||
## 了解补丁(Patches)
|
||||
|
||||
Luminol 使用和 Folia 一样的补丁系统,并为了针对不同部分的修改分成了两个目录:
|
||||
|
||||
@@ -25,6 +25,11 @@ Before coding, you need these pieces of software / tools as Dev Environment.
|
||||
- `git`
|
||||
- `JDK 21 or higher`
|
||||
|
||||
PS: You need to enable long path support in your System and Git before start, some of the platform's resolution here.
|
||||
|
||||
[`Windows`](https://learn.microsoft.com/windows/win32/fileio/maximum-file-path-limitation)
|
||||
[`Git for Windows`](https://gitforwindows.org/faq.html#i-get-errors-trying-to-check-out-files-with-long-path-names)
|
||||
|
||||
## Understanding "Patches"
|
||||
|
||||
Luminol uses as the same patching system as Paper,
|
||||
|
||||
@@ -2,7 +2,7 @@ group = me.earthme.luminol
|
||||
version=1.21.5-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.5
|
||||
|
||||
foliaRef=70f4f3ad9b40fce3d12ad5dc9672d95a96f041d3
|
||||
foliaRef=da0d7cd1beb8eb7b84a5210dcefa6ffb4cce7415
|
||||
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.caching=true
|
||||
|
||||
@@ -16,10 +16,10 @@ index 9f8414f854646ad7429fe806e35a13e32a07ddaa..9a0995bf82830b45b2d72b2a1cff2bfd
|
||||
+ long getChunkHotAvg(); // KioCG
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index c3dfe3471d33c5e24985a883bdead48597dd9da0..ec428b10ced4279d8b4d22838840dd1f80fca28a 100644
|
||||
index d34419693fc78b3f7e8f6bbf115f17f29e5e3377..aefcae5d9b7beff4bb7185cf44b443fc340af179 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3910,4 +3910,6 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -3925,4 +3925,6 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param score New death screen score of player
|
||||
*/
|
||||
void setDeathScreenScore(int score);
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
dependencies {
|
||||
- implementation(project(":folia-api"))
|
||||
+ implementation(project(":luminol-api")) // Luminol
|
||||
+ implementation("com.electronwill.night-config:toml:3.6.6") // Luminol - Night config
|
||||
+ implementation("com.electronwill.night-config:toml:3.8.2") // Luminol - Night config
|
||||
+ // Abomination start
|
||||
+ implementation("com.github.luben:zstd-jni:1.5.4-1")
|
||||
+ implementation("org.lz4:lz4-java:1.8.0")
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add config to modify tripwire behavior
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 8a3a8b0fdf9545a41501dc992c6982d9c8ce7b66..8139387c1b0814c86d770f5ef6dda952140467ea 100644
|
||||
index 8a3a8b0fdf9545a41501dc992c6982d9c8ce7b66..8f9f5b0bf098a32a732e3ff9f636e3ea828e5f43 100644
|
||||
--- a/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -200,10 +200,17 @@ public class TripWireHookBlock extends Block {
|
||||
@@ -16,7 +16,7 @@ index 8a3a8b0fdf9545a41501dc992c6982d9c8ce7b66..8139387c1b0814c86d770f5ef6dda952
|
||||
- if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) {
|
||||
- if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3); // Paper - prevent tripwire from updating
|
||||
+ // Luminol start - tripwire and tripwireHook dupe
|
||||
+ if (me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
|
||||
+ if (me.earthme.luminol.config.modules.misc.TripwireBehaviorConfig.enabled) {
|
||||
+ level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3);
|
||||
+ level.getBlockState(blockPos1);
|
||||
+ } else {
|
||||
@@ -30,7 +30,7 @@ index 8a3a8b0fdf9545a41501dc992c6982d9c8ce7b66..8139387c1b0814c86d770f5ef6dda952
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
index 49b810ae9d9a8d0718a5f8c512e15a5573ed04fd..ae48255ee384a7b4a44c8754601200d361665934 100644
|
||||
index 49b810ae9d9a8d0718a5f8c512e15a5573ed04fd..37ebb23c9c053de0530254d98f2120058833f232 100644
|
||||
--- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
+++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java
|
||||
@@ -28,6 +28,11 @@ public class EndPlatformFeature extends Feature<NoneFeatureConfiguration> {
|
||||
@@ -40,8 +40,8 @@ index 49b810ae9d9a8d0718a5f8c512e15a5573ed04fd..ae48255ee384a7b4a44c8754601200d3
|
||||
+ // Luminol start - tripwire behavior modifier
|
||||
+ java.util.List<BlockPos> blockList1 = new java.util.ArrayList<>();
|
||||
+ java.util.List<BlockPos> blockList2 = new java.util.ArrayList<>();
|
||||
+ boolean flag21 = !java.util.Objects.equals(me.earthme.luminol.config.modules.misc.AllowTripwireDupe.behaviorMode, "VANILLA20")
|
||||
+ && !java.util.Objects.equals(me.earthme.luminol.config.modules.misc.AllowTripwireDupe.behaviorMode, "MIXED");
|
||||
+ boolean flag21 = !java.util.Objects.equals(me.earthme.luminol.config.modules.misc.TripwireBehaviorConfig.behaviorMode, "VANILLA20")
|
||||
+ && !java.util.Objects.equals(me.earthme.luminol.config.modules.misc.TripwireBehaviorConfig.behaviorMode, "MIXED");
|
||||
for (int i = -2; i <= 2; i++) {
|
||||
for (int i1 = -2; i1 <= 2; i1++) {
|
||||
for (int i2 = -1; i2 < 3; i2++) {
|
||||
@@ -51,8 +51,8 @@ index 49b810ae9d9a8d0718a5f8c512e15a5573ed04fd..ae48255ee384a7b4a44c8754601200d3
|
||||
if (dropBlocks) {
|
||||
- blockList.destroyBlock(blockPos, true, null); // CraftBukkit
|
||||
+ boolean flag = false;
|
||||
+ if (me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
|
||||
+ switch (me.earthme.luminol.config.modules.misc.AllowTripwireDupe.behaviorMode) {
|
||||
+ if (me.earthme.luminol.config.modules.misc.TripwireBehaviorConfig.enabled) {
|
||||
+ switch (me.earthme.luminol.config.modules.misc.TripwireBehaviorConfig.behaviorMode) {
|
||||
+ case "VANILLA20": {
|
||||
+ flag = true;
|
||||
+ }
|
||||
@@ -82,7 +82,7 @@ index 49b810ae9d9a8d0718a5f8c512e15a5573ed04fd..ae48255ee384a7b4a44c8754601200d3
|
||||
|
||||
- if (dropBlocks) {
|
||||
- blockList.placeBlocks(state -> level.destroyBlock(state.getPosition(), true, null));
|
||||
+ if (flag21 || !me.earthme.luminol.config.modules.misc.AllowTripwireDupe.enabled) {
|
||||
+ if (flag21 || !me.earthme.luminol.config.modules.misc.TripwireBehaviorConfig.enabled) {
|
||||
+ if (dropBlocks) {
|
||||
+ blockList.placeBlocks(state -> level.destroyBlock(state.getPosition(), true, null));
|
||||
+ } else {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add fix for off region adult following ai behavior
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
index a9be3acbf4ea52d2988347abfa6f4f8c02b1da26..751f3dde8e6bc2c0365e8672f5079af0379a69de 100644
|
||||
index a9be3acbf4ea52d2988347abfa6f4f8c02b1da26..7ddf9fae8e50bbda2502c6b584fac135fac21773 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BabyFollowAdult.java
|
||||
@@ -25,6 +25,14 @@ public class BabyFollowAdult {
|
||||
@@ -23,3 +23,16 @@ index a9be3acbf4ea52d2988347abfa6f4f8c02b1da26..751f3dde8e6bc2c0365e8672f5079af0
|
||||
if (mob.closerThan(ageableMob, followRange.getMaxValue() + 1) && !mob.closerThan(ageableMob, followRange.getMinValue())) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(mob, ageableMob, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FOLLOW_LEADER);
|
||||
@@ -35,6 +43,12 @@ public class BabyFollowAdult {
|
||||
nearestVisibleAdult.erase();
|
||||
return true;
|
||||
}
|
||||
+ // Luminol start - Fix off region baby follow adult ai
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(((org.bukkit.craftbukkit.entity.CraftEntity)event.getTarget()).getHandleRaw())) {
|
||||
+ nearestVisibleAdult.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Luminol end
|
||||
ageableMob = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getTarget()).getHandle();
|
||||
// CraftBukkit end
|
||||
WalkTarget walkTarget1 = new WalkTarget(
|
||||
|
||||
@@ -5,19 +5,17 @@ Subject: [PATCH] Add tpsbar with chunkhot membar and regionbar
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/paper/util/BaseChunkSystemHooks.java b/ca/spottedleaf/moonrise/paper/util/BaseChunkSystemHooks.java
|
||||
index bd3ce123652af11974be4cbf8d2e96f1b2ee0a68..706f5db61a39e2deac9467398471f42cf57dab91 100644
|
||||
index bd3ce123652af11974be4cbf8d2e96f1b2ee0a68..5f26fd89704aa3fd9c37a1d68a7c4c65ce1e7a5d 100644
|
||||
--- a/ca/spottedleaf/moonrise/paper/util/BaseChunkSystemHooks.java
|
||||
+++ b/ca/spottedleaf/moonrise/paper/util/BaseChunkSystemHooks.java
|
||||
@@ -131,7 +131,9 @@ public abstract class BaseChunkSystemHooks implements ca.spottedleaf.moonrise.co
|
||||
@@ -131,6 +131,7 @@ public abstract class BaseChunkSystemHooks implements ca.spottedleaf.moonrise.co
|
||||
|
||||
@Override
|
||||
public void onChunkNotTicking(final LevelChunk chunk, final ChunkHolder holder) {
|
||||
+ chunk.getChunkHot().clear(); // KioCG
|
||||
chunk.getLevel().getCurrentWorldData().removeTickingChunk(chunk); // Folia - region threading
|
||||
+ ((ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickServerLevel)(ServerLevel)chunk.getLevel()).moonrise$removeChunkForPlayerTicking(chunk); // Moonrise - chunk tick iteration
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index ecf185fce582a542c65a9544388b84835643978b..12062e37c0e832f27ba52844739d0e8d5519a30a 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
|
||||
@@ -3,9 +3,11 @@ From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 22 Jan 2025 17:23:16 +0800
|
||||
Subject: [PATCH] Gale: Optimize noise generation
|
||||
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>, ishland <ishlandmc@yeah.net>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0106-Optimize-noise-generation.patch) and C2ME (https://github.com/RelativityMC/C2ME-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
ishland <ishlandmc@yeah.net>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0106-Optimize-noise-generation.patch)
|
||||
C2ME (https://github.com/RelativityMC/C2ME-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
|
||||
index fb11a2eea540d55e50eab59f9857ca5d99f556f8..dcc1a3f8b611c9f103b848db90b077b984b60ada 100644
|
||||
|
||||
@@ -3,8 +3,10 @@ From: MrHua269 <wangxyper@163.com>
|
||||
Date: Wed, 22 Jan 2025 17:18:00 +0800
|
||||
Subject: [PATCH] Gale: Replace AI attributes with optimized collections
|
||||
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>, 2No2Name <2No2Name@web.de>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0087-Replace-AI-attributes-with-optimized-collections.patch) and Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
2No2Name <2No2Name@web.de>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0087-Replace-AI-attributes-with-optimized-collections.patch)
|
||||
Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
||||
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
|
||||
@@ -3,8 +3,10 @@ From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 15:35:15 +0800
|
||||
Subject: [PATCH] Gale: Skip entity move if movement is zero
|
||||
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>, ishland <ishlandmc@yeah.net>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0103-Skip-entity-move-if-movement-is-zero.patch) and VMP (https://github.com/RelativityMC/VMP-fabric)
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
ishland <ishlandmc@yeah.net>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0103-Skip-entity-move-if-movement-is-zero.patch)
|
||||
VMP (https://github.com/RelativityMC/VMP-fabric)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
|
||||
@@ -3,8 +3,10 @@ From: MrHua269 <wangxyper@163.com>
|
||||
Date: Sun, 12 Jan 2025 14:15:24 +0800
|
||||
Subject: [PATCH] Gale: Use platform math functions
|
||||
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>, Xymb <xymb@endcrystal.me>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0019-Use-platform-math-functions.patch) and Kaiiju(https://github.com/KaiijuMC/Kaiiju)
|
||||
Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Xymb <xymb@endcrystal.me>
|
||||
As part of: Gale (https://github.com/GaleMC/Gale/blob/276e903b2688f23b19bdc8d493c0bf87656d2400/patches/server/0019-Use-platform-math-functions.patch)
|
||||
Kaiiju (https://github.com/KaiijuMC/Kaiiju)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sun, 9 Mar 2025 11:39:01 +0800
|
||||
Subject: [PATCH] Do not search the block out of current region
|
||||
|
||||
Skip getting the blocks don't belong to current tickregion.
|
||||
|
||||
notice: this bug is actually caused by another bug of the teleportAsync implementation.
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
index fc529ece01d8a85e600eb8910662010ab6851d82..7364515b7e489c5e97c7ca693458ff2ae9335c6e 100644
|
||||
--- a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
@@ -432,6 +432,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
|
||||
if (i != 0 || i1 != 0 || allowBedrock) {
|
||||
for (int y = level.getMaxY(); y > (blockPos == null ? level.getMinY() : blockPos.getY()); y--) {
|
||||
BlockPos blockPos1 = new BlockPos(pos.getX() + i, y, pos.getZ() + i1);
|
||||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor((Level) level, blockPos1)) continue; // Luminol - Do not search the block out of current region as we might be at the edge of the tickregion
|
||||
BlockState blockState = level.getBlockState(blockPos1);
|
||||
if (blockState.isCollisionShapeFullBlock(level, blockPos1) && (allowBedrock || !blockState.is(Blocks.BEDROCK))) {
|
||||
blockPos = blockPos1;
|
||||
@@ -7,10 +7,10 @@ We use the old-like logics which is in 1.21.4.
|
||||
Might fixes: https://github.com/PaperMC/Folia/issues/363
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 6dc5b1a8bdba998e11bcdf352bcc0fc7161a484c..753b36a7b1c2627540c62bea78565b880803a175 100644
|
||||
index f8322334fb6a0cea38c4d1981862ba673fd1b100..0e08512ce94435ca90a2344eefc761fa4fcdeb18 100644
|
||||
--- a/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -173,10 +173,14 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||
@@ -173,14 +173,26 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||
// 2. _removes_ are impossible at this stage in the tick
|
||||
final LevelChunk[] raw = entityTickingChunks.getRawDataUnchecked();
|
||||
final int size = entityTickingChunks.size(); foliaProfiler.addCounter(ca.spottedleaf.leafprofiler.LProfilerRegistry.RANDOM_CHUNK_TICK_COUNT, (long)size); // Folia - profiler
|
||||
@@ -20,10 +20,23 @@ index 6dc5b1a8bdba998e11bcdf352bcc0fc7161a484c..753b36a7b1c2627540c62bea78565b88
|
||||
+ // Luminol end
|
||||
|
||||
- java.util.Objects.checkFromToIndex(0, size, raw.length);
|
||||
+ this.level.getServer().moonrise$executeMidTickTasks(); // Luminol - Fix chunk iteration self modification - try executing mid-tick tasks for once chunk system task parsing
|
||||
+ java.util.Objects.checkFromToIndex(0, size, rawCopy.length); // Luminol - Fix chunk iteration self modification - use copy of raw array
|
||||
for (int i = 0; i < size; ++i) {
|
||||
- world.tickChunk(raw[i], randomTickSpeed);
|
||||
+ world.tickChunk(rawCopy[i], randomTickSpeed); // Luminol - Fix chunk iteration self modification - use copy of raw array
|
||||
+ // Luminol start - Fix chunk iteration self modification
|
||||
+ final LevelChunk chunk = rawCopy[i];
|
||||
+
|
||||
+ if (!chunk.getFullStatus().isOrAfter(FullChunkStatus.ENTITY_TICKING)) {
|
||||
+ continue; // skip chunks which are not entity ticking(probably downgraded from last iteration)
|
||||
+ }
|
||||
+ // Luminol end
|
||||
+ world.tickChunk(chunk, randomTickSpeed); // Luminol - Fix chunk iteration self modification - use copy of raw array
|
||||
|
||||
// call mid-tick tasks for chunk system
|
||||
if ((i & 7) == 0) {
|
||||
- //((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.level.getServer()).moonrise$executeMidTickTasks(); // Folia - TODO restore this
|
||||
+ ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.level.getServer()).moonrise$executeMidTickTasks(); // Folia - TODO restore this // Luminol - Fix chunk iteration self modification - restore mid tasks here
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Sat, 31 May 2025 16:28:19 +0800
|
||||
Subject: [PATCH] Fix mispatched entity custom spawning logic
|
||||
|
||||
we should use local players as each tickregion will only foreach their own player entities so that we won't come across async accessing world data
|
||||
|
||||
diff --git a/net/minecraft/world/entity/npc/CatSpawner.java b/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
index f5d27988605d48cdf314f28ba332f33f0a314266..39b506dad0601b2d75acb14989f2758132155d1b 100644
|
||||
--- a/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
+++ b/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
@@ -27,7 +27,7 @@ public class CatSpawner implements CustomSpawner {
|
||||
worldData.catSpawnerNextTick--; // Folia - region threading
|
||||
if (worldData.catSpawnerNextTick <= 0) { // Folia - region threading
|
||||
worldData.catSpawnerNextTick = 1200; // Folia - region threading
|
||||
- Player randomPlayer = level.getRandomPlayer();
|
||||
+ Player randomPlayer = level.getRandomLocalPlayer(); // Luminol - Fix mispatched entity custom spawning logic - Use local players for only the players in current tickregion
|
||||
if (randomPlayer != null) {
|
||||
RandomSource randomSource = level.random;
|
||||
int i = (8 + randomSource.nextInt(24)) * (randomSource.nextBoolean() ? -1 : 1);
|
||||
diff --git a/net/minecraft/world/level/levelgen/PhantomSpawner.java b/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
index a7f56126a26e1fca86c39d8d656b648f5d6bb4ca..4626ee9f4410d8fd683db17b49ef79ab67eeda5f 100644
|
||||
--- a/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
+++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
@@ -40,7 +40,7 @@ public class PhantomSpawner implements CustomSpawner {
|
||||
worldData.phantomSpawnerNextTick += (spawnAttemptMinSeconds + randomSource.nextInt(spawnAttemptMaxSeconds - spawnAttemptMinSeconds + 1)) * 20; // Folia - region threading
|
||||
// Paper end - Ability to control player's insomnia and phantoms
|
||||
if (level.getSkyDarken() >= 5 || !level.dimensionType().hasSkyLight()) {
|
||||
- for (ServerPlayer serverPlayer : level.players()) {
|
||||
+ for (ServerPlayer serverPlayer : level.getLocalPlayers()) { // Luminol - Fix mispatched entity custom spawning logic - Use local players for only the players in current tickregion
|
||||
if (!serverPlayer.isSpectator() && (!level.paperConfig().entities.behavior.phantomsDoNotSpawnOnCreativePlayers || !serverPlayer.isCreative())) { // Paper - Add phantom creative and insomniac controls
|
||||
BlockPos blockPos = serverPlayer.blockPosition();
|
||||
if (!level.dimensionType().hasSkyLight() || blockPos.getY() >= level.getSeaLevel() && level.canSeeSky(blockPos)) {
|
||||
@@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <mrhua269@gmail.com>
|
||||
Date: Mon, 26 May 2025 23:48:32 +0800
|
||||
Subject: [PATCH] Set initial null comparator for scheduler api ticket by
|
||||
default
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/TicketType.java b/net/minecraft/server/level/TicketType.java
|
||||
index bbcb0fdf0cdf6f860897fe39d65019de19b3d758..ccaa07afb0f4153a0e76a0bfeaf75b98c8a08cc8 100644
|
||||
--- a/net/minecraft/server/level/TicketType.java
|
||||
+++ b/net/minecraft/server/level/TicketType.java
|
||||
@@ -57,7 +57,7 @@ public final class TicketType<T> implements ca.spottedleaf.moonrise.patches.chun
|
||||
public static final TicketType<Long> END_GATEWAY_EXIT_SEARCH = ca.spottedleaf.moonrise.patches.chunk_system.ticket.ChunkSystemTicketType.create("folia:end_gateway_exit_search", Long::compareTo);
|
||||
public static final TicketType<Long> NETHER_PORTAL_DOUBLE_CHECK = ca.spottedleaf.moonrise.patches.chunk_system.ticket.ChunkSystemTicketType.create("folia:nether_portal_double_check", Long::compareTo);
|
||||
public static final TicketType<Long> TELEPORT_HOLD_TICKET = ca.spottedleaf.moonrise.patches.chunk_system.ticket.ChunkSystemTicketType.create("folia:teleport_hold_ticket", Long::compareTo);
|
||||
- public static final TicketType REGION_SCHEDULER_API_HOLD = register("folia:region_scheduler_api_hold", 0L, false, TicketType.TicketUse.LOADING_AND_SIMULATION);
|
||||
+ public static final TicketType REGION_SCHEDULER_API_HOLD = register("folia:region_scheduler_api_hold", 0L, false, TicketType.TicketUse.LOADING_AND_SIMULATION); static {((TicketType<?>)REGION_SCHEDULER_API_HOLD).moonrise$setIdentifierComparator((unused, unused2) -> 0);} // Luminol - Set initial null comparator for scheduler api ticket by default to prevent null comparator error
|
||||
// Folia end - region threading
|
||||
|
||||
public static TicketType register(String name, long timeout, boolean persist, TicketType.TicketUse use) {
|
||||
@@ -22,10 +22,10 @@ index 400e632208d133a3f49fc7f14bceb48a1026769b..631bec0adee5b01bfb931c25195b949e
|
||||
+ // 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 00abfbfc0c75434b18e89334a35b657519b51abc..7e5627c5b09a4fb7b923121355b351b5518fea50 100644
|
||||
index 0e32a9ad852e521ce9618acc1642d3748995b4bf..7133038efdef5d60a1bdccb012a2020e432ef25e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2365,6 +2365,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2368,6 +2368,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
handle.newLevel = data.getIntOr("newLevel", 0);
|
||||
handle.expToDrop = data.getIntOr("expToDrop", 0);
|
||||
handle.keepLevel = data.getBooleanOr("keepLevel", false);
|
||||
@@ -41,7 +41,7 @@ index 00abfbfc0c75434b18e89334a35b657519b51abc..7e5627c5b09a4fb7b923121355b351b5
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2386,6 +2395,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2389,6 +2398,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
data.putLong("lastPlayed", System.currentTimeMillis());
|
||||
data.putString("lastKnownName", handle.getScoreboardName());
|
||||
|
||||
@@ -57,7 +57,7 @@ index 00abfbfc0c75434b18e89334a35b657519b51abc..7e5627c5b09a4fb7b923121355b351b5
|
||||
// Paper start - persist for use in offline save data
|
||||
if (!tag.contains("Paper")) {
|
||||
tag.put("Paper", new CompoundTag());
|
||||
@@ -3571,4 +3589,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -3581,4 +3599,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void setDeathScreenScore(final int score) {
|
||||
getHandle().setScore(score);
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] SparklyPaper Optimize canSee checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 7e5627c5b09a4fb7b923121355b351b5518fea50..21d5b328c7fc254c711ea0c4444bdbe3dd9b4a1f 100644
|
||||
index 7133038efdef5d60a1bdccb012a2020e432ef25e..77dd160db2d05d6542ae336fbd71eeae76479b91 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -213,7 +213,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -216,7 +216,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
private boolean hasPlayedBefore = false;
|
||||
private final ConversationTracker conversationTracker = new ConversationTracker();
|
||||
private final Set<String> channels = new HashSet<String>();
|
||||
@@ -17,7 +17,7 @@ index 7e5627c5b09a4fb7b923121355b351b5518fea50..21d5b328c7fc254c711ea0c4444bdbe3
|
||||
private final Set<UUID> unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player
|
||||
private static final WeakHashMap<Plugin, WeakReference<Plugin>> pluginWeakReferences = new WeakHashMap<>();
|
||||
private int hash = 0;
|
||||
@@ -2264,9 +2264,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2267,9 +2267,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public boolean canSee(org.bukkit.entity.Entity entity) {
|
||||
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Add 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 eb94f71f626c1f89f1b9048a8e68ae09ff17effc..78fe4d49aa1108ceb180538aeea6d0cede31a58a 100644
|
||||
index ff6d200c3c3ecb958086f11dff39357dc0bf70fc..16d95bd30c33d831fd495c65748f6633df5971aa 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
|
||||
@@ -162,6 +162,12 @@ public final class MCUtil {
|
||||
return new org.bukkit.Location(world.getWorld(), pos.x(), pos.y(), pos.z());
|
||||
@@ -160,6 +160,12 @@ public final class MCUtil {
|
||||
return new Location(world.getWorld(), pos.x(), pos.y(), pos.z());
|
||||
}
|
||||
|
||||
+ // Luminol start - add BlockPos support
|
||||
@@ -20,4 +20,4 @@ index eb94f71f626c1f89f1b9048a8e68ae09ff17effc..78fe4d49aa1108ceb180538aeea6d0ce
|
||||
+
|
||||
/**
|
||||
* Converts a NMS World/Vector to Bukkit Location
|
||||
* @param world
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/commands/LuminolConfigCommand.java
|
||||
@@ -1,0 +_,70 @@
|
||||
@@ -1,0 +_,80 @@
|
||||
+package me.earthme.luminol.commands;
|
||||
+
|
||||
+import me.earthme.luminol.config.LuminolConfig;
|
||||
@@ -16,7 +16,7 @@
|
||||
+import java.util.List;
|
||||
+
|
||||
+public class LuminolConfigCommand extends Command {
|
||||
+ public LuminolConfigCommand(){
|
||||
+ public LuminolConfigCommand() {
|
||||
+ super("luminolconfig");
|
||||
+ this.setPermission("luminol.commands.luminolconfig");
|
||||
+ this.setDescription("Manage config file");
|
||||
@@ -27,8 +27,10 @@
|
||||
+ public @NotNull List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args, @Nullable Location location) throws IllegalArgumentException {
|
||||
+ final List<String> result = new ArrayList<>();
|
||||
+
|
||||
+ if (args.length == 1){
|
||||
+ result.add("reload");
|
||||
+ if (args.length == 1) {
|
||||
+ result.add("query");
|
||||
+ // result.add("set"); // TODO Later
|
||||
+ // result.add("reload"); // TODO Later
|
||||
+ }
|
||||
+
|
||||
+ return result;
|
||||
@@ -36,35 +38,43 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
|
||||
+ if (!this.testPermission(sender)){
|
||||
+ if (!this.testPermission(sender)) {
|
||||
+ sender.sendMessage(Component
|
||||
+ .text("No permission to execute this command!")
|
||||
+ .color(TextColor.color(255,0,0))
|
||||
+ .color(TextColor.color(255, 0, 0))
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ if (args.length < 1){
|
||||
+ if (args.length < 1) {
|
||||
+ sender.sendMessage(
|
||||
+ Component
|
||||
+ .text("Wrong use!\n")
|
||||
+ .color(TextColor.color(255,0,0))
|
||||
+ .color(TextColor.color(255, 0, 0))
|
||||
+ );
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ switch (args[0]){
|
||||
+ switch (args[0]) {
|
||||
+ case "reload" -> {
|
||||
+ LuminolConfig.reloadAsync().thenAccept(nullValue -> sender.sendMessage(
|
||||
+ Component
|
||||
+ .text("Reloaded config file!")
|
||||
+ .color(TextColor.color(0,255,0))
|
||||
+ .color(TextColor.color(0, 255, 0))
|
||||
+ ));
|
||||
+ }
|
||||
+
|
||||
+ case "set" -> {
|
||||
+ // TODO Later
|
||||
+ }
|
||||
+
|
||||
+ case "query" -> {
|
||||
+ // TODO Later
|
||||
+ }
|
||||
+
|
||||
+ default -> sender.sendMessage(
|
||||
+ Component
|
||||
+ .text("Unknown action!\n")
|
||||
+ .color(TextColor.color(255,0,0))
|
||||
+ .color(TextColor.color(255, 0, 0))
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -22,28 +22,28 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
|
||||
+ if (!testPermission(sender)){
|
||||
+ if (!testPermission(sender)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (!MembarConfig.memoryBarEnabled){
|
||||
+ sender.sendMessage(Component.text("Membar was already disabled!").color(TextColor.color(255,0,0)));
|
||||
+ if (!MembarConfig.memoryBarEnabled) {
|
||||
+ sender.sendMessage(Component.text("Membar was already disabled!").color(TextColor.color(255, 0, 0)));
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (!(sender instanceof Player player)){
|
||||
+ sender.sendMessage(Component.text("Only player can use this command!").color(TextColor.color(255,0,0)));
|
||||
+ if (!(sender instanceof Player player)) {
|
||||
+ sender.sendMessage(Component.text("Only player can use this command!").color(TextColor.color(255, 0, 0)));
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (GlobalServerMemoryBar.isPlayerVisible(player)) {
|
||||
+ player.sendMessage(Component.text("Disabled mem bar").color(TextColor.color(0,255,0)));
|
||||
+ GlobalServerMemoryBar.setVisibilityForPlayer(player,false);
|
||||
+ player.sendMessage(Component.text("Disabled mem bar").color(TextColor.color(0, 255, 0)));
|
||||
+ GlobalServerMemoryBar.setVisibilityForPlayer(player, false);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ player.sendMessage(Component.text("Enabled mem bar").color(TextColor.color(0,255,0)));
|
||||
+ GlobalServerMemoryBar.setVisibilityForPlayer(player,true);
|
||||
+ player.sendMessage(Component.text("Enabled mem bar").color(TextColor.color(0, 255, 0)));
|
||||
+ GlobalServerMemoryBar.setVisibilityForPlayer(player, true);
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/commands/TpsBarCommand.java
|
||||
@@ -1,0 +_,50 @@
|
||||
@@ -1,0 +_,47 @@
|
||||
+package me.earthme.luminol.commands;
|
||||
+
|
||||
+import me.earthme.luminol.config.modules.misc.TpsBarConfig;
|
||||
+import me.earthme.luminol.functions.GlobalServerTpsBar;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.TextColor;
|
||||
+import net.kyori.adventure.util.RGBLike;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.bukkit.Color;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.entity.Player;
|
||||
@@ -25,28 +22,28 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
|
||||
+ if (!testPermission(sender)){
|
||||
+ if (!testPermission(sender)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (!TpsBarConfig.tpsbarEnabled){
|
||||
+ sender.sendMessage(Component.text("Tpsbar was already disabled!").color(TextColor.color(255,0,0)));
|
||||
+ if (!TpsBarConfig.tpsbarEnabled) {
|
||||
+ sender.sendMessage(Component.text("Tpsbar was already disabled!").color(TextColor.color(255, 0, 0)));
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (!(sender instanceof Player player)){
|
||||
+ sender.sendMessage(Component.text("Only player can use this command!").color(TextColor.color(255,0,0)));
|
||||
+ if (!(sender instanceof Player player)) {
|
||||
+ sender.sendMessage(Component.text("Only player can use this command!").color(TextColor.color(255, 0, 0)));
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (GlobalServerTpsBar.isPlayerVisible(player)) {
|
||||
+ player.sendMessage(Component.text("Disabled tps bar").color(TextColor.color(0,255,0)));
|
||||
+ GlobalServerTpsBar.setVisibilityForPlayer(player,false);
|
||||
+ player.sendMessage(Component.text("Disabled tps bar").color(TextColor.color(0, 255, 0)));
|
||||
+ GlobalServerTpsBar.setVisibilityForPlayer(player, false);
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ player.sendMessage(Component.text("Enabled tps bar").color(TextColor.color(0,255,0)));
|
||||
+ GlobalServerTpsBar.setVisibilityForPlayer(player,true);
|
||||
+ player.sendMessage(Component.text("Enabled tps bar").color(TextColor.color(0, 255, 0)));
|
||||
+ GlobalServerTpsBar.setVisibilityForPlayer(player, true);
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/IConfigModule.java
|
||||
@@ -1,0 +_,22 @@
|
||||
@@ -1,0 +_,23 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
@@ -12,11 +12,12 @@
|
||||
+
|
||||
+ String getBaseName();
|
||||
+
|
||||
+ default void onLoaded(CommentedFileConfig configInstance) {}
|
||||
+ default void onLoaded(CommentedFileConfig configInstance) {
|
||||
+ }
|
||||
+
|
||||
+ default <T> T get(String keyName, T defaultValue, @NotNull CommentedFileConfig config){
|
||||
+ if (!config.contains(keyName)){
|
||||
+ config.set(keyName,defaultValue);
|
||||
+ default <T> T get(String keyName, T defaultValue, @NotNull CommentedFileConfig config) {
|
||||
+ if (!config.contains(keyName)) {
|
||||
+ config.set(keyName, defaultValue);
|
||||
+ return defaultValue;
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/LuminolConfig.java
|
||||
@@ -1,0 +_,275 @@
|
||||
@@ -1,0 +_,351 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.CommentedConfig;
|
||||
+import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import io.papermc.paper.threadedregions.RegionizedServer;
|
||||
+import me.earthme.luminol.commands.LuminolConfigCommand;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.DoNotLoad;
|
||||
+import me.earthme.luminol.config.flags.HotReloadUnsupported;
|
||||
+import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
+import org.apache.logging.log4j.LogManager;
|
||||
+import org.apache.logging.log4j.Logger;
|
||||
+import org.bukkit.Bukkit;
|
||||
@@ -80,7 +85,7 @@
|
||||
+ baseConfigFile.createNewFile();
|
||||
+ }
|
||||
+
|
||||
+ configFileInstance = CommentedFileConfig.ofConcurrent(baseConfigFile);
|
||||
+ configFileInstance = CommentedFileConfig.of(baseConfigFile);
|
||||
+
|
||||
+ configFileInstance.load();
|
||||
+
|
||||
@@ -197,6 +202,77 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean setConfigAndSave(String[] keys, Object value) {
|
||||
+ return setConfigAndSave(String.join(".", keys), value);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean setConfigAndSave(String key, Object value) {
|
||||
+ if (setConfig(key, value)) {
|
||||
+ saveConfig();
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean setConfig(String[] keys, Object value) {
|
||||
+ return setConfig(String.join(".", keys), value);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean setConfig(String key, Object value) {
|
||||
+ if (configFileInstance.contains(key) && configFileInstance.get(key) != null) {
|
||||
+ configFileInstance.set(key, value);
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public static void saveConfig() {
|
||||
+ configFileInstance.save();
|
||||
+ }
|
||||
+
|
||||
+ public static void resetConfig(String[] keys) {
|
||||
+ resetConfig(String.join(".", keys));
|
||||
+ }
|
||||
+
|
||||
+ public static void resetConfig(String key) {
|
||||
+ configFileInstance.remove(key);
|
||||
+ configFileInstance.save();
|
||||
+ reload();
|
||||
+ }
|
||||
+
|
||||
+ public static String getConfig(String[] keys) {
|
||||
+ return getConfig(String.join(".", keys));
|
||||
+ }
|
||||
+
|
||||
+ public static String getConfig(String key) {
|
||||
+ return configFileInstance.get(key);
|
||||
+ }
|
||||
+
|
||||
+ public List<String> getAllConfigPaths(String prefix) {
|
||||
+ List<String> configPaths = getAllConfigPaths();
|
||||
+ return configPaths.stream().filter(path -> path.startsWith(prefix)).toList();
|
||||
+ }
|
||||
+
|
||||
+ public static List<String> getAllConfigPaths() {
|
||||
+ List<String> configPaths = new ArrayList<>();
|
||||
+ getAllConfigPathsRecursive(configFileInstance, "", configPaths);
|
||||
+ return configPaths;
|
||||
+ }
|
||||
+
|
||||
+ private static void getAllConfigPathsRecursive(CommentedConfig config, String currentPath, List<String> configPaths) {
|
||||
+ for (CommentedConfig.Entry entry : config.entrySet()) {
|
||||
+ String key = entry.getKey();
|
||||
+ Object value = entry.getValue();
|
||||
+ String fullPath = currentPath.isEmpty() ? key : currentPath + "." + key;
|
||||
+
|
||||
+ if (value instanceof CommentedConfig) {
|
||||
+ getAllConfigPathsRecursive((CommentedConfig) value, fullPath, configPaths);
|
||||
+ } else {
|
||||
+ configPaths.add(fullPath);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull Set<Class<?>> getClasses(String pack) {
|
||||
+ Set<Class<?>> classes = new LinkedHashSet<>();
|
||||
+ String packageDirName = pack.replace('.', '/');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/ConfigInfo.java
|
||||
+++ b/src/main/java/me/earthme/luminol/config/flags/ConfigInfo.java
|
||||
@@ -1,0 +_,11 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+package me.earthme.luminol.config.flags;
|
||||
+
|
||||
+import java.lang.annotation.Retention;
|
||||
+import java.lang.annotation.RetentionPolicy;
|
||||
@@ -1,7 +1,7 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/DoNotLoad.java
|
||||
+++ b/src/main/java/me/earthme/luminol/config/flags/DoNotLoad.java
|
||||
@@ -1,0 +_,8 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+package me.earthme.luminol.config.flags;
|
||||
+
|
||||
+import java.lang.annotation.Retention;
|
||||
+import java.lang.annotation.RetentionPolicy;
|
||||
@@ -1,7 +1,7 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/HotReloadUnsupported.java
|
||||
+++ b/src/main/java/me/earthme/luminol/config/flags/HotReloadUnsupported.java
|
||||
@@ -1,0 +_,8 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+package me.earthme.luminol.config.flags;
|
||||
+
|
||||
+import java.lang.annotation.Retention;
|
||||
+import java.lang.annotation.RetentionPolicy;
|
||||
@@ -1,7 +1,9 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/TransformedConfig.java
|
||||
@@ -1,0 +_,24 @@
|
||||
+package me.earthme.luminol.config;
|
||||
+++ b/src/main/java/me/earthme/luminol/config/flags/TransformedConfig.java
|
||||
@@ -1,0 +_,26 @@
|
||||
+package me.earthme.luminol.config.flags;
|
||||
+
|
||||
+import me.earthme.luminol.config.DefaultTransformLogic;
|
||||
+
|
||||
+import java.lang.annotation.Repeatable;
|
||||
+import java.lang.annotation.Retention;
|
||||
@@ -10,9 +12,9 @@
|
||||
+@Retention(RetentionPolicy.RUNTIME)
|
||||
+@Repeatable(TransformedConfig.List.class)
|
||||
+public @interface TransformedConfig {
|
||||
+ String name() default "";
|
||||
+ String name();
|
||||
+
|
||||
+ String[] category() default "";
|
||||
+ String[] category();
|
||||
+
|
||||
+ boolean transform() default true;
|
||||
+
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.experiment;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class CommandBlockConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enable")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.experiment;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class CommandDataConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enable")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config.modules.experiment;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class CommandTickConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled", comments =
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.experiment;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class DisableAsyncCatcherConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.experiment;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class DisableEntityCatchConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/experiment/EntityDamageSourceTraceConfig.java
|
||||
@@ -1,0 +_,22 @@
|
||||
@@ -1,0 +_,24 @@
|
||||
+package me.earthme.luminol.config.modules.experiment;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
+
|
||||
+public class EntityDamageSourceTraceConfig implements IConfigModule {
|
||||
+ @TransformedConfig(name = "enabled", category = {"experiment", "entity-damage-source-trace"})
|
||||
+ @ConfigInfo(baseName = "enabled", comments =
|
||||
+ """
|
||||
+ Allow trace damage source cross different Region Scheduler.""")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,28 @@
|
||||
+package me.earthme.luminol.config.modules.experiment;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class RayTrackingEntityTrackerConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,28 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class FoliaEntityMovingFixConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled", comments =
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,25 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class FoliaPOIAccessOffRegionFixConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled", comments =
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class ForceCleanupEntityBrainMemoryConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled_for_entity", comments = "When enabled, the entity's brain will clean the memory which is typed of entity and not belong to current tickregion")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class UnsafeTeleportationConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled", comments = "Allow non player entities enter end portals if enabled.\n" +
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.fixes;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class VanillaRandomSourceConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enable_for_player_entity",comments = "Related with RNG cracks")
|
||||
+ @ConfigInfo(baseName = "enable_for_player_entity", comments = "Related with RNG cracks")
|
||||
+ public static boolean useLegacyRandomSourceForPlayers = false;
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,27 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class ContainerExpansionConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "barrel_rows", comments =
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,23 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class DisableEndCrystalCheckConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "disable_end_crystal_check", comments =
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class DisableHeightmapWarnConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled", comments =
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class DisableMovedWronglyThreshold implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class FoliaWatchogConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "tick_region_time_out_ms")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class InorderChatConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import me.earthme.luminol.commands.MembarCommand;
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.DoNotLoad;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.DoNotLoad;
|
||||
+import me.earthme.luminol.functions.GlobalServerMemoryBar;
|
||||
+import org.bukkit.Bukkit;
|
||||
+
|
||||
@@ -20,7 +20,7 @@
|
||||
+ @ConfigInfo(baseName = "format")
|
||||
+ public static String memBarFormat = "<gray>Memory usage <yellow>:</yellow> <used>MB<yellow>/</yellow><available>MB";
|
||||
+ @ConfigInfo(baseName = "memory_color_list")
|
||||
+ public static List<String> memColors = List.of("GREEN","YELLOW","RED","PURPLE");
|
||||
+ public static List<String> memColors = List.of("GREEN", "YELLOW", "RED", "PURPLE");
|
||||
+ @ConfigInfo(baseName = "update_interval_ticks")
|
||||
+ public static int updateInterval = 15;
|
||||
+
|
||||
@@ -38,15 +38,15 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onLoaded(CommentedFileConfig configInstance){
|
||||
+ if (memoryBarEnabled){
|
||||
+ public void onLoaded(CommentedFileConfig configInstance) {
|
||||
+ if (memoryBarEnabled) {
|
||||
+ GlobalServerMemoryBar.init();
|
||||
+ }else{
|
||||
+ } else {
|
||||
+ GlobalServerMemoryBar.cancelBarUpdateTask();
|
||||
+ }
|
||||
+
|
||||
+ if (!inited){
|
||||
+ Bukkit.getCommandMap().register("membar","luminol",new MembarCommand("membar"));
|
||||
+ if (!inited) {
|
||||
+ Bukkit.getCommandMap().register("membar", "luminol", new MembarCommand("membar"));
|
||||
+ inited = true;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class OfflineModeWarningConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,21 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class PublickeyVerifyConfig implements IConfigModule {
|
||||
+
|
||||
|
||||
@@ -1,31 +1,36 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/RaidChangesConfig.java
|
||||
@@ -1,0 +_,54 @@
|
||||
@@ -1,0 +_,61 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
+
|
||||
+public class RaidChangesConfig implements IConfigModule {
|
||||
+ @TransformedConfig(name = "allow-bad-omen-trigger-raid", category = {"misc", "revert-raid-changes"})
|
||||
+ @ConfigInfo(baseName = "allow_bad_omen_trigger_raid", comments =
|
||||
+ """
|
||||
+ Allow players with ominous signs to skip a\s
|
||||
+ 30-second cooldown and trigger attacks directly""")
|
||||
+ public static boolean trigger = false;
|
||||
+
|
||||
+ @TransformedConfig(name = "give-bad-omen-when-kill-patrol-leader", category = {"misc", "revert-raid-changes"})
|
||||
+ @ConfigInfo(baseName = "give_bad_omen_when_kill_patrol_leader", comments =
|
||||
+ """
|
||||
+ Enable players to obtain an ominous omen\s
|
||||
+ effect when killing the patrol team captain""")
|
||||
+ public static boolean effect = false;
|
||||
+
|
||||
+ @TransformedConfig(name = "bad-omen-infinite", category = {"misc", "revert-raid-changes"})
|
||||
+ @ConfigInfo(baseName = "bad_omen_infinite", comments =
|
||||
+ """
|
||||
+ Enable bad omen effect infinite time
|
||||
+ --- this config is not old version's function""")
|
||||
+ public static boolean infinite = false;
|
||||
+
|
||||
+ @TransformedConfig(name = "skip-height-check", category = {"misc", "revert-raid-changes"})
|
||||
+ @ConfigInfo(baseName = "skip_height_check", comments =
|
||||
+ """
|
||||
+ Disable y <= 96 check.
|
||||
@@ -33,12 +38,14 @@
|
||||
+ and always behavior of enabled""")
|
||||
+ public static boolean heightCheck = false;
|
||||
+
|
||||
+ @TransformedConfig(name = "skip-self-raid-check", category = {"misc", "revert-raid-changes"})
|
||||
+ @ConfigInfo(baseName = "skip_self_raid_check", comments =
|
||||
+ """
|
||||
+ Disable raid self check\s
|
||||
+ --- this config is not old version's function""")
|
||||
+ public static boolean selfCheck = false;
|
||||
+
|
||||
+ @TransformedConfig(name = "revert-274911", category = {"misc", "revert-raid-changes"})
|
||||
+ @ConfigInfo(baseName = "revert_274911", comments =
|
||||
+ """
|
||||
+ Revert Old raid's find spawn position logic
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import me.earthme.luminol.commands.RegionBarCommand;
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.DoNotLoad;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.DoNotLoad;
|
||||
+import me.earthme.luminol.functions.GlobalServerRegionBar;
|
||||
+import org.bukkit.Bukkit;
|
||||
+
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/RegionFormatConfig.java
|
||||
@@ -1,0 +_,59 @@
|
||||
@@ -1,0 +_,63 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import abomination.LinearRegionFile;
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import me.earthme.luminol.config.*;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.DoNotLoad;
|
||||
+import me.earthme.luminol.config.flags.HotReloadUnsupported;
|
||||
+import me.earthme.luminol.utils.EnumRegionFormat;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class SecureSeedConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled", comments = """
|
||||
+ Once you enable secure seed, all ores and structures are generated with 1024-bit seed
|
||||
+ instead of using 64-bit seed in vanilla, made seed cracker become impossible.""")
|
||||
+ Once you enable secure seed, all ores and structures are generated with 1024-bit seed
|
||||
+ instead of using 64-bit seed in vanilla, made seed cracker become impossible.""")
|
||||
+ public static boolean enabled = false;
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import org.apache.logging.log4j.Level;
|
||||
+
|
||||
+public class SentryConfig implements IConfigModule {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,23 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class ServerModNameConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "name")
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/TpsBarConfig.java
|
||||
@@ -1,0 +_,51 @@
|
||||
@@ -1,0 +_,54 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import me.earthme.luminol.commands.TpsBarCommand;
|
||||
+import me.earthme.luminol.config.*;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.DoNotLoad;
|
||||
+import me.earthme.luminol.functions.GlobalServerTpsBar;
|
||||
+import org.bukkit.Bukkit;
|
||||
+
|
||||
@@ -17,11 +20,11 @@
|
||||
+ @ConfigInfo(baseName = "format")
|
||||
+ public static String tpsBarFormat = "<gray>TPS<yellow>:</yellow> <tps> MSPT<yellow>:</yellow> <mspt> Ping<yellow>:</yellow> <ping>ms ChunkHot<yellow>:</yellow> <chunkhot>";
|
||||
+ @ConfigInfo(baseName = "tps_color_list")
|
||||
+ public static List<String> tpsColors = List.of("GREEN","YELLOW","RED","PURPLE");
|
||||
+ public static List<String> tpsColors = List.of("GREEN", "YELLOW", "RED", "PURPLE");
|
||||
+ @ConfigInfo(baseName = "ping_color_list")
|
||||
+ public static List<String> pingColors = List.of("GREEN","YELLOW","RED","PURPLE");
|
||||
+ public static List<String> pingColors = List.of("GREEN", "YELLOW", "RED", "PURPLE");
|
||||
+ @ConfigInfo(baseName = "chunkhot_color_list")
|
||||
+ public static List<String> chunkHotColors = List.of("GREEN","YELLOW","RED","PURPLE");
|
||||
+ public static List<String> chunkHotColors = List.of("GREEN", "YELLOW", "RED", "PURPLE");
|
||||
+ @ConfigInfo(baseName = "update_interval_ticks")
|
||||
+ public static int updateInterval = 15;
|
||||
+
|
||||
@@ -39,15 +42,15 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onLoaded(CommentedFileConfig configInstance){
|
||||
+ if (tpsbarEnabled){
|
||||
+ public void onLoaded(CommentedFileConfig configInstance) {
|
||||
+ if (tpsbarEnabled) {
|
||||
+ GlobalServerTpsBar.init();
|
||||
+ }else{
|
||||
+ } else {
|
||||
+ GlobalServerTpsBar.cancelBarUpdateTask();
|
||||
+ }
|
||||
+
|
||||
+ if (!inited){
|
||||
+ Bukkit.getCommandMap().register("tpsbar","luminol",new TpsBarCommand("tpsbar"));
|
||||
+ if (!inited) {
|
||||
+ Bukkit.getCommandMap().register("tpsbar", "luminol", new TpsBarCommand("tpsbar"));
|
||||
+ inited = true;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/AllowTripwireDupe.java
|
||||
@@ -1,0 +_,27 @@
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/TripwireBehaviorConfig.java
|
||||
@@ -1,0 +_,29 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
+
|
||||
+public class AllowTripwireDupe implements IConfigModule {
|
||||
+public class TripwireBehaviorConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = false;
|
||||
+ @TransformedConfig(name = "behavior-mode", category = {"misc", "tripwire_dupe"})
|
||||
+ @ConfigInfo(baseName = "behavior_mode", comments =
|
||||
+ """
|
||||
+ Allowed Value:
|
||||
+ Available Value:
|
||||
+ VANILLA20
|
||||
+ VANILLA21
|
||||
+ MIXED""")
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class UsernameCheckConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.optimizations;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class EntityGoalSelectorInactiveTickConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.optimizations;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class GaleVariableEntityWakeupConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "entity_wakeup_duration_ratio_standard_deviation")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,24 @@
|
||||
+package me.earthme.luminol.config.modules.optimizations;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class LobotomizeVillageConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config.modules.optimizations;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class PetalReduceSensorWorkConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,22 @@
|
||||
+package me.earthme.luminol.config.modules.optimizations;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class ProjectileChunkReduceConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "max-loads-per-tick")
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.optimizations;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class PurpurAlternativeKeepaliveConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
+import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import gg.pufferfish.pufferfish.simd.SIMDDetection;
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.DoNotLoad;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.DoNotLoad;
|
||||
+import org.slf4j.Logger;
|
||||
+
|
||||
+public class SIMDConfig implements IConfigModule {
|
||||
@@ -30,7 +30,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public void onLoaded(CommentedFileConfig configInstance) {
|
||||
+ if (!enabled){
|
||||
+ if (!enabled) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -1,0 +_,20 @@
|
||||
+package me.earthme.luminol.config.modules.optimizations;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+
|
||||
+public class SuffocationOptimizationConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/removed/RemovedConfig.java
|
||||
@@ -1,0 +_,22 @@
|
||||
@@ -1,0 +_,26 @@
|
||||
+package me.earthme.luminol.config.modules.removed;
|
||||
+
|
||||
+import me.earthme.luminol.config.*;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+import me.earthme.luminol.config.flags.ConfigInfo;
|
||||
+import me.earthme.luminol.config.flags.DoNotLoad;
|
||||
+import me.earthme.luminol.config.flags.TransformedConfig;
|
||||
+
|
||||
+public class RemovedConfig implements IConfigModule {
|
||||
+ @TransformedConfig(name = "example", category = {"removed", "example"}, transform = false)
|
||||
|
||||
@@ -26,24 +26,24 @@
|
||||
+ protected static final NullPlugin NULL_PLUGIN = new NullPlugin();
|
||||
+ protected static final Map<UUID, BossBar> uuid2Bossbars = Maps.newConcurrentMap();
|
||||
+ protected static final Map<UUID, ScheduledTask> scheduledTasks = new HashMap<>();
|
||||
+ protected static volatile ScheduledTask scannerTask = null;
|
||||
+ private static final Logger logger = LogUtils.getLogger();
|
||||
+ protected static volatile ScheduledTask scannerTask = null;
|
||||
+
|
||||
+ public static void init(){
|
||||
+ public static void init() {
|
||||
+ cancelBarUpdateTask();
|
||||
+
|
||||
+ scannerTask = Bukkit.getGlobalRegionScheduler().runAtFixedRate(NULL_PLUGIN, unused -> {
|
||||
+ try {
|
||||
+ update();
|
||||
+ }catch (Exception e){
|
||||
+ } catch (Exception e) {
|
||||
+ logger.error(e.getLocalizedMessage());
|
||||
+ }
|
||||
+ }, 1, MembarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ public static void cancelBarUpdateTask(){
|
||||
+ if (scannerTask == null || scannerTask.isCancelled()){
|
||||
+ public static void cancelBarUpdateTask() {
|
||||
+ if (scannerTask == null || scannerTask.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -56,20 +56,20 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isPlayerVisible(Player player){
|
||||
+ public static boolean isPlayerVisible(Player player) {
|
||||
+ return ((CraftPlayer) player).getHandle().isMemBarVisible;
|
||||
+ }
|
||||
+
|
||||
+ public static void setVisibilityForPlayer(Player target,boolean canSee){
|
||||
+ public static void setVisibilityForPlayer(Player target, boolean canSee) {
|
||||
+ ((CraftPlayer) target).getHandle().isMemBarVisible = canSee;
|
||||
+ }
|
||||
+
|
||||
+ private static void update(){
|
||||
+ private static void update() {
|
||||
+ doUpdate();
|
||||
+ cleanUp();
|
||||
+ }
|
||||
+
|
||||
+ private static void cleanUp(){
|
||||
+ private static void cleanUp() {
|
||||
+ final List<UUID> toCleanUp = new ArrayList<>();
|
||||
+
|
||||
+ for (Map.Entry<UUID, ScheduledTask> toCheck : scheduledTasks.entrySet()) {
|
||||
@@ -83,7 +83,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void doUpdate(){
|
||||
+ private static void doUpdate() {
|
||||
+ for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
+ scheduledTasks.computeIfAbsent(player.getUniqueId(), unused -> createBossBarForPlayer(player));
|
||||
+ }
|
||||
@@ -110,7 +110,7 @@
|
||||
+
|
||||
+ BossBar targetBossbar = uuid2Bossbars.computeIfAbsent(
|
||||
+ playerUUID,
|
||||
+ (unused1) -> BossBar.bossBar(Component.text(""),0.0F, BossBar.Color.valueOf(MembarConfig.memColors.get(3)), BossBar.Overlay.NOTCHED_20)
|
||||
+ (unused1) -> BossBar.bossBar(Component.text(""), 0.0F, BossBar.Color.valueOf(MembarConfig.memColors.get(3)), BossBar.Overlay.NOTCHED_20)
|
||||
+ );
|
||||
+
|
||||
+ apiPlayer.showBossBar(targetBossbar);
|
||||
@@ -125,47 +125,47 @@
|
||||
+ }, 1, MembarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+ private static void updateMembar(@NotNull BossBar bar, long used, long xmx){
|
||||
+ private static void updateMembar(@NotNull BossBar bar, long used, long xmx) {
|
||||
+ double percent = Math.max(Math.min((float) used / xmx, 1.0F), 0.0F);
|
||||
+ bar.name(MiniMessage.miniMessage().deserialize(
|
||||
+ MembarConfig.memBarFormat,
|
||||
+ Placeholder.component("used", getMemoryComponent(used,xmx)),
|
||||
+ Placeholder.component("available",getMaxMemComponent(xmx))
|
||||
+ Placeholder.component("used", getMemoryComponent(used, xmx)),
|
||||
+ Placeholder.component("available", getMaxMemComponent(xmx))
|
||||
+ ));
|
||||
+ bar.color(barColorFromMemory(percent));
|
||||
+ bar.progress((float) percent);
|
||||
+ }
|
||||
+
|
||||
+ private static @NotNull Component getMaxMemComponent(double max){
|
||||
+ private static @NotNull Component getMaxMemComponent(double max) {
|
||||
+ final BossBar.Color colorBukkit = BossBar.Color.GREEN;
|
||||
+ final String colorString = colorBukkit.name();
|
||||
+
|
||||
+ final String content = "<%s><text></%s>";
|
||||
+ final String replaced = String.format(content,colorString,colorString);
|
||||
+ final String replaced = String.format(content, colorString, colorString);
|
||||
+
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced,Placeholder.parsed("text", String.format("%.2f", max / (1024 * 1024))));
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced, Placeholder.parsed("text", String.format("%.2f", max / (1024 * 1024))));
|
||||
+ }
|
||||
+
|
||||
+ private static @NotNull Component getMemoryComponent(long used,long max){
|
||||
+ private static @NotNull Component getMemoryComponent(long used, long max) {
|
||||
+ final BossBar.Color colorBukkit = barColorFromMemory(Math.max(Math.min((float) used / max, 1.0F), 0.0F));
|
||||
+ final String colorString = colorBukkit.name();
|
||||
+
|
||||
+ final String content = "<%s><text></%s>";
|
||||
+ final String replaced = String.format(content,colorString,colorString);
|
||||
+ final String replaced = String.format(content, colorString, colorString);
|
||||
+
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced,Placeholder.parsed("text", String.format("%.2f", (double)used / (1024 * 1024))));
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced, Placeholder.parsed("text", String.format("%.2f", (double) used / (1024 * 1024))));
|
||||
+ }
|
||||
+
|
||||
+ private static BossBar.Color barColorFromMemory(double memPercent){
|
||||
+ if (memPercent == -1){
|
||||
+ private static BossBar.Color barColorFromMemory(double memPercent) {
|
||||
+ if (memPercent == -1) {
|
||||
+ return BossBar.Color.valueOf(MembarConfig.memColors.get(3));
|
||||
+ }
|
||||
+
|
||||
+ if (memPercent <= 50){
|
||||
+ if (memPercent <= 50) {
|
||||
+ return BossBar.Color.valueOf(MembarConfig.memColors.getFirst());
|
||||
+ }
|
||||
+
|
||||
+ if (memPercent <= 70){
|
||||
+ if (memPercent <= 70) {
|
||||
+ return BossBar.Color.valueOf(MembarConfig.memColors.get(1));
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/functions/GlobalServerRegionBar.java
|
||||
@@ -1,0 +_,184 @@
|
||||
@@ -1,0 +_,185 @@
|
||||
+package me.earthme.luminol.functions;
|
||||
+
|
||||
+import com.google.common.collect.Maps;
|
||||
+import com.mojang.logging.LogUtils;
|
||||
+import io.papermc.paper.threadedregions.*;
|
||||
+import io.papermc.paper.threadedregions.ThreadedRegionizer;
|
||||
+import io.papermc.paper.threadedregions.TickData;
|
||||
+import io.papermc.paper.threadedregions.TickRegionScheduler;
|
||||
+import io.papermc.paper.threadedregions.TickRegions;
|
||||
+import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
||||
+import me.earthme.luminol.config.modules.misc.RegionBarConfig;
|
||||
+import me.earthme.luminol.utils.NullPlugin;
|
||||
@@ -26,11 +29,9 @@
|
||||
+ protected static final NullPlugin NULL_PLUGIN = new NullPlugin();
|
||||
+ protected static final Map<UUID, BossBar> uuid2Bossbars = Maps.newConcurrentMap();
|
||||
+ protected static final Map<UUID, ScheduledTask> scheduledTasks = new HashMap<>();
|
||||
+
|
||||
+ protected static volatile ScheduledTask scannerTask = null;
|
||||
+ private static final Logger logger = LogUtils.getLogger();
|
||||
+
|
||||
+ private static final ThreadLocal<DecimalFormat> ONE_DECIMAL_PLACES = ThreadLocal.withInitial(() -> new DecimalFormat("#,##0.0"));
|
||||
+ protected static volatile ScheduledTask scannerTask = null;
|
||||
+
|
||||
+ public static void init() {
|
||||
+ cancelBarUpdateTask();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/functions/GlobalServerTpsBar.java
|
||||
@@ -1,0 +_,241 @@
|
||||
@@ -1,0 +_,240 @@
|
||||
+package me.earthme.luminol.functions;
|
||||
+
|
||||
+import com.google.common.collect.Maps;
|
||||
@@ -28,25 +28,24 @@
|
||||
+ protected static final NullPlugin NULL_PLUGIN = new NullPlugin();
|
||||
+ protected static final Map<UUID, BossBar> uuid2Bossbars = Maps.newConcurrentMap();
|
||||
+ protected static final Map<UUID, ScheduledTask> scheduledTasks = new HashMap<>();
|
||||
+
|
||||
+ protected static volatile ScheduledTask scannerTask = null;
|
||||
+ private static final Logger logger = LogUtils.getLogger();
|
||||
+ protected static volatile ScheduledTask scannerTask = null;
|
||||
+
|
||||
+ public static void init(){
|
||||
+ public static void init() {
|
||||
+ cancelBarUpdateTask();
|
||||
+
|
||||
+ scannerTask = Bukkit.getGlobalRegionScheduler().runAtFixedRate(NULL_PLUGIN, unused -> {
|
||||
+ try {
|
||||
+ update();
|
||||
+ cleanUp();
|
||||
+ }catch (Exception e){
|
||||
+ } catch (Exception e) {
|
||||
+ logger.error(e.getLocalizedMessage());
|
||||
+ }
|
||||
+ }, 1, TpsBarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+ public static void cancelBarUpdateTask(){
|
||||
+ if (scannerTask == null || scannerTask.isCancelled()){
|
||||
+ public static void cancelBarUpdateTask() {
|
||||
+ if (scannerTask == null || scannerTask.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -59,15 +58,15 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isPlayerVisible(Player player){
|
||||
+ public static boolean isPlayerVisible(Player player) {
|
||||
+ return ((CraftPlayer) player).getHandle().isTpsBarVisible;
|
||||
+ }
|
||||
+
|
||||
+ public static void setVisibilityForPlayer(Player target,boolean canSee){
|
||||
+ public static void setVisibilityForPlayer(Player target, boolean canSee) {
|
||||
+ ((CraftPlayer) target).getHandle().isTpsBarVisible = canSee;
|
||||
+ }
|
||||
+
|
||||
+ private static void update(){
|
||||
+ private static void update() {
|
||||
+ for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
+ scheduledTasks.computeIfAbsent(player.getUniqueId(), unused -> createBossBarForPlayer(player));
|
||||
+ }
|
||||
@@ -106,12 +105,12 @@
|
||||
+
|
||||
+ BossBar targetBossbar = uuid2Bossbars.computeIfAbsent(
|
||||
+ playerUUID,
|
||||
+ unused -> BossBar.bossBar(Component.text(""),0.0F, BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(3)), BossBar.Overlay.NOTCHED_20)
|
||||
+ unused -> BossBar.bossBar(Component.text(""), 0.0F, BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(3)), BossBar.Overlay.NOTCHED_20)
|
||||
+ );
|
||||
+
|
||||
+ apiPlayer.showBossBar(targetBossbar);
|
||||
+
|
||||
+ if (reportData != null){
|
||||
+ if (reportData != null) {
|
||||
+ final TickData.SegmentData tpsData = reportData.tpsData().segmentAll();
|
||||
+ final double mspt = reportData.timePerTickData().segmentAll().average() / 1.0E6;
|
||||
+
|
||||
@@ -126,116 +125,116 @@
|
||||
+ }, 1, TpsBarConfig.updateInterval);
|
||||
+ }
|
||||
+
|
||||
+ private static void updateTpsBar(double tps, double mspt, @NotNull BossBar bar, @NotNull Player player){
|
||||
+ private static void updateTpsBar(double tps, double mspt, @NotNull BossBar bar, @NotNull Player player) {
|
||||
+ bar.name(MiniMessage.miniMessage().deserialize(
|
||||
+ TpsBarConfig.tpsBarFormat,
|
||||
+ Placeholder.component("tps",getTpsComponent(tps)),
|
||||
+ Placeholder.component("mspt",getMsptComponent(mspt)),
|
||||
+ Placeholder.component("ping",getPingComponent(player.getPing())),
|
||||
+ Placeholder.component("chunkhot",getChunkHotComponent(player.getNearbyChunkHot()))
|
||||
+ Placeholder.component("tps", getTpsComponent(tps)),
|
||||
+ Placeholder.component("mspt", getMsptComponent(mspt)),
|
||||
+ Placeholder.component("ping", getPingComponent(player.getPing())),
|
||||
+ Placeholder.component("chunkhot", getChunkHotComponent(player.getNearbyChunkHot()))
|
||||
+ ));
|
||||
+ bar.color(barColorFromTps(tps));
|
||||
+ bar.progress((float) Math.min((float)1,Math.max(mspt / 50,0)));
|
||||
+ bar.progress((float) Math.min((float) 1, Math.max(mspt / 50, 0)));
|
||||
+ }
|
||||
+
|
||||
+ private static @NotNull Component getPingComponent(int ping){
|
||||
+ private static @NotNull Component getPingComponent(int ping) {
|
||||
+ final BossBar.Color colorBukkit = barColorFromPing(ping);
|
||||
+ final String colorString = colorBukkit.name();
|
||||
+
|
||||
+ final String content = "<%s><text></%s>";
|
||||
+ final String replaced = String.format(content,colorString,colorString);
|
||||
+ final String replaced = String.format(content, colorString, colorString);
|
||||
+
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced,Placeholder.parsed("text", String.valueOf(ping)));
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced, Placeholder.parsed("text", String.valueOf(ping)));
|
||||
+ }
|
||||
+
|
||||
+ private static BossBar.Color barColorFromPing(int ping){
|
||||
+ if (ping == -1){
|
||||
+ private static BossBar.Color barColorFromPing(int ping) {
|
||||
+ if (ping == -1) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.pingColors.get(3));
|
||||
+ }
|
||||
+
|
||||
+ if (ping <= 80){
|
||||
+ if (ping <= 80) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.pingColors.get(0));
|
||||
+ }
|
||||
+
|
||||
+ if (ping <= 160){
|
||||
+ if (ping <= 160) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.pingColors.get(1));
|
||||
+ }
|
||||
+
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.pingColors.get(2));
|
||||
+ }
|
||||
+
|
||||
+ private static @NotNull Component getMsptComponent(double mspt){
|
||||
+ private static @NotNull Component getMsptComponent(double mspt) {
|
||||
+ final BossBar.Color colorBukkit = barColorFromMspt(mspt);
|
||||
+ final String colorString = colorBukkit.name();
|
||||
+
|
||||
+ final String content = "<%s><text></%s>";
|
||||
+ final String replaced = String.format(content,colorString,colorString);
|
||||
+ final String replaced = String.format(content, colorString, colorString);
|
||||
+
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced,Placeholder.parsed("text", String.format("%.2f", mspt)));
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced, Placeholder.parsed("text", String.format("%.2f", mspt)));
|
||||
+ }
|
||||
+
|
||||
+ private static @NotNull Component getChunkHotComponent(long chunkHot){
|
||||
+ private static @NotNull Component getChunkHotComponent(long chunkHot) {
|
||||
+ final BossBar.Color colorBukkit = barColorFromChunkHot(chunkHot);
|
||||
+ final String colorString = colorBukkit.name();
|
||||
+
|
||||
+ final String content = "<%s><text></%s>";
|
||||
+ final String replaced = String.format(content,colorString,colorString);
|
||||
+ final String replaced = String.format(content, colorString, colorString);
|
||||
+
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced,Placeholder.parsed("text", String.valueOf(chunkHot)));
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced, Placeholder.parsed("text", String.valueOf(chunkHot)));
|
||||
+ }
|
||||
+
|
||||
+ private static BossBar.Color barColorFromChunkHot(long chunkHot){
|
||||
+ if (chunkHot == -1){
|
||||
+ private static BossBar.Color barColorFromChunkHot(long chunkHot) {
|
||||
+ if (chunkHot == -1) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.chunkHotColors.get(3));
|
||||
+ }
|
||||
+
|
||||
+ if (chunkHot <= 300000L){
|
||||
+ if (chunkHot <= 300000L) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.chunkHotColors.get(0));
|
||||
+ }
|
||||
+
|
||||
+ if (chunkHot <= 500000L){
|
||||
+ if (chunkHot <= 500000L) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.chunkHotColors.get(1));
|
||||
+ }
|
||||
+
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.chunkHotColors.get(2));
|
||||
+ }
|
||||
+
|
||||
+ private static BossBar.Color barColorFromMspt(double mspt){
|
||||
+ if (mspt == -1){
|
||||
+ private static BossBar.Color barColorFromMspt(double mspt) {
|
||||
+ if (mspt == -1) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(3));
|
||||
+ }
|
||||
+
|
||||
+ if (mspt <= 25){
|
||||
+ if (mspt <= 25) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(0));
|
||||
+ }
|
||||
+
|
||||
+ if (mspt <= 50){
|
||||
+ if (mspt <= 50) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(1));
|
||||
+ }
|
||||
+
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(2));
|
||||
+ }
|
||||
+
|
||||
+ private static @NotNull Component getTpsComponent(double tps){
|
||||
+ private static @NotNull Component getTpsComponent(double tps) {
|
||||
+ final BossBar.Color colorBukkit = barColorFromTps(tps);
|
||||
+ final String colorString = colorBukkit.name();
|
||||
+
|
||||
+ final String content = "<%s><text></%s>";
|
||||
+ final String replaced = String.format(content,colorString,colorString);
|
||||
+ final String replaced = String.format(content, colorString, colorString);
|
||||
+
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced,Placeholder.parsed("text", String.format("%.2f", tps)));
|
||||
+ return MiniMessage.miniMessage().deserialize(replaced, Placeholder.parsed("text", String.format("%.2f", tps)));
|
||||
+ }
|
||||
+
|
||||
+ private static BossBar.Color barColorFromTps(double tps){
|
||||
+ if (tps == -1){
|
||||
+ private static BossBar.Color barColorFromTps(double tps) {
|
||||
+ if (tps == -1) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(3));
|
||||
+ }
|
||||
+
|
||||
+ if (tps >= 18){
|
||||
+ if (tps >= 18) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(0));
|
||||
+ }
|
||||
+
|
||||
+ if (tps >= 15){
|
||||
+ if (tps >= 15) {
|
||||
+ return BossBar.Color.valueOf(TpsBarConfig.tpsColors.get(1));
|
||||
+ }
|
||||
+
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public enum EnumRegionFormat {
|
||||
+ MCA("mca", "mca" , (info) -> new RegionFile(info.info(), info.filePath(), info.folder(), info.sync())),
|
||||
+ LINEAR_V2("linear_v2", "linear" ,(info) -> new LinearRegionFile(info.info(), info.filePath(), info.folder(), info.sync(), RegionFormatConfig.linearCompressionLevel));
|
||||
+ MCA("mca", "mca", (info) -> new RegionFile(info.info(), info.filePath(), info.folder(), info.sync())),
|
||||
+ LINEAR_V2("linear_v2", "linear", (info) -> new LinearRegionFile(info.info(), info.filePath(), info.folder(), info.sync(), RegionFormatConfig.linearCompressionLevel));
|
||||
+
|
||||
+ private final String name;
|
||||
+ private final String argument;
|
||||
|
||||
@@ -3,27 +3,26 @@
|
||||
@@ -1,0 +_,152 @@
|
||||
+package me.earthme.luminol.utils;
|
||||
+
|
||||
+import io.papermc.paper.plugin.configuration.PluginMeta;
|
||||
+import io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager;
|
||||
+import org.bukkit.Server;
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.configuration.file.FileConfiguration;
|
||||
+import org.bukkit.generator.BiomeProvider;
|
||||
+import org.bukkit.generator.ChunkGenerator;
|
||||
+import org.bukkit.plugin.*;
|
||||
+import org.bukkit.plugin.PluginBase;
|
||||
+import org.bukkit.plugin.PluginDescriptionFile;
|
||||
+import org.bukkit.plugin.PluginLoader;
|
||||
+import org.bukkit.plugin.PluginLogger;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.io.File;
|
||||
+import java.io.InputStream;
|
||||
+import java.util.List;
|
||||
+import java.util.logging.Logger;
|
||||
+
|
||||
+public class NullPlugin extends PluginBase {
|
||||
+ private boolean enabled = true;
|
||||
+
|
||||
+public class NullPlugin extends PluginBase {
|
||||
+ private final String pluginName;
|
||||
+ private boolean enabled = true;
|
||||
+ private PluginDescriptionFile pdf;
|
||||
+
|
||||
+ public NullPlugin() {
|
||||
@@ -31,10 +30,6 @@
|
||||
+ pdf = new PluginDescriptionFile(pluginName, "1.0", "nms");
|
||||
+ }
|
||||
+
|
||||
+ public void setEnabled(boolean enabled) {
|
||||
+ this.enabled = enabled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public File getDataFolder() {
|
||||
+ throw new UnsupportedOperationException("Not supported.");
|
||||
@@ -44,17 +39,18 @@
|
||||
+ public PluginDescriptionFile getDescription() {
|
||||
+ return pdf;
|
||||
+ }
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public io.papermc.paper.plugin.configuration.PluginMeta getPluginMeta() {
|
||||
+ return pdf;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+ @Override
|
||||
+ public FileConfiguration getConfig() {
|
||||
+ throw new UnsupportedOperationException("Not supported.");
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+ @Override
|
||||
+ public InputStream getResource(String filename) {
|
||||
@@ -101,6 +97,10 @@
|
||||
+ return enabled;
|
||||
+ }
|
||||
+
|
||||
+ public void setEnabled(boolean enabled) {
|
||||
+ this.enabled = enabled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onDisable() {
|
||||
+ throw new UnsupportedOperationException("Not supported.");
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/utils/RegionCreatorInfo.java
|
||||
@@ -1,0 +_,7 @@
|
||||
@@ -1,0 +_,8 @@
|
||||
+package me.earthme.luminol.utils;
|
||||
+
|
||||
+import net.minecraft.world.level.chunk.storage.RegionStorageInfo;
|
||||
+
|
||||
+import java.nio.file.Path;
|
||||
+
|
||||
+public record RegionCreatorInfo (RegionStorageInfo info, Path filePath, Path folder, boolean sync) {}
|
||||
+public record RegionCreatorInfo(RegionStorageInfo info, Path filePath, Path folder, boolean sync) {
|
||||
+}
|
||||
|
||||
Reference in New Issue
Block a user