9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Refactor: Change upstream to Pufferfish (again)

This commit is contained in:
Dreeam
2023-01-04 02:31:21 -05:00
parent afe946e70f
commit 5b74dce3a8
45 changed files with 692 additions and 337 deletions

View File

@@ -6,12 +6,12 @@
[![Github Actions Build](https://img.shields.io/github/actions/workflow/status/Winds-Studio/Leaf/ver1193.yml?branch=ver%2F1.19.3&style=flat-square)](https://github.com/Winds-Studio/Leaf/actions)
[![MIT License](https://img.shields.io/github/license/Dreeam-qwq/Leaf?style=flat-square)](LICENSE)
<h5>Leaf is a drop-in replacement for <a href="https://github.com/GaleMC/Gale">Gale</a> servers designed for fix some bugs and customize, and performance built on top of <a href="https://github.com/GaleMC/Gale">Gale</a>.</h5>
<h5>Leaf is a drop-in replacement for <a href="https://github.com/pufferfish-gg/Pufferfish">Pufferfish</a> servers designed for fix some bugs and customize, and performance built on top of <a href="https://github.com/pufferfish-gg/Pufferfish">Pufferfish</a>.</h5>
<h8>Logo created by <a href="https://github.com/naiximcn">NaixiNana</a></h8>
</div>
## Features
- Fork of [Gale](https://github.com/GaleMC/Gale) for better performance.
- Fork of [Pufferfish](https://github.com/pufferfish-gg/Pufferfish) for better performance.
- Allowing all characters as username, including Chinese and other characters.
- Allowing players connect to backend server through proxy without enabling bunngecord mode.
- Allowing players use tripwire dupe.
@@ -52,7 +52,7 @@ Yes, this also includes all API provided by Paper, Spigot, and Bukkit.
Credits:
-------------
- [Gale](https://github.com/GaleMC/Gale)
- [Pufferfish](https://github.com/pufferfish-gg/Pufferfish)
- [Gale](https://github.com/GaleMC/Gale)
- [Purpur](https://github.com/PurpurMC/Purpur)
- [KeYi](https://github.com/KeYiMC/KeYi)

View File

@@ -62,13 +62,13 @@ paperweight {
remapRepo.set("https://maven.fabricmc.net/")
decompileRepo.set("https://maven.quiltmc.org/")
useStandardUpstream("Gale") {
url.set(github("GaleMC", "Gale"))
ref.set(providers.gradleProperty("GaleCommit"))
useStandardUpstream("Pufferfish") {
url.set(github("pufferfish-gg", "Pufferfish"))
ref.set(providers.gradleProperty("PufferfishCommit"))
withStandardPatcher {
apiSourceDirPath.set("gale-api")
serverSourceDirPath.set("gale-server")
apiSourceDirPath.set("pufferfish-api")
serverSourceDirPath.set("pufferfish-server")
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("Leaf-API"))

View File

@@ -1,7 +1,7 @@
group = org.dreeam.leaf
version = 1.19.3-R0.1-SNAPSHOT
GaleCommit = 9eec5eae111108ca5cd2ad7bfb562a11a15353b9
PufferfishCommit = 15538a9d3c71687c733c4c6dd94f4b9855917401
org.gradle.caching = true
org.gradle.parallel = true

View File

@@ -5,11 +5,11 @@ Subject: [PATCH] Leaf config files
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 4c519dbd706cac728f31a7ccd99cc1e165812599..425ee736dbaacc0e633740b27723b9f62007be44 100644
index 2204336d8800311b65e894739ab1b27273e7c6f2..39808c0cc23a97f707366378f28ba64b80e6acbb 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2014,6 +2014,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1971,6 +1971,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
// Paper end
+ // Leaf start

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Bump Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
index 33e7179c81310283e5e6efb5fd776a60ae669624..9a7e11e737e12f737d404c6c19e90f055d12d29e 100644
index a995ecc3b1d6181c58d5b4a0a6a893178bdc40aa..63f4b9697415f073937ae08bafb6b8b0b85f174d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -25,13 +25,13 @@ dependencies {
@@ -24,14 +24,16 @@ index 33e7179c81310283e5e6efb5fd776a60ae669624..9a7e11e737e12f737d404c6c19e90f05
apiAndDocs(platform("net.kyori:adventure-bom:$adventureVersion"))
apiAndDocs("net.kyori:adventure-api")
apiAndDocs("net.kyori:adventure-text-minimessage")
@@ -39,17 +39,17 @@ dependencies {
@@ -39,18 +39,18 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
apiAndDocs("net.kyori:adventure-text-serializer-plain")
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
- api("org.apache.logging.log4j:log4j-api:2.17.1")
- api("org.slf4j:slf4j-api:1.8.0-beta4")
- api("io.sentry:sentry:5.4.0") // Pufferfish
+ api("org.apache.logging.log4j:log4j-api:2.19.0")
+ api("org.slf4j:slf4j-api:1.8.0-beta4") // Leaf TODO - Bump later, need to fix breaking compatibility
+ api("io.sentry:sentry:6.10.0") // Pufferfish
- implementation("org.ow2.asm:asm:9.2")
- implementation("org.ow2.asm:asm-commons:9.2")
@@ -49,7 +51,7 @@ index 33e7179c81310283e5e6efb5fd776a60ae669624..9a7e11e737e12f737d404c6c19e90f05
val annotations = "org.jetbrains:annotations:23.0.0" // Paper - we don't want Java 5 annotations...
compileOnly(annotations)
@@ -63,8 +63,8 @@ dependencies {
@@ -64,8 +64,8 @@ dependencies {
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2")
@@ -60,7 +62,7 @@ index 33e7179c81310283e5e6efb5fd776a60ae669624..9a7e11e737e12f737d404c6c19e90f05
}
configure<PublishingExtension> {
@@ -149,6 +149,9 @@ val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.
@@ -147,6 +147,9 @@ val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
classpath.from(configurations.compileClasspath)
}

View File

@@ -27,13 +27,14 @@ index ac9b690fcccb60b587e5345f12f1383afd0a73a1..0a4320b32485db84a0be16535b406f04
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 425ee736dbaacc0e633740b27723b9f62007be44..1ac20245be32a3ab9a869fea7ec321b3de72a86d 100644
index 39808c0cc23a97f707366378f28ba64b80e6acbb..8eb8a788dc3dbc0d5ac24089a57c730089fd8dbe 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2216,4 +2216,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
long getLastTickOversleepTime();
// Gale end - YAPFA - last tick time - API
@@ -2147,4 +2147,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
// Paper end
+
+ // Purpur start
+ /**
+ * Check if server is lagging according to laggy threshold setting
@@ -41,5 +42,5 @@ index 425ee736dbaacc0e633740b27723b9f62007be44..1ac20245be32a3ab9a869fea7ec321b3
+ * @return True if lagging
+ */
+ boolean isLagging();
+ // Purpur endd
+ // Purpur end
}

View File

@@ -24,12 +24,12 @@ index 3b3d9642a8d63798dc28f2f8df77f0466451cbff..8d3605f25e97a375971705c737bc7bac
}
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 7903554958f567c7b566a47fa4b49852a837898e..730394fd53fdaa90133ee399f86e76da8ccc08e6 100644
index c077e7c883613fcb6e559b4e4776e794caa3b363..ba869354adc59db2fc547c481c1ed4d5d0af23b7 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -662,11 +662,15 @@ public final class SimplePluginManager implements PluginManager {
// Gale end - JettPack - skip events without listeners
@@ -656,11 +656,15 @@ public final class SimplePluginManager implements PluginManager {
@Override
public void callEvent(@NotNull Event event) {
// Paper - replace callEvent by merging to below method
- if (event.isAsynchronous() && server.isPrimaryThread()) {
+ // KTP start - optimize spigot event bus
@@ -43,5 +43,5 @@ index 7903554958f567c7b566a47fa4b49852a837898e..730394fd53fdaa90133ee399f86e76da
}
+ // KTP end - optimize spigot event bus
for (RegisteredListener registration : listeners) {
if (!registration.getPlugin().isEnabled()) {
HandlerList handlers = event.getHandlers();
RegisteredListener[] listeners = handlers.getRegisteredListeners();

View File

@@ -7,22 +7,21 @@ Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
index 48312d416805697257e4cd3451b8d14bab7ea252..cfab520664df368cabcfbd925414d227cd352b57 100644
index ab5fea0b03224bf249352ce340e94704ff713345..42288a065acee7e3181364bfadb26d3c1dc6fdc2 100644
--- a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
@@ -17,8 +17,7 @@ public class SIMDChecker {
@Deprecated
public static boolean canEnable(Logger logger, boolean logVectorSizesToConsole) {
try {
- int javaVersion = SIMDDetection.getJavaVersion();
- if (!(javaVersion >= 17 && javaVersion <= 19)) {
+ if (SIMDDetection.getJavaVersion() < 17) { // KeYi - Add Java19 Support for SIMD
return false;
} else {
SIMDDetection.testRun = true;
@@ -41,5 +40,4 @@ public class SIMDChecker {
} catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
return false;
}
-
@@ -15,7 +15,7 @@ public class SIMDChecker {
@Deprecated
public static boolean canEnable(Logger logger) {
try {
- if (SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19) {
+ if (SIMDDetection.getJavaVersion() < 17) { // KeYi - Add Java19 Support for SIMD
return false;
} else {
SIMDDetection.testRun = true;
@@ -36,5 +36,4 @@ public class SIMDChecker {
} catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
return false;
}
-
}

View File

@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index f0302931b082d9a70799d1984dfeb5b0e0973473..2064e3a7bd0fd2a44130999e54b2dcce7be15658 100644
index 9f762cf670bf5db9138e468e72e57781d8d22f54..f8bcea8fa62a63d61fb16a51cf7c05cbe09fc825 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3,6 +3,9 @@ package org.bukkit.entity;
@@ -20,7 +20,7 @@ index f0302931b082d9a70799d1984dfeb5b0e0973473..2064e3a7bd0fd2a44130999e54b2dcce
import com.destroystokyo.paper.ClientOption; // Paper
import com.destroystokyo.paper.Title; // Paper
import net.kyori.adventure.text.Component;
@@ -2913,4 +2916,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2903,4 +2906,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Override
Spigot spigot();
// Spigot end

View File

@@ -5,149 +5,147 @@ Subject: [PATCH] Rebrand
diff --git a/build.gradle.kts b/build.gradle.kts
index f3287cea49ee7352a1065dc65927ab9922d0a9c4..4bd7e9d4344a3abade0d3d3dd1bc7d4005e620f6 100644
index 04a1e3c9619b41f429bd598d55c9e0b5abaff920..c8f031712006d95c59027791be1bdcdc2bd836c4 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,7 +9,7 @@ plugins {
@@ -7,7 +7,7 @@ plugins {
}
dependencies {
// Gale start - project setup
// Depend on own API
- implementation(project(":gale-api"))
+ implementation(project(":leaf-api"))
// Depend on Paper MojangAPI
implementation("io.papermc.paper:paper-mojangapi:1.19.3-R0.1-SNAPSHOT") {
- implementation(project(":pufferfish-api")) // Pufferfish // Paper
+ implementation(project(":leaf-api")) // Paper // Pufferfish // Leaf
// Pufferfish start
implementation("io.papermc.paper:paper-mojangapi:1.19.2-R0.1-SNAPSHOT") {
exclude("io.papermc.paper", "paper-api")
@@ -78,7 +78,7 @@ tasks.jar {
@@ -81,7 +81,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
- "Implementation-Version" to "git-Gale-$implementationVersion", // Gale - branding changes
+ "Implementation-Version" to "git-Leaf-$implementationVersion", // Gale - branding changes // Leaf
- "Implementation-Version" to "git-Pufferfish-$implementationVersion", // Pufferfish
+ "Implementation-Version" to "git-Leaf-$implementationVersion", // Pufferfish // Leaf
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
index e45e6b44b2a8f2cdae6e0048a812b92126aa17ca..b5f3f213da8a40d5184098af017c8e2669c3e58c 100644
index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..bf670b956b20d670f84f1ef76badaae7f0c20e5b 100644
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@Override
protected LineReader buildReader(LineReaderBuilder builder) {
builder
- .appName("Gale") // Gale - branding changes
+ .appName("Leaf") // Gale - branding changes // Leaf
- .appName("Paper")
+ .appName("Leaf") // Leaf
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 60ed76588347f4d4c09d8df4952bf55501ed7c00..78c83a7976966dc5650d8f1e130636cb8c5e3e9f 100644
index 68d16efaf9c2d997afabadcf1ee24c5de685b5b3..c69cb21f2ccf0f93a7ec17d4ee1ddb0ba5cfa5b2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1044,7 +1044,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
We do not want people to report thread issues to Paper,
but we do want people to report thread issues to Gale.
*/
- MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER - If you think this is a Gale bug, please report it at https://github.com/GaleMC/Gale/issues )");
+ MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER - If you think this is a Leaf bug, please report it at https://github.com/Winds-Studio/Leaf/issues )"); // Leaf
// Gale end - branding changes
// Gale start - base thread pools
while (serverThread.isAlive()) {
@@ -1786,7 +1786,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
@@ -924,7 +924,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
if (!isSameThread()) {
- MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER)");
+ MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO LEAF)"); // Leaf
while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop();
try {
@@ -1656,7 +1656,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Gale"; // Gale - branding changes - Gale > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Leaf"; // Leaf - Leaf > // Gale - branding changes - Gale > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
- return "Pufferfish"; // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Leaf"; // Leaf - Leaf > // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 79f3a6174873834de61d7dc9fdbf6eb5a0fd6cd9..e69eca98f341688eca37ad18878c6080fda38563 100644
index 277e8a03ab270eabb6b8c31d0076f3310c91eef2..07b40f503358987339937bb8db5a3ee54c1b08c8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper
@@ -261,7 +261,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Gale"; // Paper // Gale - branding changes
+ private final String serverName = "Leaf"; // Paper // Gale - branding changes // Leaf
- private final String serverName = "Pufferfish"; // Paper // Pufferfish
+ private final String serverName = "Leaf"; // Paper // Pufferfish // Leaf
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 3997a7fec43e05b455644b4d58c68995fad541f4..1933207eb01305ff41822560c5987376b366133f 100644
index cdefb2025eedea7e204d70d568adaf1c1ec4c03c..38920d680d9b0d81013dcf16ce3dd7271eeafe4c 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -504,7 +504,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
//this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Gale"); // Paper // Gale - branding changes
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Leaf"); // Paper // Gale - branding changes // Leaf
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Paper"); // Paper
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Leaf"); // Paper // Leaf
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 0b5979723bb30f9011ac64c36d894aa41713ec9b..17e3ee3a73a2347e9f0baa0ed1640a3b0e75ed16 100644
index 80553face9c70c2a3d897681e7761df85b22d464..3e14c02c2ed3d687c866087bf7477918f45e3719 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
public static String getBukkitVersion() {
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.galemc.gale/gale-api/pom.properties"); // Gale - branding changes
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.dreeam.leaf/leaf-api/pom.properties"); // Gale - branding changes // Leaf
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/gg.pufferfish.pufferfish/pufferfish-api/pom.properties"); // Pufferfish
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.dreeam.leaf/leaf-api/pom.properties"); // Pufferfish // Leaf
Properties properties = new Properties();
if (stream != null) {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 8cd1b04dafc16dc96a6ad58fef7930b351c8f147..c25c1801bc0e29fdea5c6155925dda6567ed1ac3 100644
index e9fa7faaa4451e36b3908cbcbbe0baf213abde96..6466e8bd54b38e4f432101c6d1a397db1066d341 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -161,15 +161,15 @@ public final class WatchdogThread extends ServerThread // Paper - rewrite chunk
We do not want people to report thread issues to Paper,
but we do want people to report thread issues to Gale.
*/
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug. This could be a Gale bug." ); // Paper
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug. This could be a Leaf bug." ); // Paper // Leaf
// Gale end - branding changes
@@ -155,14 +155,14 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
if (isLongTimeout) {
// Paper end
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Leaf bug." ); // Paper // Leaf
log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
- log.log( Level.SEVERE, "If you are unsure or think this is a Gale bug, please report this to https://github.com/GaleMC/Gale/issues - and if you think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" ); // Gale - branding changes
+ log.log( Level.SEVERE, "If you are unsure or think this is a Leaf bug, please report this to https://github.com/Winds-Studio/Leaf/issues - and if you think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" ); // Gale - branding changes // Leaf
- log.log( Level.SEVERE, "If you are unsure or still think this is a Paper bug, please report this to https://github.com/PaperMC/Paper/issues" );
+ log.log( Level.SEVERE, "If you are unsure or still think this is a Leaf bug, please report this to https://github.com/Winds-Studio/Leaf/issues" ); // Leaf
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
- log.log( Level.SEVERE, "Gale version: " + Bukkit.getServer().getVersion() ); // Gale - branding changes
+ log.log( Level.SEVERE, "Leaf version: " + Bukkit.getServer().getVersion() ); // Gale - branding changes // Leaf
- log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() );
+ log.log( Level.SEVERE, "Leaf version: " + Bukkit.getServer().getVersion() ); // Leaf
//
if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
{
@@ -197,13 +197,13 @@ public final class WatchdogThread extends ServerThread // Paper - rewrite chunk
We do not want people to report thread issues to Paper,
but we do want people to report thread issues to Gale.
*/
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - If you think this is a Gale bug, please report it at https://github.com/GaleMC/Gale/issues - THIS IS NOT A PAPER BUG OR CRASH - " + Bukkit.getServer().getVersion() + " ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - If you think this is a Leaf bug, please report it at https://github.com/Winds-Studio/Leaf/issues - THIS IS NOT A PAPER BUG OR CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Leaf
// Gale end - branding changes
@@ -185,12 +185,12 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
// Paper end
} else
{
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO LEAF - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Leaf
log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
}
// Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Gale!):" ); // Paper // Gale - branding changes
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Leaf!):" ); // Paper // Gale - branding changes // Leaf
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Leaf!):" ); // Paper // Leaf
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
this.dumpTickingInfo(); // Paper - log detailed tick information
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.serverThread.getId(), Integer.MAX_VALUE ), log ); // Gale - base thread pools
@@ -224,7 +224,7 @@ public final class WatchdogThread extends ServerThread // Paper - rewrite chunk
We do not want people to report thread issues to Paper,
but we do want people to report thread issues to Gale.
*/
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - If you think this is a Gale bug, please report it at https://github.com/GaleMC/Gale/issues - THIS IS NOT A PAPER BUG OR CRASH ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - If you think this is a Leaf bug, please report it at https://github.com/Winds-Studio/Leaf/issues - THIS IS NOT A PAPER BUG OR CRASH ---"); // Leaf
// Gale end - branding changes
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
@@ -206,7 +206,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
WatchdogThread.dumpThread( thread, log );
}
} else {
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---");
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO LEAF - THIS IS NOT A BUG OR A CRASH ---"); // Leaf
}
log.log( Level.SEVERE, "------------------------------" );
diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png
index a7d785f60c884ee4ee487cc364402d66c3dc2ecc..9597d58066bdbca302d790e6c195204b7d878011 100644
GIT binary patch

View File

@@ -4,54 +4,51 @@ Date: Wed, 12 Oct 2022 10:42:15 -0400
Subject: [PATCH] Leaf Config
diff --git a/build.gradle.kts b/build.gradle.kts
index 4bd7e9d4344a3abade0d3d3dd1bc7d4005e620f6..7a16fb14f43ff4cc8b1b733f924393e60b6978cd 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -52,6 +52,10 @@ dependencies {
testImplementation("org.hamcrest:hamcrest-library:1.3")
implementation("io.netty:netty-all:4.1.77.Final"); // Paper - Bump netty
+ implementation("org.yaml:snakeyaml:1.33") // Leaf - Config
+ implementation("me.carleslc.Simple-YAML:Simple-Yaml:1.8.3") {
+ exclude(group = "org.yaml", module = "snakeyaml")
+ }
}
val craftbukkitPackageVersion = "1_19_R2" // Paper
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
index 781fc0a92f73be73b9313e7bc4eeb2f2ed6ff8ea..b40c03e42e02bca29fe8b107d9382db6e49c1d1e 100644
index 2cc44fbf8e5bd436b6d4e19f6c06b351e750cb31..00f30e047beefe914543718009947ecc60c21790 100644
--- a/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -307,8 +307,9 @@ public class TimingsExport extends Thread {
@@ -242,7 +242,8 @@ public class TimingsExport extends Thread {
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
// Gale start - Gale configuration - include in timings
pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)),
- pair("gale", mapAsJSON(Bukkit.spigot().getGaleConfig(), null))
+ pair("gale", mapAsJSON(Bukkit.spigot().getGaleConfig(), null)),
// Gale end - Gale configuration - include in timings
pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), // Pufferfish
- pair("pufferfish", mapAsJSON(gg.pufferfish.pufferfish.PufferfishConfig.getConfigCopy(), null)) // Pufferfish
+ pair("pufferfish", mapAsJSON(gg.pufferfish.pufferfish.PufferfishConfig.getConfigCopy(), null)), // Pufferfish
+ pair("leaf", mapAsJSON(org.dreeam.leaf.LeafConfig.getConfigCopy(), null)) // Leaf
));
new TimingsExport(listeners, parent, history).start();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c69cb21f2ccf0f93a7ec17d4ee1ddb0ba5cfa5b2..3bed5eb755e97149a9651ca007564275e0eaf2d1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1656,7 +1656,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Leaf"; // Leaf - Leaf > // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return org.dreeam.leaf.LeafConfig.serverModName; // Leaf - Leaf > // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 396258cb21a8e5488f0f456b65dc629ff895601e..290f0e317b75358a14c7c58e9d6e8e7340fd0721 100644
index 673fb3955291407be37dc78be4eec9bf2018128b..a7023765e3c82e70574069af00227e3cf6f98e65 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -248,6 +248,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
LOGGER.warn("If you would like to disable this message, set simd.warn-if-disabled to false in gale-global.yml");
}
// Gale start - Pufferfish - SIMD support
@@ -223,6 +223,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// Paper end
gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish
gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish
+ org.dreeam.leaf.LeafConfig.load(); // Leaf
this.setPvpAllowed(dedicatedserverproperties.pvp);
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..2e6cc6ed30fc2ba0913913bd19bf1b83c40fcce5
index 0000000000000000000000000000000000000000..770553ef8976d76067396276792ea23a7ab7d51d
--- /dev/null
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -0,0 +1,134 @@
@@ -0,0 +1,139 @@
+package org.dreeam.leaf;
+
+import net.minecraft.server.MinecraftServer;
@@ -185,4 +182,9 @@ index 0000000000000000000000000000000000000000..2e6cc6ed30fc2ba0913913bd19bf1b83
+ ensureDefault(key, defaultValue, comment);
+ return config.getStringList(key);
+ }
+
+ public static String serverModName = "Leaf";
+ private static void serverModName() {
+ serverModName = getString("settings.server-mod-name", serverModName);
+ }
+}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Bump Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
index 7a16fb14f43ff4cc8b1b733f924393e60b6978cd..f00b459d52af011c8fcb86521e6a5e8486d92955 100644
index c8f031712006d95c59027791be1bdcdc2bd836c4..99c0750dcc87f5f3b19c5e9e4e9067d49443732e 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -24,13 +24,13 @@ dependencies {
@@ -22,13 +22,13 @@ dependencies {
all its classes to check if they are plugins.
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
@@ -27,7 +27,7 @@ index 7a16fb14f43ff4cc8b1b733f924393e60b6978cd..f00b459d52af011c8fcb86521e6a5e84
implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files
implementation("commons-lang:commons-lang:2.6")
implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
@@ -39,19 +39,19 @@ dependencies {
@@ -37,27 +37,27 @@ dependencies {
isTransitive = false
}
// Paper end
@@ -43,6 +43,16 @@ index 7a16fb14f43ff4cc8b1b733f924393e60b6978cd..f00b459d52af011c8fcb86521e6a5e84
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.2")
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.2")
// Pufferfish start
- implementation("org.yaml:snakeyaml:1.32")
- implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.2") {
+ implementation("org.yaml:snakeyaml:1.33")
+ implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.3") {
exclude(group="org.yaml", module="snakeyaml")
}
// Pufferfish end
implementation("com.github.technove:Flare:34637f3f87") // Pufferfish - flare
- testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
+ testImplementation("io.github.classgraph:classgraph:4.8.152") // Paper - mob goal test
testImplementation("junit:junit:4.13.2")
@@ -51,10 +61,10 @@ index 7a16fb14f43ff4cc8b1b733f924393e60b6978cd..f00b459d52af011c8fcb86521e6a5e84
- implementation("io.netty:netty-all:4.1.77.Final"); // Paper - Bump netty
+ implementation("io.netty:netty-all:4.1.85.Final"); // Paper - Bump netty
implementation("org.yaml:snakeyaml:1.33") // Leaf - Config
implementation("me.carleslc.Simple-YAML:Simple-Yaml:1.8.3") {
exclude(group = "org.yaml", module = "snakeyaml")
@@ -207,3 +207,6 @@ tasks.registerRunTask("runDev") {
}
val craftbukkitPackageVersion = "1_19_R2" // Paper
@@ -206,3 +206,6 @@ tasks.registerRunTask("runDev") {
description = "Spin up a non-relocated Mojang-mapped test server"
classpath(sourceSets.main.map { it.runtimeClasspath })
}

View File

@@ -5,39 +5,45 @@ Subject: [PATCH] Remove Mojang username check
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index af96c170c58553f4ce0554c9bd24fea2ad96ed01..cefd1bcf16368c93462e7734d7195c3dffe5f59a 100644
index f3b340fc6be9878d677a76673450aac3e0b73d4b..3011018c8fa221f515cf670dea9791f8c4ea1f69 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -38,6 +38,7 @@ import net.minecraft.util.CryptException;
@@ -36,6 +36,7 @@ import net.minecraft.util.Crypt;
import net.minecraft.util.CryptException;
import net.minecraft.util.RandomSource;
import org.apache.commons.lang3.Validate;
import org.galemc.gale.configuration.GaleGlobalConfiguration;
+import org.dreeam.leaf.LeafConfig;
import org.slf4j.Logger;
// CraftBukkit start
@@ -243,7 +244,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -237,7 +238,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@Override
public void handleHello(ServerboundHelloPacket packet) {
// Gale start - JettPack - reduce array allocations
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", ArrayConstants.emptyObjectArray);
- Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", ArrayConstants.emptyObjectArray);
+ if (!LeafConfig.removeMojangUsernameCheck) Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", ArrayConstants.emptyObjectArray); // Leaf - Remove Mojang's username check
// Gale end - JettPack - reduce array allocations
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
- Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]);
+ if (!LeafConfig.removeMojangUsernameCheck) Validate.validState(ServerLoginPacketListenerImpl.isValidUsername(packet.name()), "Invalid characters in username", new Object[0]); // Leaf - Remove Mojang's username check
// Paper start - validate usernames
if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) {
if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(packet.name())) {
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 2e6cc6ed30fc2ba0913913bd19bf1b83c40fcce5..ecd5edfde838df1d8f9a58b153c9751bacd2b761 100644
index 770553ef8976d76067396276792ea23a7ab7d51d..7870c85030144831936d692dde4fff7bedd692da 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -131,4 +131,11 @@ public class LeafConfig {
ensureDefault(key, defaultValue, comment);
@@ -132,8 +132,17 @@ public class LeafConfig {
return config.getStringList(key);
}
+
public static String serverModName = "Leaf";
private static void serverModName() {
serverModName = getString("settings.server-mod-name", serverModName);
}
+
+ public static boolean removeMojangUsernameCheck;
+ private static void removeconfig() {
+ removeMojangUsernameCheck = getBoolean("remove-Mojang-username-check", true,
+ "Remove username check of Mojang",
+ "enabling all characters as username");
+
+ }
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Remove Spigot Check for Broken BungeeCord Configurations
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 8e68d1373a519cc12bf83de6aadcb24cbbd34af6..a5776ef739b1bf8c8efed0a97d0939e271c8ba72 100644
index e7ff7ad3bf4dd17fdd34202ec3aef8e9512bc36d..a00c7ba6d2161ce91ade78e3d53c8d57f86e9c99 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -10,6 +10,7 @@ import net.minecraft.network.protocol.handshake.ClientIntentionPacket;
@@ -9,6 +9,7 @@ import net.minecraft.network.protocol.handshake.ClientIntentionPacket;
import net.minecraft.network.protocol.handshake.ServerHandshakePacketListener;
import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket;
import net.minecraft.server.MinecraftServer;
@@ -16,7 +16,7 @@ index 8e68d1373a519cc12bf83de6aadcb24cbbd34af6..a5776ef739b1bf8c8efed0a97d0939e2
// CraftBukkit start
import java.net.InetAddress;
@@ -135,7 +136,9 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -139,7 +140,9 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
{
connection.spoofedProfile = ServerHandshakePacketListenerImpl.gson.fromJson(split[3], com.mojang.authlib.properties.Property[].class);
}
@@ -28,10 +28,17 @@ index 8e68d1373a519cc12bf83de6aadcb24cbbd34af6..a5776ef739b1bf8c8efed0a97d0939e2
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
this.connection.disconnect(chatmessage);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index ecd5edfde838df1d8f9a58b153c9751bacd2b761..14bde244f306e0477cc002cf21868bd3f6783672 100644
index 7870c85030144831936d692dde4fff7bedd692da..c107a0cab333b2b57931862073a4eb6832f755ab 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -133,9 +133,13 @@ public class LeafConfig {
@@ -132,17 +132,19 @@ public class LeafConfig {
return config.getStringList(key);
}
-
public static String serverModName = "Leaf";
private static void serverModName() {
serverModName = getString("settings.server-mod-name", serverModName);
}
public static boolean removeMojangUsernameCheck;
@@ -40,6 +47,7 @@ index ecd5edfde838df1d8f9a58b153c9751bacd2b761..14bde244f306e0477cc002cf21868bd3
removeMojangUsernameCheck = getBoolean("remove-Mojang-username-check", true,
"Remove username check of Mojang",
"enabling all characters as username");
-
+ removeSpigotCheckBungeeConfig = getBoolean("remove-Spigot-check-bungee-config", true,
+ "Enable player enter backend server through proxy",
+ "without backend server enabling its bungee mode");

View File

@@ -7,18 +7,18 @@ This Check is added in 1.17.x -> 1.18.x update by Mojang.
By removing this check, it enable hackers to use some modules of hack clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index deadeb7a98e5b64d7b9fae3a9e7858a4cd1d39e2..7643f8a3aa22c8d58ce74a18efe3d98f5017d04c 100644
index 34540b4ebad2ec430fa12e1e5d9d6e4a79df91de..84cb548e89350d9127b18f69e47d1f7433bcb1ee 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -189,6 +189,7 @@ import org.apache.commons.lang3.StringUtils;
import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.galemc.gale.executor.queue.BaseTaskQueues;
import org.galemc.gale.executor.queue.ScheduledServerThreadTaskQueues;
@@ -182,6 +182,7 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
+import org.dreeam.leaf.LeafConfig;
import org.slf4j.Logger;
// CraftBukkit start
@@ -1980,7 +1981,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1948,7 +1949,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
Vec3 vec3d2 = vec3d.subtract(vec3d1);
double d0 = 1.0000001D;
@@ -28,10 +28,10 @@ index deadeb7a98e5b64d7b9fae3a9e7858a4cd1d39e2..7643f8a3aa22c8d58ce74a18efe3d98f
this.player.resetLastActionTime();
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 14bde244f306e0477cc002cf21868bd3f6783672..5922be781760baedfb3a770c9e1ca40a73dfbc55 100644
index c107a0cab333b2b57931862073a4eb6832f755ab..a221affdf87d28991248a4b83224194e222423e6 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -134,6 +134,8 @@ public class LeafConfig {
@@ -139,6 +139,8 @@ public class LeafConfig {
public static boolean removeMojangUsernameCheck;
public static boolean removeSpigotCheckBungeeConfig;
@@ -40,7 +40,7 @@ index 14bde244f306e0477cc002cf21868bd3f6783672..5922be781760baedfb3a770c9e1ca40a
private static void removeconfig() {
removeMojangUsernameCheck = getBoolean("remove-Mojang-username-check", true,
"Remove username check of Mojang",
@@ -141,5 +143,7 @@ public class LeafConfig {
@@ -146,5 +148,7 @@ public class LeafConfig {
removeSpigotCheckBungeeConfig = getBoolean("remove-Spigot-check-bungee-config", true,
"Enable player enter backend server through proxy",
"without backend server enabling its bungee mode");

View File

@@ -54,10 +54,10 @@ index ae5dd08de75a7ed231295f306fd0974da3988249..b8d49f7607c646216d42f4e047997d47
if (this.source.acceptsSuccess() && !this.silent) {
this.source.sendSystemMessage(message);
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index c7083450b3466d80611b5efdac78b31ac2e70cf5..0e8700ccc884957f08fa382723a3784d94da0f0e 100644
index 330f6c79417378da855326b4da665f9d240e748d..564830a1d511716ab977923ba43fa38c475f484f 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -214,6 +214,7 @@ public class Commands {
@@ -215,6 +215,7 @@ public class Commands {
SetPlayerIdleTimeoutCommand.register(this.dispatcher);
StopCommand.register(this.dispatcher);
WhitelistCommand.register(this.dispatcher);
@@ -66,10 +66,10 @@ index c7083450b3466d80611b5efdac78b31ac2e70cf5..0e8700ccc884957f08fa382723a3784d
if (environment.includeIntegrated) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 78c83a7976966dc5650d8f1e130636cb8c5e3e9f..d5e8de2fd68dbc43385ad71849294f20344385f5 100644
index 3bed5eb755e97149a9651ca007564275e0eaf2d1..ab0a4a36241bee59b142df65736003c69dcb3dd4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1141,6 +1141,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
@@ -1022,6 +1022,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.safeShutdown(waitForShutdown, false);
}
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
@@ -78,30 +78,30 @@ index 78c83a7976966dc5650d8f1e130636cb8c5e3e9f..d5e8de2fd68dbc43385ad71849294f20
this.hasLoggedStop = true; // Paper
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 290f0e317b75358a14c7c58e9d6e8e7340fd0721..0e7fae39da20478a2b0ff9ba5430d54f11b8fc3b 100644
index a7023765e3c82e70574069af00227e3cf6f98e65..598d0200c055ef357a0a0d8857ce740d0bff9bae 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -51,6 +51,7 @@ import org.galemc.gale.command.GaleCommands;
import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.galemc.gale.executor.thread.OriginalServerThread;
import org.galemc.gale.util.CPUCoresEstimation;
@@ -50,6 +50,7 @@ import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.block.entity.SkullBlockEntity;
import net.minecraft.world.level.storage.LevelStorageSource;
+import org.dreeam.leaf.tasks.BossBarTask;
import org.slf4j.Logger;
// CraftBukkit start
@@ -360,6 +361,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.info("JMX monitoring enabled");
@@ -336,6 +337,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
if (gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) mobSpawnExecutor.start(); // Pufferfish
+ BossBarTask.startAll(); // Purpur
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index e6c2eff84ac596825a11574cf89956e70a344562..66082298aea31d17c8e9a85e3cca1951b2d53f87 100644
index 7d6d3c8556033d289fdadc489e73fba478fce41a..d4ae8fc06ac5931273e6ced45158d8a3144a0bdf 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -269,6 +269,7 @@ public class ServerPlayer extends Player {
@@ -268,6 +268,7 @@ public class ServerPlayer extends Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
@@ -109,7 +109,7 @@ index e6c2eff84ac596825a11574cf89956e70a344562..66082298aea31d17c8e9a85e3cca1951
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -507,6 +508,7 @@ public class ServerPlayer extends Player {
@@ -506,6 +507,7 @@ public class ServerPlayer extends Player {
}
}
@@ -117,7 +117,7 @@ index e6c2eff84ac596825a11574cf89956e70a344562..66082298aea31d17c8e9a85e3cca1951
}
@Override
@@ -573,6 +575,7 @@ public class ServerPlayer extends Player {
@@ -572,6 +574,7 @@ public class ServerPlayer extends Player {
}
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
@@ -125,7 +125,7 @@ index e6c2eff84ac596825a11574cf89956e70a344562..66082298aea31d17c8e9a85e3cca1951
}
// CraftBukkit start - World fallback code, either respawn location or global spawn
@@ -2551,4 +2554,14 @@ public class ServerPlayer extends Player {
@@ -2548,4 +2551,14 @@ public class ServerPlayer extends Player {
return (CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end
@@ -141,26 +141,26 @@ index e6c2eff84ac596825a11574cf89956e70a344562..66082298aea31d17c8e9a85e3cca1951
+ // Purpur end
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index fe87ef6e0540bf81518fa01ca2c3516c95c2fb53..3bff74a3eef63debf61f76cc859e157f8ca59d7a 100644
index c0b599b1835d28ddda3690b29f29bd8c6f03e215..8717915fdcfcf7220847a1391863a7a81f7d4738 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -105,6 +105,7 @@ import net.minecraft.world.scores.Scoreboard; // Paper
@@ -100,6 +100,7 @@ import net.minecraft.world.scores.Objective;
import net.minecraft.world.scores.PlayerTeam;
import net.minecraft.world.scores.Scoreboard; // Paper
import net.minecraft.world.scores.Team;
import org.galemc.gale.configuration.GaleGlobalConfiguration;
import org.galemc.gale.executor.queue.ScheduledServerThreadTaskQueues;
+import org.dreeam.leaf.tasks.BossBarTask;
import org.slf4j.Logger;
// CraftBukkit start
@@ -515,6 +516,7 @@ public abstract class PlayerList {
@@ -449,6 +450,7 @@ public abstract class PlayerList {
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
}
// Paper end
+ BossBarTask.addToAll(player); // Purpur
// CraftBukkit - Moved from above, added world
if (GaleGlobalConfiguration.get().logToConsole.playerLoginLocations) { // Gale - JettPack - make logging login location configurable
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
@@ -630,6 +632,8 @@ public abstract class PlayerList {
}
@@ -558,6 +560,8 @@ public abstract class PlayerList {
}
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
// Paper end
@@ -182,7 +182,7 @@ index 6035af2cf08353b3d3801220d8116d8611a0cd37..7774ab6a2e553a40def4bb4dceea9e5f
final String commandName;
if (vanillaCommand.getRedirect() == null) {
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 5922be781760baedfb3a770c9e1ca40a73dfbc55..9cf4bbde93ad01da842f6b3b5f46f25f442f7d54 100644
index a221affdf87d28991248a4b83224194e222423e6..a0bd1ec3f09959c7f72b484658c1c94a16818281 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -1,8 +1,10 @@
@@ -196,7 +196,7 @@ index 5922be781760baedfb3a770c9e1ca40a73dfbc55..9cf4bbde93ad01da842f6b3b5f46f25f
import org.jetbrains.annotations.Nullable;
import org.simpleyaml.configuration.comments.CommentType;
import org.simpleyaml.configuration.file.YamlFile;
@@ -144,6 +146,36 @@ public class LeafConfig {
@@ -149,6 +151,36 @@ public class LeafConfig {
"Enable player enter backend server through proxy",
"without backend server enabling its bungee mode");
removeUseItemOnPacketTooFar = getBoolean("remove-UseItemOnPacket-too-far-check", false,

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 0e8700ccc884957f08fa382723a3784d94da0f0e..66242833210ae89cbca7448cd4e7cf1fa774bcf0 100644
index 564830a1d511716ab977923ba43fa38c475f484f..2c5afab3cc0c66a2e63c1f647a033ca1a58f9e39 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -215,6 +215,7 @@ public class Commands {
@@ -216,6 +216,7 @@ public class Commands {
StopCommand.register(this.dispatcher);
WhitelistCommand.register(this.dispatcher);
org.dreeam.leaf.commands.TPSBarCommand.register(this.dispatcher); // Purpur
@@ -19,10 +19,10 @@ index 0e8700ccc884957f08fa382723a3784d94da0f0e..66242833210ae89cbca7448cd4e7cf1f
if (environment.includeIntegrated) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 66082298aea31d17c8e9a85e3cca1951b2d53f87..d1fd3eb9e51ace68d3ffc24579cdf95ebdaea039 100644
index d4ae8fc06ac5931273e6ced45158d8a3144a0bdf..336691038e2b1a68e1cd40d7015d42acceb2b069 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -270,6 +270,7 @@ public class ServerPlayer extends Player {
@@ -269,6 +269,7 @@ public class ServerPlayer extends Player {
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
private boolean tpsBar = false; // Purpur
@@ -30,7 +30,7 @@ index 66082298aea31d17c8e9a85e3cca1951b2d53f87..d1fd3eb9e51ace68d3ffc24579cdf95e
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -509,6 +510,7 @@ public class ServerPlayer extends Player {
@@ -508,6 +509,7 @@ public class ServerPlayer extends Player {
}
if (nbt.contains("Purpur.TPSBar")) { this.tpsBar = nbt.getBoolean("Purpur.TPSBar"); } // Purpur
@@ -38,7 +38,7 @@ index 66082298aea31d17c8e9a85e3cca1951b2d53f87..d1fd3eb9e51ace68d3ffc24579cdf95e
}
@Override
@@ -576,6 +578,7 @@ public class ServerPlayer extends Player {
@@ -575,6 +577,7 @@ public class ServerPlayer extends Player {
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
nbt.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur
@@ -46,7 +46,7 @@ index 66082298aea31d17c8e9a85e3cca1951b2d53f87..d1fd3eb9e51ace68d3ffc24579cdf95e
}
// CraftBukkit start - World fallback code, either respawn location or global spawn
@@ -2563,5 +2566,13 @@ public class ServerPlayer extends Player {
@@ -2560,5 +2563,13 @@ public class ServerPlayer extends Player {
public void tpsBar(boolean tpsBar) {
this.tpsBar = tpsBar;
}
@@ -61,10 +61,10 @@ index 66082298aea31d17c8e9a85e3cca1951b2d53f87..d1fd3eb9e51ace68d3ffc24579cdf95e
// Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 9cf4bbde93ad01da842f6b3b5f46f25f442f7d54..22ed437840fd189cc0c26b544b78a66c62ffbf3b 100644
index a0bd1ec3f09959c7f72b484658c1c94a16818281..e56151fe0dbc0c867dff728a55daa35c7714d3a6 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -165,6 +165,11 @@ public class LeafConfig {
@@ -170,6 +170,11 @@ public class LeafConfig {
public static String commandTPSBarTextColorMedium = "<gradient:#ffff55:#ffaa00><text></gradient>";
public static String commandTPSBarTextColorLow = "<gradient:#ff5555:#aa0000><text></gradient>";
public static int commandTPSBarTickInterval = 20;
@@ -76,7 +76,7 @@ index 9cf4bbde93ad01da842f6b3b5f46f25f442f7d54..22ed437840fd189cc0c26b544b78a66c
private static void commandSettings() {
commandTPSBarTitle = getString("settings.command.tpsbar.title", commandTPSBarTitle);
@@ -177,5 +182,17 @@ public class LeafConfig {
@@ -182,5 +187,17 @@ public class LeafConfig {
commandTPSBarTextColorMedium = getString("settings.command.tpsbar.text-color.medium", commandTPSBarTextColorMedium);
commandTPSBarTextColorLow = getString("settings.command.tpsbar.text-color.low", commandTPSBarTextColorLow);
commandTPSBarTickInterval = getInt("settings.command.tpsbar.tick-interval", commandTPSBarTickInterval);

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 66242833210ae89cbca7448cd4e7cf1fa774bcf0..ff19fcd83295c6936dd83c7780d5757071ca44a5 100644
index 2c5afab3cc0c66a2e63c1f647a033ca1a58f9e39..8ee8ff15f4511684261ff7a9417baa2ccd313b69 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -216,6 +216,8 @@ public class Commands {
@@ -217,6 +217,8 @@ public class Commands {
WhitelistCommand.register(this.dispatcher);
org.dreeam.leaf.commands.TPSBarCommand.register(this.dispatcher); // Purpur
org.dreeam.leaf.commands.CompassCommand.register(this.dispatcher); // Purpur
@@ -20,10 +20,10 @@ index 66242833210ae89cbca7448cd4e7cf1fa774bcf0..ff19fcd83295c6936dd83c7780d57570
if (environment.includeIntegrated) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d1fd3eb9e51ace68d3ffc24579cdf95ebdaea039..1b92480529c4436efe3d3b293a7af1fa95457a9d 100644
index 336691038e2b1a68e1cd40d7015d42acceb2b069..cdcd1358ab8781c261c97aec03bb96118eb577f7 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -271,6 +271,7 @@ public class ServerPlayer extends Player {
@@ -270,6 +270,7 @@ public class ServerPlayer extends Player {
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
private boolean tpsBar = false; // Purpur
private boolean compassBar = false; // Purpur
@@ -31,7 +31,7 @@ index d1fd3eb9e51ace68d3ffc24579cdf95ebdaea039..1b92480529c4436efe3d3b293a7af1fa
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -509,6 +510,7 @@ public class ServerPlayer extends Player {
@@ -508,6 +509,7 @@ public class ServerPlayer extends Player {
}
}
@@ -39,7 +39,7 @@ index d1fd3eb9e51ace68d3ffc24579cdf95ebdaea039..1b92480529c4436efe3d3b293a7af1fa
if (nbt.contains("Purpur.TPSBar")) { this.tpsBar = nbt.getBoolean("Purpur.TPSBar"); } // Purpur
if (nbt.contains("Purpur.CompassBar")) { this.compassBar = nbt.getBoolean("Purpur.CompassBar"); } // Purpur
}
@@ -577,6 +579,7 @@ public class ServerPlayer extends Player {
@@ -576,6 +578,7 @@ public class ServerPlayer extends Player {
}
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
@@ -47,7 +47,7 @@ index d1fd3eb9e51ace68d3ffc24579cdf95ebdaea039..1b92480529c4436efe3d3b293a7af1fa
nbt.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur
nbt.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur
}
@@ -2574,5 +2577,14 @@ public class ServerPlayer extends Player {
@@ -2571,5 +2574,14 @@ public class ServerPlayer extends Player {
public void compassBar(boolean compassBar) {
this.compassBar = compassBar;
}
@@ -63,10 +63,10 @@ index d1fd3eb9e51ace68d3ffc24579cdf95ebdaea039..1b92480529c4436efe3d3b293a7af1fa
// Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 22ed437840fd189cc0c26b544b78a66c62ffbf3b..84dfe93de52d81e8eef8fc6b9778e081c9abe899 100644
index e56151fe0dbc0c867dff728a55daa35c7714d3a6..afdee99c7d5ecedf8d2f6856f0aa9271c6bbb23d 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -170,6 +170,17 @@ public class LeafConfig {
@@ -175,6 +175,17 @@ public class LeafConfig {
public static BossBar.Color commandCompassBarProgressColor = BossBar.Color.BLUE;
public static float commandCompassBarProgressPercent = 1.0F;
public static int commandCompassBarTickInterval = 5;
@@ -84,7 +84,7 @@ index 22ed437840fd189cc0c26b544b78a66c62ffbf3b..84dfe93de52d81e8eef8fc6b9778e081
private static void commandSettings() {
commandTPSBarTitle = getString("settings.command.tpsbar.title", commandTPSBarTitle);
@@ -189,6 +200,17 @@ public class LeafConfig {
@@ -194,6 +205,17 @@ public class LeafConfig {
commandCompassBarProgressPercent = (float) getDouble("settings.command.compass.percent", commandCompassBarProgressPercent);
commandCompassBarTickInterval = getInt("settings.command.compass.tick-interval", commandCompassBarTickInterval);

View File

@@ -7,18 +7,18 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d5e8de2fd68dbc43385ad71849294f20344385f5..6a16837facde1e903cdf203329798f8386a328d3 100644
index ab0a4a36241bee59b142df65736003c69dcb3dd4..411fae7132b1d1763712594a18cff10d612cef7e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -421,6 +421,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
@@ -305,6 +305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
public final GaleConfigurations galeConfigurations; // Gale - Gale configuration
public static long currentTickLong = 0L; // Paper
+ public boolean lagging = false; // Purpur
public volatile Thread shutdownThread; // Paper
public volatile boolean abnormalExit = false; // Paper
@@ -1286,6 +1287,7 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
@@ -1159,6 +1160,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.recentTps[1] = tps5.getAverage();
this.recentTps[2] = tps15.getAverage();
// Paper end
@@ -27,13 +27,14 @@ index d5e8de2fd68dbc43385ad71849294f20344385f5..6a16837facde1e903cdf203329798f83
}
// Spigot end
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e69eca98f341688eca37ad18878c6080fda38563..4f074f27751e37cc0f9d686b981205c1edf58ed7 100644
index 07b40f503358987339937bb8db5a3ee54c1b08c8..faff1f560eef2429621b4b0a4d760f9a558dcb73 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -3001,4 +3001,10 @@ public final class CraftServer implements Server {
@@ -2943,4 +2943,11 @@ public final class CraftServer implements Server {
}
// Gale end - YAPFA - last tick time - API
// Paper end
+
+ // Purpur start
+ @Override
+ public boolean isLagging() {
@@ -42,10 +43,10 @@ index e69eca98f341688eca37ad18878c6080fda38563..4f074f27751e37cc0f9d686b981205c1
+ // Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 84dfe93de52d81e8eef8fc6b9778e081c9abe899..1c5251af6906621cc6dc5dc1cdaf0715bfbf7a28 100644
index afdee99c7d5ecedf8d2f6856f0aa9271c6bbb23d..a723d5a6bb69543072b8e9a7082ba3f0e89d453e 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -217,4 +217,9 @@ public class LeafConfig {
@@ -222,4 +222,9 @@ public class LeafConfig {
private static void itemSettings() {
compassItemShowsBossBar = getBoolean("gameplay-mechanics.item.compass.holding-shows-bossbar", compassItemShowsBossBar);
}

View File

@@ -7,13 +7,13 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6a16837facde1e903cdf203329798f8386a328d3..984b089280fbec936ecc33a15e7f108ab205d64e 100644
index 411fae7132b1d1763712594a18cff10d612cef7e..75daffc4eaa831708f1ccfa5370ddf1871998033 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1299,6 +1299,13 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
this.tickServer(this::haveTime);
lastTickProperTime = (System.nanoTime() - tickProperStart) / 1000000L; // Gale - YAPFA - last tick time
this.setDelayedTasksMaxNextTickTime(Math.max(Util.getMillis() + 50L, this.nextTickTime)); // Gale - base thread pools
@@ -1179,6 +1179,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
+ // Purpur start - tps catchup
+ if (org.dreeam.leaf.LeafConfig.tpsCatchup) {
+ this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
@@ -22,13 +22,13 @@ index 6a16837facde1e903cdf203329798f8386a328d3..984b089280fbec936ecc33a15e7f108a
+ }
+ // Purpur end - tps catchup
this.waitUntilNextTick();
this.isReady = true;
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
this.profiler.pop();
this.endMetricsRecordingTick();
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 1c5251af6906621cc6dc5dc1cdaf0715bfbf7a28..29ca6f9ac23492485f0a54f76176a68e44fed464 100644
index a723d5a6bb69543072b8e9a7082ba3f0e89d453e..66092bc87472278898743971dd80244cb750297e 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -222,4 +222,9 @@ public class LeafConfig {
@@ -227,4 +227,9 @@ public class LeafConfig {
private static void tickLoopSettings() {
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
}

View File

@@ -29,10 +29,10 @@ index 5c6aa9c464784ad5ee366412d080c72d3d22a76f..35d819aa2e660263cf6a5a0c09a6e73f
return true;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0ab14271e6efebe49ed9fec904e47566691b9f40..b5e887258bee7de80a9b1d06da030b1d7d07ddc6 100644
index edd2c236ca7c37e1a3aec0048b8974f4cd62f2cc..62aff29485f124880739e7d2b5fb0d8a9d957741 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1616,4 +1616,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1635,4 +1635,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return null;
}
// Paper end
@@ -70,10 +70,10 @@ index 64206d94a5bf210116d208f9678618b905a61428..fbb06c5db6f80008a54563b7d959e55e
} else {
world.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState());
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 29ca6f9ac23492485f0a54f76176a68e44fed464..edf6e54199fddac72013c5a88bdb6402fc5b8300 100644
index 66092bc87472278898743971dd80244cb750297e..06664bb40fe4b55998e7a0957cbb4b9fa4f8b05f 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -227,4 +227,9 @@ public class LeafConfig {
@@ -232,4 +232,9 @@ public class LeafConfig {
private static void tpsCatchup() {
tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup);
}

View File

@@ -46,10 +46,10 @@ index 7304b2659eb45bc4bc9fa7c43e6ca07221d0fc73..35a69bb50bc0575dd4f285cc9499d085
}
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index edf6e54199fddac72013c5a88bdb6402fc5b8300..03e13e1edc09c129b2fad64d34a8ef0a9f4de8c4 100644
index 06664bb40fe4b55998e7a0957cbb4b9fa4f8b05f..680ada855140ad86c5c953c7357fc745b308b334 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -232,4 +232,11 @@ public class LeafConfig {
@@ -237,4 +237,11 @@ public class LeafConfig {
private static void allowWaterPlacementInEnd() {
allowWaterPlacementInTheEnd = getBoolean("settings.allow-water-placement-in-the-end", allowWaterPlacementInTheEnd);
}

View File

@@ -38,10 +38,10 @@ index 744d91546d1a810f60a43c15ed74b4158f341a4a..460609a50d0f68c191f0fd529a7dc582
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 03e13e1edc09c129b2fad64d34a8ef0a9f4de8c4..1a33b9ca3b7550b2c7f279c0ac599eddaaa07eb6 100644
index 680ada855140ad86c5c953c7357fc745b308b334..e04d0dc3ed108edee9b8cabea56f86556ac9fb78 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -239,4 +239,9 @@ public class LeafConfig {
@@ -244,4 +244,9 @@ public class LeafConfig {
spongeAbsorptionArea = getInt("blocks.sponge.absorption.area", spongeAbsorptionArea);
spongeAbsorptionRadius = getInt("blocks.sponge.absorption.radius", spongeAbsorptionRadius);
}

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 5ba0a756d45350dcda3caa5518c9a47a4de06f14..e438597242adc99e88f465231a043ea25eec4ba1 100644
index a0c19503aabab5378d672a30163d35a5ba05b6c1..0b089a2032d468532a40e81cb0e9eda4cf184ad0 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -298,6 +298,7 @@ public class PlayerAdvancements {
@@ -297,6 +297,7 @@ public class PlayerAdvancements {
advancement.getRewards().grant(this.player);
// Paper start - Add Adventure message to PlayerAdvancementDoneEvent
if (message != null && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
@@ -19,10 +19,10 @@ index 5ba0a756d45350dcda3caa5518c9a47a4de06f14..e438597242adc99e88f465231a043ea2
// Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 1b92480529c4436efe3d3b293a7af1fa95457a9d..2c2262a2babd4fd5ca22b4630c1f0ae5e3a1a9ab 100644
index cdcd1358ab8781c261c97aec03bb96118eb577f7..d46f33d9bc99484297270f88e68c1519922cb7db 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -948,6 +948,7 @@ public class ServerPlayer extends Player {
@@ -947,6 +947,7 @@ public class ServerPlayer extends Player {
}));
Team scoreboardteambase = this.getTeam();
@@ -30,7 +30,7 @@ index 1b92480529c4436efe3d3b293a7af1fa95457a9d..2c2262a2babd4fd5ca22b4630c1f0ae5
if (scoreboardteambase != null && scoreboardteambase.getDeathMessageVisibility() != Team.Visibility.ALWAYS) {
if (scoreboardteambase.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
this.server.getPlayerList().broadcastSystemToTeam(this, ichatbasecomponent);
@@ -1744,6 +1745,26 @@ public class ServerPlayer extends Player {
@@ -1747,6 +1748,26 @@ public class ServerPlayer extends Player {
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -58,10 +58,10 @@ index 1b92480529c4436efe3d3b293a7af1fa95457a9d..2c2262a2babd4fd5ca22b4630c1f0ae5
public void displayClientMessage(Component message, boolean overlay) {
this.sendSystemMessage(message, overlay);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 2a678c1140bbd6d9d608e9633cac6bb31613a380..bfa183cc584c018005d57a64f2860686f1a5e538 100644
index 8717915fdcfcf7220847a1391863a7a81f7d4738..5f9a70be89131624021e7b1623b54bf22ae6d19e 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1125,6 +1125,20 @@ public abstract class PlayerList {
@@ -1011,6 +1011,20 @@ public abstract class PlayerList {
}
// CraftBukkit end
@@ -103,10 +103,10 @@ index 2848cb7c76e94d8349f042dc92daf01322a6ce5a..0edf0e24b0b311269b447a34f3aad485
return this.isFireSource;
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5133905fbde6c507983554830413738dae09a269..1b6cbf4382324f5c8058b48527f7e9b4a3272036 100644
index 6a9c0f0b4b749c5907a274d6a83254284d8763bb..3961f66a23508089df8c4ee7455e170cb870e9d0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3877,6 +3877,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3863,6 +3863,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return SlotAccess.NULL;
}
@@ -128,10 +128,10 @@ index 5133905fbde6c507983554830413738dae09a269..1b6cbf4382324f5c8058b48527f7e9b4
public void sendSystemMessage(Component message) {}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 1a33b9ca3b7550b2c7f279c0ac599eddaaa07eb6..fee7c2e2b2189e9b0751d2fa994a2acc9a27faff 100644
index e04d0dc3ed108edee9b8cabea56f86556ac9fb78..040c1f584c525990ec844cba9f01df5b33fa2a37 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -244,4 +244,11 @@ public class LeafConfig {
@@ -249,4 +249,11 @@ public class LeafConfig {
private static void pistonSettings() {
pistonBlockPushLimit = getInt("blocks.piston.block-push-limit", pistonBlockPushLimit);
}

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 75c85f04010870fda2f8b71fc8256c0071f46d31..8ee0702d6d57387d74dde2d8165eb9040a58fc76 100644
index 5f9a70be89131624021e7b1623b54bf22ae6d19e..55418d3e366bca06b917ed977cb4f2b99a6c7250 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -788,7 +788,7 @@ public abstract class PlayerList {
@@ -715,7 +715,7 @@ public abstract class PlayerList {
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure
} else {
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null;

View File

@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
index bf62750c31ffba6c2aa4f6d17c1c71c62385e584..d3195be103d45ddf33cda3d817107321b535e495 100644
index 1572a81ce1718964d795f2a2a411402f88901c73..ae2c84af8baaf1bba9b0debe3774321417d77413 100644
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
@@ -246,7 +246,7 @@ public class Bat extends AmbientCreature {
@@ -19,14 +19,14 @@ index bf62750c31ffba6c2aa4f6d17c1c71c62385e584..d3195be103d45ddf33cda3d817107321
b0 = 7;
} else if (random.nextBoolean()) {
return false;
@@ -292,6 +292,7 @@ public class Bat extends AmbientCreature {
// Gale end - predict Halloween
@@ -260,6 +260,7 @@ public class Bat extends AmbientCreature {
private static boolean isSpookySeason = false;
private static final int ONE_HOUR = 20 * 60 * 60;
private static int lastSpookyCheck = -ONE_HOUR;
+ public static boolean isHalloweenSeason(Level level) { return org.dreeam.leaf.LeafConfig.forceHalloweenSeason || isHalloween(); } // Purpur
private static boolean isHalloween() {
// Gale start - predict Halloween
long currentEpochMillis = System.currentTimeMillis();
if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
LocalDate localdate = LocalDate.now();
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index b8abee145fc92faddef98da913eca7715b6bfc03..41de63fdcfe48c2a77f2d04e5bffbca41c98afe3 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -62,10 +62,10 @@ index 9976205537cfe228735687f1e9c52c74ac025690..dfe4c6d2bf9bee2e019635d02f01dc08
this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F;
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index fee7c2e2b2189e9b0751d2fa994a2acc9a27faff..22df3540dd06ba049640e9bac90c23c095a07384 100644
index 040c1f584c525990ec844cba9f01df5b33fa2a37..2855f8c4684cb9afee1bd8a4c2ae82d45ef1ea2b 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -251,4 +251,11 @@ public class LeafConfig {
@@ -256,4 +256,11 @@ public class LeafConfig {
advancementOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.advancement.only-broadcast-to-affected-player", advancementOnlyBroadcastToAffectedPlayer);
deathMessageOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.death.only-broadcast-to-affected-player", deathMessageOnlyBroadcastToAffectedPlayer);
}

View File

@@ -40,10 +40,10 @@ index b0204af850ee182773ad458208cccd946ad148d5..f74e420b1791df528a30a1213bb0076b
@Nullable
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 39981cd0003eb7ee416d887ffec70fb049599320..a5a1773109123c3499d6b2b02b76805d66764ec5 100644
index 7b71073027f4cf79736546500ededdfbb83d968e..98c9c1899a311e76179f72fa1c43830fb5b9c521 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -65,6 +65,13 @@ import net.minecraft.world.phys.shapes.Shapes;
@@ -63,6 +63,13 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.slf4j.Logger;
@@ -57,7 +57,7 @@ index 39981cd0003eb7ee416d887ffec70fb049599320..a5a1773109123c3499d6b2b02b76805d
public class Block extends BlockBehaviour implements ItemLike {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -328,7 +335,7 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -325,7 +332,7 @@ public class Block extends BlockBehaviour implements ItemLike {
public static void dropResources(BlockState state, LevelAccessor world, BlockPos pos, @Nullable BlockEntity blockEntity) {
if (world instanceof ServerLevel) {
Block.getDrops(state, (ServerLevel) world, pos, blockEntity).forEach((itemstack) -> {
@@ -66,7 +66,7 @@ index 39981cd0003eb7ee416d887ffec70fb049599320..a5a1773109123c3499d6b2b02b76805d
});
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY, true);
}
@@ -344,7 +351,7 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -341,7 +348,7 @@ public class Block extends BlockBehaviour implements ItemLike {
io.papermc.paper.event.block.BlockBreakBlockEvent event = new io.papermc.paper.event.block.BlockBreakBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.block.CraftBlock.at(world, source), items);
event.callEvent();
for (var drop : event.getDrops()) {
@@ -75,7 +75,7 @@ index 39981cd0003eb7ee416d887ffec70fb049599320..a5a1773109123c3499d6b2b02b76805d
}
state.spawnAfterBreak(world.getMinecraftWorld(), pos, ItemStack.EMPTY, true);
}
@@ -355,13 +362,53 @@ public class Block extends BlockBehaviour implements ItemLike {
@@ -352,13 +359,53 @@ public class Block extends BlockBehaviour implements ItemLike {
public static void dropResources(BlockState state, Level world, BlockPos pos, @Nullable BlockEntity blockEntity, Entity entity, ItemStack stack) {
if (world instanceof ServerLevel) {
Block.getDrops(state, (ServerLevel) world, pos, blockEntity, entity, stack).forEach((itemstack1) -> {
@@ -198,10 +198,10 @@ index 58986bc0677c5ea1ad54d7d6d4efa5c2ea233aea..59d616137088af46d4494171fe96ba01
+ // Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 22df3540dd06ba049640e9bac90c23c095a07384..1fd40640460850c7c89187c0eb10f966c61f4279 100644
index 2855f8c4684cb9afee1bd8a4c2ae82d45ef1ea2b..f87f4f19738dfe8b58d3dbf0c27933fd3ec93883 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -258,4 +258,9 @@ public class LeafConfig {
@@ -263,4 +263,9 @@ public class LeafConfig {
forceHalloweenSeason = getBoolean("gameplay-mechanics.halloween.force", forceHalloweenSeason);
chanceHeadHalloweenOnEntity = (float) getDouble("gameplay-mechanics.halloween.head-chance", chanceHeadHalloweenOnEntity);
}

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7643f8a3aa22c8d58ce74a18efe3d98f5017d04c..e7bea7ebffd78813282b42d8ba5f219c10cc8959 100644
index 84cb548e89350d9127b18f69e47d1f7433bcb1ee..86e5e0caf3b341d5556665e5f5fd7d158d639118 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -838,6 +838,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -809,6 +809,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
@@ -18,7 +18,7 @@ index 7643f8a3aa22c8d58ce74a18efe3d98f5017d04c..e7bea7ebffd78813282b42d8ba5f219c
return;
}
@@ -1402,8 +1403,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1370,8 +1371,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index e5cd4b7609243669c9d84ff8a4988c209e6101aa..5a8b693b6b808410bd5020fc337687bf4124baa4 100644
index 4f3708f5f5dcb6af8225bda1cc9204a6d974665f..6bdef01513cf86d6bf578ca37b364eab70f07843 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -574,6 +574,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -576,6 +576,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
entity.load(nbt);
}, () -> {
EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));

View File

@@ -0,0 +1,73 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 11 Oct 2019 00:17:39 -0500
Subject: [PATCH] Purpur: Alternative Keepalive Handling
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 86e5e0caf3b341d5556665e5f5fd7d158d639118..42de344dffd678158030c722c0cc0fef3f8c3fc6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -260,6 +260,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private long keepAliveTime = Util.getMillis();
private boolean keepAlivePending;
private long keepAliveChallenge;
+ private it.unimi.dsi.fastutil.longs.LongList keepAlives = new it.unimi.dsi.fastutil.longs.LongArrayList(); // Purpur
// CraftBukkit start - multithreaded fields
private final AtomicInteger chatSpamTickCount = new AtomicInteger();
private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits
@@ -397,6 +398,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
long currentTime = Util.getMillis();
long elapsedTime = currentTime - this.keepAliveTime;
+ // Purpur start
+ if (org.dreeam.leaf.LeafConfig.useAlternateKeepAlive) {
+ if (elapsedTime >= 1000L) { // 1 second
+ if (!processedDisconnect && keepAlives.size() * 1000L >= KEEPALIVE_LIMIT) {
+ LOGGER.warn("{} was kicked due to keepalive timeout!", player.getName());
+ disconnect(Component.translatable("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT);
+ } else {
+ keepAliveTime = currentTime; // hijack this field for 1 second intervals
+ keepAlives.add(currentTime); // currentTime is ID
+ send(new ClientboundKeepAlivePacket(currentTime));
+ }
+ }
+ } else
+ // Purpur end
+
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
@@ -3463,6 +3479,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
+ // Purpur start
+ if (org.dreeam.leaf.LeafConfig.useAlternateKeepAlive) {
+ long id = packet.getId();
+ if (keepAlives.size() > 0 && keepAlives.contains(id)) {
+ int ping = (int) (Util.getMillis() - id);
+ player.latency = (player.latency * 3 + ping) / 4;
+ keepAlives.clear(); // we got a valid response, lets roll with it and forget the rest
+ }
+ } else
+ // Purpur end
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int) (Util.getMillis() - this.keepAliveTime);
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index f87f4f19738dfe8b58d3dbf0c27933fd3ec93883..9403774691cb83a3b916b4e0dc603385aceb4f4d 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -268,4 +268,9 @@ public class LeafConfig {
private static void tileentitySetting() {
persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
}
+
+ public static boolean useAlternateKeepAlive = false;
+ private static void useAlternateKeepAlive() {
+ useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
+ }
}

View File

@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 4 Apr 2020 03:07:59 -0500
Subject: [PATCH] Purpur: Skip events if there's no listeners
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 8ee8ff15f4511684261ff7a9417baa2ccd313b69..31e44f59bd34ae79dd1147263e446e6d6e9f8c66 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -429,6 +429,7 @@ public class Commands {
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
// Paper end - Async command map building
new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper
+ if (PlayerCommandSendEvent.getHandlerList().getRegisteredListeners().length > 0) { // Purpur - skip all this crap if there's nothing listening
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event);
@@ -439,6 +440,7 @@ public class Commands {
}
}
// CraftBukkit end
+ } // Purpur - skip event
player.connection.send(new ClientboundCommandsPacket(rootcommandnode));
}

View File

@@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 4 Jun 2021 09:13:54 -0500
Subject: [PATCH] Purpur: Add toggle for sand duping fix
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 72f1866226269396ba0f0c1be269e237925d9322..fe813aea811d3b5c54978d33e7b766f7a9fd17ee 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -130,7 +130,7 @@ public class FallingBlockEntity extends Entity {
@Override
public void tick() {
// Paper start - fix sand duping
- if (this.isRemoved()) {
+ if (org.dreeam.leaf.LeafConfig.fixSandDuping && this.isRemoved()) { // Purpur
return;
}
// Paper end - fix sand duping
@@ -147,7 +147,7 @@ public class FallingBlockEntity extends Entity {
this.move(MoverType.SELF, this.getDeltaMovement());
// Paper start - fix sand duping
- if (this.isRemoved()) {
+ if (org.dreeam.leaf.LeafConfig.fixSandDuping && this.isRemoved()) { // Purpur
return;
}
// Paper end - fix sand duping
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 9403774691cb83a3b916b4e0dc603385aceb4f4d..1a2c32e6589de7705af26623a0c6badb9504324f 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -273,4 +273,9 @@ public class LeafConfig {
private static void useAlternateKeepAlive() {
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
}
+
+ public static boolean fixSandDuping = true;
+ private static void sandSettings() {
+ fixSandDuping = getBoolean("blocks.sand.fix-duping", fixSandDuping);
+ }
}

View File

@@ -7,18 +7,18 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 7740adf7e852d860d08cdf15ab9d6b0fb6b68055..df301983ef9fd0f2dbd6ec30529e41f344272bd3 100644
index 76a9da8209d557b913c49ccd281bf147b9ac4fa4..a39d038b5198c9244e2225e0fe383f3c96b49a08 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -141,6 +141,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -139,6 +139,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
}, MemoryModuleType.MEETING_POINT, (entityvillager, holder) -> {
return holder.is(PoiTypes.MEETING);
});
+ private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur
+ private int notLobotomizedCount = 0; // Purpur
public Villager(EntityType<? extends Villager> entityType, Level world) {
this(entityType, world, VillagerType.PLAINS);
public long nextGolemPanic = -1; // Pufferfish
@@ -155,6 +157,47 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
this.setVillagerData(this.getVillagerData().setType(type).setProfession(VillagerProfession.NONE));
}
@@ -67,10 +67,10 @@ index 7740adf7e852d860d08cdf15ab9d6b0fb6b68055..df301983ef9fd0f2dbd6ec30529e41f3
@Override
public Brain<Villager> getBrain() {
return (Brain<Villager>) super.getBrain(); // CraftBukkit - decompile error
@@ -249,6 +292,21 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -250,12 +293,27 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
protected void customServerAiStep() { mobTick(false); }
protected void mobTick(boolean inactive) {
if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper
this.level.getProfiler().push("villagerBrain");
+ // Purpur start
+ if (org.dreeam.leaf.LeafConfig.villagerLobotomizeEnabled) {
+ // treat as inactive if lobotomized
@@ -80,15 +80,21 @@ index 7740adf7e852d860d08cdf15ab9d6b0fb6b68055..df301983ef9fd0f2dbd6ec30529e41f3
+ this.isLobotomized = false;
+ }
+ // Purpur end
// Pufferfish start
if (!inactive) {
if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
this.getBrain().tick((ServerLevel) this.level, this); // Paper
}
// Pufferfish end
+ // Purpur start
+ if (this.isLobotomized && shouldRestock()) {
+ else if (this.isLobotomized && shouldRestock()) {
+ // make sure we restock if needed when lobotomized
+ restock();
+ }
+ // Purpur end
this.level.getProfiler().pop();
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
index a1a8ac55e572156671e47317ba061855be79e5ac..ec3fb8865211bd7625103c37af7b96df37163a07 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java
@@ -106,12 +112,12 @@ index a1a8ac55e572156671e47317ba061855be79e5ac..ec3fb8865211bd7625103c37af7b96df
+ // Purpur end
}
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 1fd40640460850c7c89187c0eb10f966c61f4279..94c890a609a8ce2a76d44eb365eeff1d7e7b13bf 100644
index 1a2c32e6589de7705af26623a0c6badb9504324f..e3a2432c09871878c4c3981019d602a91fec3af7 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -263,4 +263,11 @@ public class LeafConfig {
private static void tileentitySetting() {
persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
@@ -278,4 +278,11 @@ public class LeafConfig {
private static void sandSettings() {
fixSandDuping = getBoolean("blocks.sand.fix-duping", fixSandDuping);
}
+
+ public static boolean villagerLobotomizeEnabled = false;

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e7bea7ebffd78813282b42d8ba5f219c10cc8959..5ce73d5b8a5885664f1e21743b8b31f842c0524c 100644
index 42de344dffd678158030c722c0cc0fef3f8c3fc6..3dbe70385d4d22c5a9cea3c471519db8bcd301e7 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2406,7 +2406,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2383,7 +2383,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
do {
instant1 = (Instant) this.lastChatTimeStamp.get();
if (timestamp.isBefore(instant1)) {
@@ -20,10 +20,10 @@ index e7bea7ebffd78813282b42d8ba5f219c10cc8959..5ce73d5b8a5885664f1e21743b8b31f8
} while (!this.lastChatTimeStamp.compareAndSet(instant1, timestamp));
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
index 94c890a609a8ce2a76d44eb365eeff1d7e7b13bf..abca2d4c4f25c9483019984001bb48d5f36e1ca8 100644
index e3a2432c09871878c4c3981019d602a91fec3af7..519770e60a1986e00b9754bb375b621cf084ec88 100644
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
@@ -270,4 +270,9 @@ public class LeafConfig {
@@ -285,4 +285,9 @@ public class LeafConfig {
villagerLobotomizeEnabled = getBoolean("mobs.villager.lobotomize.enabled", villagerLobotomizeEnabled);
villagerLobotomizeCheckInterval = getInt("mobs.villager.lobotomize.check-interval", villagerLobotomizeCheckInterval);
}

View File

@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Mon, 24 Oct 2022 10:25:40 +0800
Subject: [PATCH] KeYi: Do not save firework entities or the server may be
laggy
Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
index 5406925cd66f46ab8744123c670d72cea7bfc3a1..0b664dfef68b1e3905c9d8451602abf9cd9eafe6 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
@@ -358,4 +358,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
public boolean isAttackable() {
return false;
}
+
+ // KeYi start
+ @Override
+ public boolean shouldBeSaved() {
+ return false;
+ }
+ // KeYi end
}

View File

@@ -426,10 +426,10 @@ index e5ea9f27a1936ed9e329e74317c91c5df89b9fbd..89a41d396162a1c2eb2df5192b0d888b
private long lastFill = -1;
private long nextRefill = -1;
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index bca581f2a192015f5461e5bf776234687e5ae9fc..87161a2a3f611abdefdb2ef475a3cb64261339b8 100644
index de7a5f3812a017131fd1b32fbeff10e325b1cd2e..ebe2c0b17fc6e21a5ced4f35b594d466f9f573f5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -52,6 +52,10 @@ import net.minecraft.world.level.material.Fluids;
@@ -53,6 +53,10 @@ import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.ticks.LevelChunkTicks;
import net.minecraft.world.ticks.TickContainerAccess;
import org.slf4j.Logger;
@@ -440,7 +440,7 @@ index bca581f2a192015f5461e5bf776234687e5ae9fc..87161a2a3f611abdefdb2ef475a3cb64
public class LevelChunk extends ChunkAccess {
@@ -931,7 +935,7 @@ public class LevelChunk extends ChunkAccess {
@@ -932,7 +936,7 @@ public class LevelChunk extends ChunkAccess {
if (this.needsDecoration) {
try (co.aikar.timings.Timing ignored = this.level.timings.chunkLoadPopulate.startTiming()) { // Paper
this.needsDecoration = false;
@@ -471,18 +471,18 @@ index dcfe090c269d4cbcc2eb1b6f85392848bb34656c..ef8909c9c13c8f46ec6d452f0d14c9a1
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a190bb9ce7b3701963f315452359f6f9c3aae329..97722fc6e49b47657cf901b05dfb76a4b2a23034 100644
index f8d321e925bf2708e51590542325c1bdc67d5964..ace7e9f66c3583fc51f06bd9963ed55968d40c0f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -132,6 +132,7 @@ import org.bukkit.util.RayTraceResult;
@@ -134,6 +134,7 @@ import org.bukkit.util.Consumer;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.StructureSearchResult;
import org.bukkit.util.Vector;
import org.galemc.gale.executor.queue.ScheduledServerThreadTaskQueues;
+import cc.keyimc.keyi.utils.FastRandom; // KeYi
public class CraftWorld extends CraftRegionAccessor implements World {
public static final int CUSTOM_DIMENSION_OFFSET = 10;
@@ -224,7 +225,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -226,7 +227,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
// Paper end

View File

@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/KeYiMC/KeYi
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 53a5464aa0261d50ce9a0b7528af56f9436e3c1c..554fe3cdc287dd06a2eefffba42eac86efda0d24 100644
index 99bf1485ddecb5fc88850242e9c32850781c4b36..0813237d69ad1a9d4ed32772803fb5111a015dd4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -26,6 +26,9 @@ import java.util.Optional;
@@ -28,7 +28,7 @@ index 53a5464aa0261d50ce9a0b7528af56f9436e3c1c..554fe3cdc287dd06a2eefffba42eac86
import org.bukkit.map.MapCursor;
import org.bukkit.map.MapView;
import org.bukkit.metadata.MetadataValue;
@@ -3010,4 +3014,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3003,4 +3007,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.spigot;
}
// Spigot end

View File

@@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Fri, 30 Dec 2022 00:36:09 -0500
Subject: [PATCH] Revert AI goal set collection optimization
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 86fc528551c2c90c78783d4d46a4a2c52e4efe41..ce2804271bb67803c60c9121aec6c8dc0e99a1d9 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -11,8 +11,6 @@ import java.util.Set;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Stream;
-
-import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
import org.slf4j.Logger;
public class GoalSelector {
@@ -29,7 +27,7 @@ public class GoalSelector {
}
};
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
- private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>(); // Gale - Lithium - replace AI goal set with optimized collection
+ private final Set<WrappedGoal> availableGoals = Sets.newLinkedHashSet();
private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
private final com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new com.destroystokyo.paper.util.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
private int tickCount;

View File

@@ -0,0 +1,46 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
Date: Thu, 1 Jul 2021 12:17:44 +0000
Subject: [PATCH] Patina: Don't create new random instance
Original license: GPL v3
Original project: https://github.com/PatinaMC/Patina
Original code by PatinaMC, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/PatinaMC/Patina
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d46f33d9bc99484297270f88e68c1519922cb7db..46e5eaf8a6a4fef2c9b4d31665e8ec8589e6b31b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -393,7 +393,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);
- int k1 = RandomSource.create().nextInt(i1);
+ int k1 = worldserver.random.nextInt(i1); // Patina - don't create new random instance
for (int l1 = 0; l1 < i1; ++l1) {
int i2 = (k1 + j1 * l1) % i1;
@@ -430,7 +430,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);
- int k1 = RandomSource.create().nextInt(i1);
+ int k1 = world.random.nextInt(i1); // Patina - don't create new random instance
for (int l1 = 0; l1 < i1; ++l1) {
int i2 = (k1 + j1 * l1) % i1;
diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
index 1ef089dbf83de35d875c00efdf468c397be56978..c345f10cbf7f3451edc604f97cdf959d70639e17 100644
--- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
+++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
@@ -349,7 +349,7 @@ public class QueryThreadGs4 extends GenericThread {
this.identBytes[2] = bs[5];
this.identBytes[3] = bs[6];
this.ident = new String(this.identBytes, StandardCharsets.UTF_8);
- this.challenge = RandomSource.create().nextInt(16777216);
+ this.challenge = java.util.concurrent.ThreadLocalRandom.current().nextInt(16777216); // Patina - don't create new random instance
this.challengeBytes = String.format(Locale.ROOT, "\t%s%d\u0000", this.ident, this.challenge).getBytes(StandardCharsets.UTF_8);
}

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
Date: Sat, 24 Oct 2020 21:03:53 -0500
Subject: [PATCH] Yatopia: Smarter statistics ticking
Original license: MIT
Original project: https://github.com/YatopiaMC/Yatopia
In vanilla, statistics that count time spent for an action (i.e. time played or sneak time) are incremented every tick. This is retarded. With this patch and a configured interval of 20, the statistics are only ticked every 20th tick and are incremented by 20 ticks at a time. This means a lot less ticking with the same accurate counting.
With an interval of 20, this patch saves roughly 3ms per tick on a server w/ 80 players online.
Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 0dcae10fd05a8fe963fdedda8199aa09dc717c9a..3bed0f2dea21761687e5692f7136ca085cfdbc63 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -277,19 +277,21 @@ public abstract class Player extends LivingEntity {
this.moveCloak();
if (!this.level.isClientSide) {
this.foodData.tick(this);
- this.awardStat(Stats.PLAY_TIME);
- this.awardStat(Stats.TOTAL_WORLD_TIME);
- if (this.isAlive()) {
- this.awardStat(Stats.TIME_SINCE_DEATH);
- }
-
- if (this.isDiscrete()) {
- this.awardStat(Stats.CROUCH_TIME);
- }
-
- if (!this.isSleeping()) {
- this.awardStat(Stats.TIME_SINCE_REST);
+ // Mirai start
+ if (tickCount % 20 == 0) {
+ this.awardStat(Stats.PLAY_TIME, 20);
+ this.awardStat(Stats.TOTAL_WORLD_TIME, 20);
+ if (this.isAlive()) {
+ this.awardStat(Stats.TIME_SINCE_DEATH, 20);
+ }
+ if (this.isDiscrete()) {
+ this.awardStat(Stats.CROUCH_TIME, 20);
+ }
+ if (!this.isSleeping()) {
+ this.awardStat(Stats.TIME_SINCE_REST, 20);
+ }
}
+ // Mirai end
}
int i = 29999999;

View File

@@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Sat, 22 Oct 2022 09:58:38 +0800
Subject: [PATCH] Mirai: Fast speed check
Original license: GPL v3
Original project: https://github.com/etil2jz/Mirai
Original code by NFT-Worlds, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/NFT-Worlds/Server
This patch was took from Mirai. (https://github.com/etil2jz/Mirai)
etil2jz's note:
NFT-Worlds is related to Stellar devs, known for countless paid forks mostly taking open source patches,
doing questionable/buggy ones, and claiming breathtaking performance improvements. Never ever pay for
any of those Spigot forks!
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3961f66a23508089df8c4ee7455e170cb870e9d0..fc6d90ec2e12cf5d12c6c0d9a45947218185ef3e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1194,7 +1194,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
this.tryCheckInsideBlocks();
- float f2 = this.getBlockSpeedFactor();
+ // KeYi start - Fast speed check
+ float f2;
+ if (this.getDeltaMovement().x == 0 && this.getDeltaMovement().z == 0) {
+ f2 = 1;
+ } else {
+ f2 = this.getBlockSpeedFactor();
+ }
+ // KeYi end
this.setDeltaMovement(this.getDeltaMovement().multiply((double) f2, 1.0D, (double) f2));
// Paper start - remove expensive streams from here

View File

@@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nostalgic853 <yuu8583@proton.me>
Date: Mon, 24 Oct 2022 11:01:36 +0800
Subject: [PATCH] VMP: Skip entity move if no movement
Original license: MIT
Original project: https://github.com/RelativityMC/VMP-fabric
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index fc6d90ec2e12cf5d12c6c0d9a45947218185ef3e..853e96c3f2e4dd5572743154074b770ba9a23aa5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -398,6 +398,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
private UUID originWorld;
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
public boolean collidingWithWorldBorder; // Paper
+ private boolean boundingBoxChanged = false; // KeYi
public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
@@ -1034,6 +1035,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// Paper end - detailed watchdog information
public void move(MoverType movementType, Vec3 movement) {
+ // KeYi start
+ if (!boundingBoxChanged && movement.equals(Vec3.ZERO)) {
+ boundingBoxChanged = false;
+ return;
+ }
+ // KeYi end
+
// Paper start - detailed watchdog information
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
synchronized (this.posLock) {
@@ -3824,6 +3832,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void setBoundingBox(AABB boundingBox) {
+ if (!this.bb.equals(boundingBox)) boundingBoxChanged = true; // KeYi
// CraftBukkit start - block invalid bounding boxes
double minX = boundingBox.minX,
minY = boundingBox.minY,

View File

@@ -10,17 +10,19 @@ this patch is focused around the sensors used for ai
delete the line of sight cache less often and use a faster nearby comparison
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 27fc50571305132c86497fcb1d5b1bb514610a4e..f1a33fd186fa9c10ac99b7b0e6379902a10dfb14 100644
index 94b45579dc371ee980565aed2f5dee78ebd44427..48746d84f18cc8ee2f57785c65a5659ced454d39 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -867,8 +867,8 @@ public abstract class Mob extends LivingEntity {
@@ -873,10 +873,10 @@ public abstract class Mob extends LivingEntity {
return;
}
// Paper end
- this.sensing.tick();
- int i = this.level.getServer().getTickCount() + this.getId();
+ int i = this.level.getServer().getTickCount() + this.getId(); // petal - move up
this.level.getProfiler().push("sensing");
- this.sensing.tick();
+ if (i % 10 == 0) this.sensing.tick(); // petal - only refresh line of sight cache every half second
this.level.getProfiler().pop();
- int i = this.level.getServer().getTickCount() + this.getId();
if (i % 2 != 0 && this.tickCount > 1) {
this.targetSelector.tickRunningGoals(false);
this.level.getProfiler().push("targetSelector");