Skip to content

Commit

Permalink
chore(server): Luminol comment format & gitignore file (#10)
Browse files Browse the repository at this point in the history
* chore: fix gitignore

* style(server): fix Luminol comment format
  • Loading branch information
nostalfinals authored Apr 17, 2024
1 parent 8c879a1 commit 2ebfe2c
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 73 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ out/
*~

# other stuff
leaves-server
leaves-api
Lumina-Server
Lumina-API
paper-api-generator
mc-dev
.idea
testserver
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0002-Luminol-Config-file-system.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Subject: [PATCH] Luminol Config file system


diff --git a/build.gradle.kts b/build.gradle.kts
index 4cd2de79b9a611293ff315fe058a7359edd6d3b3..0f5e1de926d0317e5467dac1ff68399224b160d4 100644
index 4cd2de79b9a611293ff315fe058a7359edd6d3b3..da97cba3fba11e15d08edd72ee2d5485488939db 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -19,6 +19,7 @@ dependencies {
exclude("io.papermc.paper", "paper-api")
}
// Folia end
+ implementation("com.electronwill.night-config:toml:3.6.6") //Luminol - Night config
+ implementation("com.electronwill.night-config:toml:3.6.6") // Luminol - Night config
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Subject: [PATCH] Kaiiju linear region format and settings


diff --git a/build.gradle.kts b/build.gradle.kts
index 0f5e1de926d0317e5467dac1ff68399224b160d4..79454f44cff7ab4967719bcb4deac11b72a9f6f4 100644
index da97cba3fba11e15d08edd72ee2d5485488939db..262afe79d760ff80dc56e977e5462df4dcdb7d3b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -20,6 +20,10 @@ dependencies {
}
// Folia end
implementation("com.electronwill.night-config:toml:3.6.6") //Luminol - Night config
implementation("com.electronwill.night-config:toml:3.6.6") // Luminol - Night config
+ // Kaiiju start - Linear format
+ implementation("com.github.luben:zstd-jni:1.5.4-1")
+ implementation("org.lz4:lz4-java:1.8.0")
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0039-Luminol-Petal-reduce-sensor-work.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Subject: [PATCH] Luminol Petal reduce sensor work


diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 88ab17e273e416006185e024d7f5e9bc381be969..e54e064c80b13d5f13b4bab78c16c6d092681e35 100644
index 88ab17e273e416006185e024d7f5e9bc381be969..e9996a7e29f88dbc4a3ca1bf66a8a98257a44b19 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -929,10 +929,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
return;
}
// Paper end - Allow nerfed mobs to jump and float
+ int i = this.tickCount + this.getId(); // Folia - region threading //Luminol - Petal - Move up
+ int i = this.tickCount + this.getId(); // Folia - region threading // Luminol - Petal - Move up
+
this.level().getProfiler().push("sensing");
- this.sensing.tick();
+ if (i % org.leavesmc.lumina.config.modules.optimizations.PetalReduceSensorWorkConfig.delayTicks == 0 || !org.leavesmc.lumina.config.modules.optimizations.PetalReduceSensorWorkConfig.enabled)this.sensing.tick(); //Luminol - Petal - Reduce sensor work
+ if (i % org.leavesmc.lumina.config.modules.optimizations.PetalReduceSensorWorkConfig.delayTicks == 0 || !org.leavesmc.lumina.config.modules.optimizations.PetalReduceSensorWorkConfig.enabled)this.sensing.tick(); // Luminol - Petal - Reduce sensor work
this.level().getProfiler().pop();
- int i = this.tickCount + this.getId(); // Folia - region threading

Expand Down
8 changes: 4 additions & 4 deletions patches/server/0040-Luminol-Server-mod-name-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ Subject: [PATCH] Luminol Server mod name config


diff --git a/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
index 6ed2114f577ce12d2d493985e798609c7d83f15e..11b12bc139ee95c06f95b6f1700bb6dae252a307 100644
index 6ed2114f577ce12d2d493985e798609c7d83f15e..ef031596b00cf72b0ee12f403d38751d15c9ebb1 100644
--- a/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
+++ b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
@@ -14,7 +14,7 @@ class PaperServerListPingEventImpl extends PaperServerListPingEvent {

PaperServerListPingEventImpl(MinecraftServer server, StatusClient client, int protocolVersion, @Nullable CachedServerIcon icon) {
super(client, server.motd(), server.getPlayerCount(), server.getMaxPlayers(),
- server.getServerModName() + ' ' + server.getServerVersion(), protocolVersion, icon);
+ org.leavesmc.lumina.config.modules.misc.ServerModNameConfig.fakeVanilla ? server.getServerVersion() : server.getServerModName() + ' ' + server.getServerVersion(), protocolVersion, icon);//Luminol - Fake vanilla mode
+ org.leavesmc.lumina.config.modules.misc.ServerModNameConfig.fakeVanilla ? server.getServerVersion() : server.getServerModName() + ' ' + server.getServerVersion(), protocolVersion, icon);// Luminol - Fake vanilla mode
this.server = server;
}

diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ac07133a8b59aec53e547ab3d554ebc99d80480f..ba0f5e23192322a9ea6bfbf20286603559971153 100644
index ac07133a8b59aec53e547ab3d554ebc99d80480f..c0e5c1be928d0c07a264c6ab4c7660bc96b59d93 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1963,7 +1963,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

@DontObfuscate
public String getServerModName() {
- return "Lumina"; // Paper // Folia - Folia // Lumina - Lumina
+ return org.leavesmc.lumina.config.modules.misc.ServerModNameConfig.fakeVanilla ? "vanilla" : org.leavesmc.lumina.config.modules.misc.ServerModNameConfig.serverModName; // Paper // Folia - Folia //Luminol - Luminol //Luminol - Add config for this
+ return org.leavesmc.lumina.config.modules.misc.ServerModNameConfig.fakeVanilla ? "vanilla" : org.leavesmc.lumina.config.modules.misc.ServerModNameConfig.serverModName; // Paper // Folia - Folia // Luminol - Luminol //Luminol - Add config for this
}

public SystemReport fillSystemReport(SystemReport details) {
10 changes: 5 additions & 5 deletions patches/server/0041-Luminol-Unsafe-teleportation-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ Subject: [PATCH] Luminol Unsafe teleportation config


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 781f0e4190975d54ef6cbd62ed3edd297c14436a..7ab7ad69bdf9e43bba42d445bae8a2c4ec6e1cd0 100644
index 781f0e4190975d54ef6cbd62ed3edd297c14436a..fac40e36dedb38618a5f0433905d2243fc84b30c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4090,6 +4090,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S

protected boolean tryEndPortal() {
io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
+ if (org.leavesmc.lumina.config.modules.fixes.UnsafeTeleportationConfig.enabled && !(this instanceof Player)) return false; //Luminol - Unsafe teleportation
+ if (org.leavesmc.lumina.config.modules.fixes.UnsafeTeleportationConfig.enabled && !(this instanceof Player)) return false; // Luminol - Unsafe teleportation
BlockPos pos = this.portalBlock;
ServerLevel world = this.portalWorld;
this.portalBlock = null;
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index afc9445941b984cc1122839e4a8a17cf27aa966e..587c289c768b58cf09a7b766ad17bc66613ba1f0 100644
index afc9445941b984cc1122839e4a8a17cf27aa966e..e1743b42aa77550d5f8c03ade0623a1c231f9f42 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -61,6 +61,13 @@ public class EndPortalBlock extends BaseEntityBlock {
// return; // CraftBukkit - always fire event in case plugins wish to change it
}

+ //Luminol start - Unsafe teleportation
+ // Luminol start - Unsafe teleportation
+ if (org.leavesmc.lumina.config.modules.fixes.UnsafeTeleportationConfig.enabled && !(entity instanceof net.minecraft.world.entity.player.Player)){
+ entity.endPortalLogicAsync();
+ return;
+ }
+ //Luminol end - Unsafe teleportation
+ // Luminol end - Unsafe teleportation
+
// Paper start - move all of this logic into portal tick
entity.portalWorld = ((ServerLevel)world);
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0042-Luminol-void-trading-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Subject: [PATCH] Luminol void trading config


diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9d5d16e8acc559d244e46075106b753633530d89..650300a9cfd25c2b88d27b9a749849b82d8ad345 100644
index 9d5d16e8acc559d244e46075106b753633530d89..3e38deb46b67a2c17be2794b7189d20287e25058 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -3046,7 +3046,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
// Paper start - Fix merchant inventory not closing on entity removal
- if (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null) {
+ if (!org.leavesmc.lumina.config.modules.fixes.VoidTradingFixConfig.enabled && (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null)) { //Luminol - Add config for void trading
+ if (!org.leavesmc.lumina.config.modules.fixes.VoidTradingFixConfig.enabled && (entity.getBukkitEntity() instanceof org.bukkit.inventory.Merchant merchant && merchant.getTrader() != null)) { // Luminol - Add config for void trading
merchant.getTrader().closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED);
}
// Paper end - Fix merchant inventory not closing on entity removal
4 changes: 2 additions & 2 deletions patches/server/0043-Luminol-vanilla-random-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Subject: [PATCH] Luminol vanilla random config


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7ab7ad69bdf9e43bba42d445bae8a2c4ec6e1cd0..2633fb8b27ecfe72c7145d53f240c1d0da54838d 100644
index fac40e36dedb38618a5f0433905d2243fc84b30c..29e8efea2e838ebda08e06631dcda50f31d00365 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -573,7 +573,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;
- this.random = SHARED_RANDOM; // Paper - Share random for entities to make them more random
+ this.random = org.leavesmc.lumina.config.modules.fixes.VanillaRandomSourceConfig.useLegacyRandomSourceForPlayers ? RandomSource.create() : SHARED_RANDOM;//Luminol - Add config for vanilla random SHARED_RANDOM // Paper - Share random for entities to make them more random
+ this.random = org.leavesmc.lumina.config.modules.fixes.VanillaRandomSourceConfig.useLegacyRandomSourceForPlayers ? RandomSource.create() : SHARED_RANDOM;// Luminol - Add config for vanilla random SHARED_RANDOM // Paper - Share random for entities to make them more random
this.remainingFireTicks = -this.getFireImmuneTicks();
this.fluidHeight = new Object2DoubleArrayMap(2);
this.fluidOnEyes = new HashSet();
12 changes: 6 additions & 6 deletions patches/server/0044-Luminol-Chat-sign-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ Subject: [PATCH] Luminol Chat sign config


diff --git a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
index 72a8aa676836fcb3b4578689d16af65e18f55bbe..8c4591c626be8a18de1ccbfd6131918e38111025 100644
index 72a8aa676836fcb3b4578689d16af65e18f55bbe..b2b4154b765934a3ea6ba1e388f364989ad8cb4b 100644
--- a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
+++ b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
@@ -14,9 +14,17 @@ public record ArgumentSignatures(List<ArgumentSignatures.Entry> entries) {
private static final int MAX_ARGUMENT_NAME_LENGTH = 16;

public ArgumentSignatures(FriendlyByteBuf buf) {
- this(buf.readCollection(FriendlyByteBuf.limitValue(ArrayList::new, 8), ArgumentSignatures.Entry::new));
+ this(readSign(buf)); //Luminol - Fix java compile
+ this(readSign(buf)); // Luminol - Fix java compile
}

+ //Luminol start - Add config for chat sign
+ // Luminol start - Add config for chat sign
+ private static List<ArgumentSignatures.Entry> readSign(FriendlyByteBuf buf) {
+ var entries = buf.readCollection(FriendlyByteBuf.limitValue(ArrayList::new, 8), Entry::new);
+ return org.leavesmc.lumina.config.modules.misc.ChatSignConfig.enabled ? List.of() : entries;
+ }
+ //Luminol end
+ // Luminol end
+
+
@Nullable
public MessageSignature get(String argumentName) {
for(ArgumentSignatures.Entry entry : this.entries) {
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index b863249ff7e13cf4939c8961601f0564c62fd661..995c11af702dbdbe93bb825afadbdaadf2b65fcf 100644
index b863249ff7e13cf4939c8961601f0564c62fd661..9f322c04552dcc2249e2544f9bdb8dad19b060f7 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -143,6 +143,16 @@ public class FriendlyByteBuf extends ByteBuf {
Expand All @@ -43,7 +43,7 @@ index b863249ff7e13cf4939c8961601f0564c62fd661..995c11af702dbdbe93bb825afadbdaad
+ this.writeUtf(GSON.toJson(element));
+ return;
+ }
+ //Luminol end
+ // Luminol end
+
this.writeUtf(FriendlyByteBuf.GSON.toJson((JsonElement) Util.getOrThrow(dataresult, (s) -> {
return new EncoderException("Failed to encode: " + s + " " + value);
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0045-Luminol-Username-check-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Subject: [PATCH] Luminol Username check config


diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index aa4b461bbb2c8c4753f7c9057bab1740de2c0284..40562cbbf6ebace1a22593769222cabc97479478 100644
index aa4b461bbb2c8c4753f7c9057bab1740de2c0284..756cf3cf49e0599a6145c4e5c0c3671553db74a3 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -143,7 +143,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@Override
public void handleHello(ServerboundHelloPacket packet) {
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
- if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation && !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) Validate.validState(Player.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); // Paper - config username validation
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation && !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && org.leavesmc.lumina.config.modules.misc.UsernameCheckConfig.enabled) Validate.validState(Player.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); // Paper - config username validation //Luminol - Add config for username check
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation && !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && org.leavesmc.lumina.config.modules.misc.UsernameCheckConfig.enabled) Validate.validState(Player.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); // Paper - config username validation // Luminol - Add config for username check
this.requestedUsername = packet.name();
GameProfile gameprofile = this.server.getSingleplayerProfile();

4 changes: 2 additions & 2 deletions patches/server/0046-Luminol-Offline-mode-warning-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ Subject: [PATCH] Luminol Offline mode warning config


diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 610cb7d398e472973d6b4b5942f4c717d5ce6fa5..30265da65255eccd9cde15bb9c0abe66bec95cc6 100644
index 610cb7d398e472973d6b4b5942f4c717d5ce6fa5..d2ffd78795cf9d4411cd9e73441c7469046b8981 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -282,7 +282,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
// Paper end - Add Velocity IP Forwarding Support
- if (!this.usesAuthentication()) {
+ if (!this.usesAuthentication() && !org.leavesmc.lumina.config.modules.misc.OfflineModeWarningConfig.enabled) { //Luminol - Add config for offline mod warning
+ if (!this.usesAuthentication() && !org.leavesmc.lumina.config.modules.misc.OfflineModeWarningConfig.enabled) { // Luminol - Add config for offline mod warning
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
// Spigot start
Loading

0 comments on commit 2ebfe2c

Please sign in to comment.