mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
API patches work
* Merged Gale's
This commit is contained in:
@@ -3,17 +3,65 @@ From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
||||
Date: Tue, 21 May 2024 11:43:49 +0800
|
||||
Subject: [PATCH] Rebrand
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Gale branding changes"
|
||||
By: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
As part of: GaleMC (https://github.com/GaleMC/Gale)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/LICENCE.txt b/LICENSE.txt
|
||||
similarity index 99%
|
||||
rename from LICENCE.txt
|
||||
rename to LICENSE.txt
|
||||
index 94a9ed024d3859793618152ea559a168bbcbb5e2..e60008693e017bec1b4eb49c84be3898e26fcf2a 100644
|
||||
--- a/LICENCE.txt
|
||||
+++ b/LICENSE.txt
|
||||
@@ -1,7 +1,7 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
-<http://www.gnu.org/licenses/>.
|
||||
+<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
+<https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
index b68770f6992b044d13e67d9affa6933c90ca8fb8..6b2f6ab137ae37ff0db4827886614436b7ed5dcb 100644
|
||||
index 652ff54e7c50412503725d628bfe72ed03059790..f738bbcefe288474c5f591dda03d713850633854 100644
|
||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
@@ -26,6 +26,17 @@ public interface ServerBuildInfo {
|
||||
Key BRAND_GALE_ID = Key.key("galemc", "gale");
|
||||
// Gale end - branding changes
|
||||
@@ -19,6 +19,21 @@ public interface ServerBuildInfo {
|
||||
*/
|
||||
Key BRAND_PAPER_ID = Key.key("papermc", "paper");
|
||||
|
||||
+ // Leaf start - Rebrand
|
||||
+ /**
|
||||
+ * The brand id for Gale.
|
||||
+ */
|
||||
+ Key BRAND_GALE_ID = Key.key("galemc", "gale");
|
||||
+ /**
|
||||
+ * The brand id for Pufferfish.
|
||||
+ */
|
||||
+ Key BRAND_PUFFERFISH_ID = Key.key("pufferfish", "pufferfish");
|
||||
@@ -27,10 +75,10 @@ index b68770f6992b044d13e67d9affa6933c90ca8fb8..6b2f6ab137ae37ff0db4827886614436
|
||||
* Gets the {@code ServerBuildInfo}.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
index e64bb57f74e6d6f78927be228825b3e0bdf41f48..2b544b03c16075123831de6997414507c38e8f66 100644
|
||||
index 26bc02a534cbf77fb3f605ee9d27cea6258fea0f..3c4e127cbd3b8310070f94e38d501d68860710a3 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -215,7 +215,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
@@ -213,7 +213,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
String version = Bukkit.getVersion();
|
||||
// Paper start
|
||||
if (version.startsWith("null")) { // running from ide?
|
||||
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Leaf config
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 45dc5c9775c0a70452f91c401acbbe91168875c7..7edf19de268b061a5bf69b69043fddd820cbb591 100644
|
||||
index 7dbfff8e0d86ba4533568a8f4182506d8a065b63..f0f5bf5d75d58bdd55cff34fca48945380545d20 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2414,6 +2414,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
|
||||
@@ -2369,6 +2369,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Leaf start - Leaf config - API
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Wed, 23 Nov 2022 21:03:04 +0100
|
||||
Subject: [PATCH] Gale configuration
|
||||
|
||||
License: MIT (https://opensource.org/licenses/MIT)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Timings v2"
|
||||
By: Aikar <aikar@aikar.co>
|
||||
As part of: Paper (https://github.com/PaperMC/Paper)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index f0f5bf5d75d58bdd55cff34fca48945380545d20..0e1e19b60d8e790bdb3329c4582d80528825bf30 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2367,6 +2367,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
+
|
||||
+ // Gale start - Gale configuration - API
|
||||
+ @NotNull
|
||||
+ public org.bukkit.configuration.file.YamlConfiguration getGaleConfig()
|
||||
+ {
|
||||
+ throw new UnsupportedOperationException("Not supported yet.");
|
||||
+ }
|
||||
+ // Gale end - Gale configuration - API
|
||||
+
|
||||
// Paper end
|
||||
|
||||
// Leaf start - Leaf config - API
|
||||
@@ -0,0 +1,91 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Sat, 24 Dec 2022 22:37:29 +0100
|
||||
Subject: [PATCH] Make timings calls final
|
||||
|
||||
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Gale - https://galemc.org
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java
|
||||
index 73b125979e2f2dfd13cbf689a90b29cc68a36e09..d8dfaf5041ccf3f360e0bd94bf03580a8b3d9a38 100644
|
||||
--- a/src/main/java/co/aikar/timings/FullServerTickHandler.java
|
||||
+++ b/src/main/java/co/aikar/timings/FullServerTickHandler.java
|
||||
@@ -22,8 +22,7 @@ public class FullServerTickHandler extends TimingHandler {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
- @Override
|
||||
- public Timing startTiming() {
|
||||
+ public Timing startTimingFullServerTick() { // Gale - final timings calls
|
||||
if (TimingsManager.needsFullReset) {
|
||||
TimingsManager.resetTimings();
|
||||
} else if (TimingsManager.needsRecheckEnabled) {
|
||||
@@ -32,8 +31,7 @@ public class FullServerTickHandler extends TimingHandler {
|
||||
return super.startTiming();
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public void stopTiming() {
|
||||
+ public void stopTimingFullServerTick() { // Gale - final timings calls
|
||||
super.stopTiming();
|
||||
if (!isEnabled()) {
|
||||
return;
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java
|
||||
index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..51d54b87106aa17c2de9ab22eae22d176c7d0bfc 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingHandler.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingHandler.java
|
||||
@@ -97,7 +97,7 @@ class TimingHandler implements Timing {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
- public Timing startTiming() {
|
||||
+ public final Timing startTiming() { // Gale - final timings calls
|
||||
if (!enabled || !Bukkit.isPrimaryThread()) {
|
||||
return this;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class TimingHandler implements Timing {
|
||||
return this;
|
||||
}
|
||||
|
||||
- public void stopTiming() {
|
||||
+ public final void stopTiming() { // Gale - final timings calls
|
||||
if (!enabled || timingDepth <= 0 || start == 0 || !Bukkit.isPrimaryThread()) {
|
||||
return;
|
||||
}
|
||||
diff --git a/src/main/java/co/aikar/timings/UnsafeTimingHandler.java b/src/main/java/co/aikar/timings/UnsafeTimingHandler.java
|
||||
index 632c4961515f5052551f841cfa840e60bba7a257..49180ea7879c64af3cd5143a34783d564746b504 100644
|
||||
--- a/src/main/java/co/aikar/timings/UnsafeTimingHandler.java
|
||||
+++ b/src/main/java/co/aikar/timings/UnsafeTimingHandler.java
|
||||
@@ -23,31 +23,4 @@
|
||||
*/
|
||||
package co.aikar.timings;
|
||||
|
||||
-import org.bukkit.Bukkit;
|
||||
-import org.jetbrains.annotations.NotNull;
|
||||
-
|
||||
-class UnsafeTimingHandler extends TimingHandler {
|
||||
-
|
||||
- UnsafeTimingHandler(@NotNull TimingIdentifier id) {
|
||||
- super(id);
|
||||
- }
|
||||
-
|
||||
- private static void checkThread() {
|
||||
- if (!Bukkit.isPrimaryThread()) {
|
||||
- throw new IllegalStateException("Calling Timings from Async Operation");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @NotNull
|
||||
- @Override
|
||||
- public Timing startTiming() {
|
||||
- checkThread();
|
||||
- return super.startTiming();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void stopTiming() {
|
||||
- checkThread();
|
||||
- super.stopTiming();
|
||||
- }
|
||||
-}
|
||||
+class UnsafeTimingHandler {} // Gale - final timings calls
|
||||
152
leaf-api/paper-patches/features/0005-SIMD-support.patch
Normal file
152
leaf-api/paper-patches/features/0005-SIMD-support.patch
Normal file
@@ -0,0 +1,152 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Thu, 24 Nov 2022 01:21:32 +0100
|
||||
Subject: [PATCH] SIMD support
|
||||
|
||||
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Add SIMD utilities"
|
||||
By: Kevin Raneri <kevin.raneri@gmail.com>
|
||||
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..90d87374e9dddd79aeca3e05f9cd6c82eb3aad27
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
|
||||
@@ -0,0 +1,48 @@
|
||||
+// Gale - Pufferfish - SIMD support
|
||||
+
|
||||
+package gg.pufferfish.pufferfish.simd;
|
||||
+
|
||||
+import jdk.incubator.vector.FloatVector;
|
||||
+import jdk.incubator.vector.IntVector;
|
||||
+import jdk.incubator.vector.VectorSpecies;
|
||||
+
|
||||
+/**
|
||||
+ * Basically, java is annoying and we have to push this out to its own class.
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class SIMDChecker {
|
||||
+
|
||||
+ public static void initialize() {
|
||||
+ if (SIMDDetection.isInitialized()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ SIMDDetection.setInitialized();
|
||||
+ try {
|
||||
+ int javaVersion = SIMDDetection.getJavaVersion();
|
||||
+ if (javaVersion < 17) {
|
||||
+ return;
|
||||
+ }
|
||||
+ SIMDDetection.supportingJavaVersion = true;
|
||||
+ SIMDDetection.testRunStarted = true;
|
||||
+
|
||||
+ VectorSpecies<Integer> ISPEC = IntVector.SPECIES_PREFERRED;
|
||||
+ VectorSpecies<Float> FSPEC = FloatVector.SPECIES_PREFERRED;
|
||||
+
|
||||
+ SIMDDetection.intVectorBitSize = ISPEC.vectorBitSize();
|
||||
+ SIMDDetection.floatVectorBitSize = FSPEC.vectorBitSize();
|
||||
+
|
||||
+ SIMDDetection.intElementSize = ISPEC.elementSize();
|
||||
+ SIMDDetection.floatElementSize = FSPEC.elementSize();
|
||||
+
|
||||
+ SIMDDetection.testRunCompleted = true;
|
||||
+
|
||||
+ if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) {
|
||||
+ SIMDDetection.unsupportingLaneSize = true;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ SIMDDetection.isEnabled = true;
|
||||
+ } catch (Throwable ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b19b6bc85cb08a49f064a4ecb88af858a9a22fe7
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
|
||||
@@ -0,0 +1,78 @@
|
||||
+// Gale - Pufferfish - SIMD support
|
||||
+
|
||||
+package gg.pufferfish.pufferfish.simd;
|
||||
+
|
||||
+public class SIMDDetection {
|
||||
+
|
||||
+ private static boolean isInitialized = false;
|
||||
+ static int intVectorBitSize;
|
||||
+ static int floatVectorBitSize;
|
||||
+ static int intElementSize;
|
||||
+ static int floatElementSize;
|
||||
+ static boolean supportingJavaVersion;
|
||||
+ static boolean testRunStarted;
|
||||
+ static boolean testRunCompleted;
|
||||
+ static boolean unsupportingLaneSize;
|
||||
+ static boolean isEnabled;
|
||||
+
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ public static void initialize() {
|
||||
+ try {
|
||||
+ SIMDChecker.initialize();
|
||||
+ } catch (Throwable ignored) {}
|
||||
+ }
|
||||
+
|
||||
+ static void setInitialized() {
|
||||
+ isInitialized = true;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isInitialized() {
|
||||
+ return isInitialized;
|
||||
+ }
|
||||
+
|
||||
+ public static int intVectorBitSize() {
|
||||
+ return intVectorBitSize;
|
||||
+ }
|
||||
+
|
||||
+ public static int floatVectorBitSize() {
|
||||
+ return floatVectorBitSize;
|
||||
+ }
|
||||
+
|
||||
+ public static int intElementSize() {
|
||||
+ return intElementSize;
|
||||
+ }
|
||||
+
|
||||
+ public static int floatElementSize() {
|
||||
+ return floatElementSize;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean supportingJavaVersion() {
|
||||
+ return supportingJavaVersion;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean testRunCompleted() {
|
||||
+ return testRunCompleted;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean unsupportingLaneSize() {
|
||||
+ return unsupportingLaneSize;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isEnabled() {
|
||||
+ return isEnabled;
|
||||
+ }
|
||||
+
|
||||
+ public static int getJavaVersion() {
|
||||
+ // https://stackoverflow.com/a/2591122
|
||||
+ String version = System.getProperty("java.version");
|
||||
+ if(version.startsWith("1.")) {
|
||||
+ version = version.substring(2, 3);
|
||||
+ } else {
|
||||
+ int dot = version.indexOf(".");
|
||||
+ if(dot != -1) { version = version.substring(0, dot); }
|
||||
+ }
|
||||
+ version = version.split("-")[0]; // Azul is stupid
|
||||
+ return Integer.parseInt(version);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
@@ -0,0 +1,140 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Thu, 24 Nov 2022 17:03:21 +0100
|
||||
Subject: [PATCH] Vectorized map color conversion
|
||||
|
||||
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Optimize map rendering"
|
||||
By: Kevin Raneri <kevin.raneri@gmail.com>
|
||||
As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish)
|
||||
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
|
||||
* Pufferfish description *
|
||||
|
||||
This patch does not add any API that should be used by plugins. Any
|
||||
classes and methods added by this patch should NOT be used in plugins.
|
||||
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..00b16e4aacba50996b81fac81c3f78b6e83f78ab
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
|
||||
@@ -0,0 +1,86 @@
|
||||
+// Gale - Pufferfish - vectorize map color conversion
|
||||
+
|
||||
+package gg.pufferfish.pufferfish.simd;
|
||||
+
|
||||
+import jdk.incubator.vector.FloatVector;
|
||||
+import jdk.incubator.vector.IntVector;
|
||||
+import jdk.incubator.vector.VectorMask;
|
||||
+import jdk.incubator.vector.VectorSpecies;
|
||||
+import org.bukkit.map.MapPalette;
|
||||
+
|
||||
+import java.awt.*;
|
||||
+
|
||||
+@Deprecated
|
||||
+public class VectorMapPalette {
|
||||
+
|
||||
+ private static final VectorSpecies<Integer> I_SPEC = IntVector.SPECIES_PREFERRED;
|
||||
+ private static final VectorSpecies<Float> F_SPEC = FloatVector.SPECIES_PREFERRED;
|
||||
+
|
||||
+ @Deprecated
|
||||
+ public static void matchColorVectorized(int[] in, byte[] out) {
|
||||
+ int speciesLength = I_SPEC.length();
|
||||
+ int i;
|
||||
+ for (i = 0; i < in.length - speciesLength; i += speciesLength) {
|
||||
+ float[] redsArr = new float[speciesLength];
|
||||
+ float[] bluesArr = new float[speciesLength];
|
||||
+ float[] greensArr = new float[speciesLength];
|
||||
+ int[] alphasArr = new int[speciesLength];
|
||||
+
|
||||
+ for (int j = 0; j < speciesLength; j++) {
|
||||
+ alphasArr[j] = (in[i + j] >> 24) & 0xFF;
|
||||
+ redsArr[j] = (in[i + j] >> 16) & 0xFF;
|
||||
+ greensArr[j] = (in[i + j] >> 8) & 0xFF;
|
||||
+ bluesArr[j] = (in[i + j] >> 0) & 0xFF;
|
||||
+ }
|
||||
+
|
||||
+ IntVector alphas = IntVector.fromArray(I_SPEC, alphasArr, 0);
|
||||
+ FloatVector reds = FloatVector.fromArray(F_SPEC, redsArr, 0);
|
||||
+ FloatVector greens = FloatVector.fromArray(F_SPEC, greensArr, 0);
|
||||
+ FloatVector blues = FloatVector.fromArray(F_SPEC, bluesArr, 0);
|
||||
+ IntVector resultIndex = IntVector.zero(I_SPEC);
|
||||
+ VectorMask<Integer> modificationMask = VectorMask.fromLong(I_SPEC, 0xffffffff);
|
||||
+
|
||||
+ modificationMask = modificationMask.and(alphas.lt(128).not());
|
||||
+ FloatVector bestDistances = FloatVector.broadcast(F_SPEC, Float.MAX_VALUE);
|
||||
+
|
||||
+ for (int c = 4; c < MapPalette.colors.length; c++) {
|
||||
+ // We're using 32-bit floats here because it's 2x faster and nobody will know the difference.
|
||||
+ // For correctness, the original algorithm uses 64-bit floats instead. Completely unnecessary.
|
||||
+ FloatVector compReds = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getRed());
|
||||
+ FloatVector compGreens = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getGreen());
|
||||
+ FloatVector compBlues = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getBlue());
|
||||
+
|
||||
+ FloatVector rMean = reds.add(compReds).div(2.0f);
|
||||
+ FloatVector rDiff = reds.sub(compReds);
|
||||
+ FloatVector gDiff = greens.sub(compGreens);
|
||||
+ FloatVector bDiff = blues.sub(compBlues);
|
||||
+
|
||||
+ FloatVector weightR = rMean.div(256.0f).add(2);
|
||||
+ FloatVector weightG = FloatVector.broadcast(F_SPEC, 4.0f);
|
||||
+ FloatVector weightB = FloatVector.broadcast(F_SPEC, 255.0f).sub(rMean).div(256.0f).add(2.0f);
|
||||
+
|
||||
+ FloatVector distance = weightR.mul(rDiff).mul(rDiff).add(weightG.mul(gDiff).mul(gDiff)).add(weightB.mul(bDiff).mul(bDiff));
|
||||
+
|
||||
+ // Now we compare to the best distance we've found.
|
||||
+ // This mask contains a "1" if better, and a "0" otherwise.
|
||||
+ VectorMask<Float> bestDistanceMask = distance.lt(bestDistances);
|
||||
+ bestDistances = bestDistances.blend(distance, bestDistanceMask); // Update the best distances
|
||||
+
|
||||
+ // Update the result array
|
||||
+ // We also AND with the modification mask because we don't want to interfere if the alpha value isn't large enough.
|
||||
+ resultIndex = resultIndex.blend(c, bestDistanceMask.cast(I_SPEC).and(modificationMask)); // Update the results
|
||||
+ }
|
||||
+
|
||||
+ for (int j = 0; j < speciesLength; j++) {
|
||||
+ int index = resultIndex.lane(j);
|
||||
+ out[i + j] = (byte) (index < 128 ? index : -129 + (index - 127));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // For the final ones, fall back to the regular method
|
||||
+ for (; i < in.length; i++) {
|
||||
+ out[i] = MapPalette.matchColor(new Color(in[i], true));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java
|
||||
index 6995f9cc08d162e3adcd3a28f6bfa6d329661999..844ad65edd5ac9eb7ccce08905972ad0ba18ea69 100644
|
||||
--- a/src/main/java/org/bukkit/map/MapPalette.java
|
||||
+++ b/src/main/java/org/bukkit/map/MapPalette.java
|
||||
@@ -45,7 +45,7 @@ public final class MapPalette {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
- static final Color[] colors = {
|
||||
+ public static final Color[] colors = { // Gale - Pufferfish - vectorized map color conversion - package -> public
|
||||
c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0),
|
||||
c(89, 125, 39), c(109, 153, 48), c(127, 178, 56), c(67, 94, 29),
|
||||
c(174, 164, 115), c(213, 201, 140), c(247, 233, 163), c(130, 123, 86),
|
||||
@@ -216,9 +216,15 @@ public final class MapPalette {
|
||||
temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth());
|
||||
|
||||
byte[] result = new byte[temp.getWidth() * temp.getHeight()];
|
||||
+ if ((mapColorCache != null && mapColorCache.isCached()) || !gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled()) { // Gale - Pufferfish - vectorized map color conversion
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
result[i] = matchColor(new Color(pixels[i], true));
|
||||
}
|
||||
+ // Gale start - Pufferfish - vectorized map color conversion
|
||||
+ } else {
|
||||
+ gg.pufferfish.pufferfish.simd.VectorMapPalette.matchColorVectorized(pixels, result);
|
||||
+ }
|
||||
+ // Gale end - Pufferfish - vectorized map color conversion
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Tue, 8 Aug 2023 18:39:55 +0200
|
||||
Subject: [PATCH] Do not log plugin library loads
|
||||
|
||||
License: MIT (https://opensource.org/licenses/MIT)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Add log suppression for LibraryLoader"
|
||||
By: Krakenied <Krakenied1@gmail.com>
|
||||
As part of: Purpur (https://github.com/PurpurMC/Purpur)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
* Purpur copyright *
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-2022 PurpurMC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 163e9a0e179dc88be93614ff66ee2be3eccc694f..539786355ac89b5eb8ad876e65662e844d4654e3 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -54,6 +54,13 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>();
|
||||
private final LibraryLoader libraryLoader;
|
||||
|
||||
+ // Gale start - Purpur - do not log plugin library loads
|
||||
+ public static boolean SuppressLibraryLoaderLogger = false; // This is not set by Gale, but is included for compatibility with Purpur plugins
|
||||
+ public static boolean logDownloads = true;
|
||||
+ public static boolean logStartLoadLibrariesForPlugin = true;
|
||||
+ public static boolean logLibraryLoaded = true;
|
||||
+ // Gale end - Purpur - do not log plugin library loads
|
||||
+
|
||||
/**
|
||||
* This class was not meant to be constructed explicitly
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
index 3200a3c9af5fa2ecbbc2b07be3ec31a2681180a8..cfe41c0a67c8d729b6bd23b0cfa32db3c9db9f74 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
@@ -63,6 +63,7 @@ public class LibraryLoader {
|
||||
session.setTransferListener(new AbstractTransferListener() {
|
||||
@Override
|
||||
public void transferStarted(@NotNull TransferEvent event) {
|
||||
+ if (JavaPluginLoader.logDownloads && !JavaPluginLoader.SuppressLibraryLoaderLogger) // Gale - Purpur - do not log plugin library loads
|
||||
logger.log(Level.INFO, "Downloading {0}", event.getResource().getRepositoryUrl() + event.getResource().getResourceName());
|
||||
}
|
||||
});
|
||||
@@ -88,6 +89,7 @@ public class LibraryLoader {
|
||||
// Paper end - plugin loader api
|
||||
return null;
|
||||
}
|
||||
+ if (JavaPluginLoader.logStartLoadLibrariesForPlugin && !JavaPluginLoader.SuppressLibraryLoaderLogger) // Gale - Purpur - do not log plugin library loads
|
||||
logger.log(Level.INFO, "[{0}] Loading {1} libraries... please wait", new Object[]
|
||||
{
|
||||
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), desc.getLibraries().size() // Paper - use configured log prefix
|
||||
@@ -140,6 +142,7 @@ public class LibraryLoader {
|
||||
}
|
||||
|
||||
jarFiles.add(url);
|
||||
+ if (JavaPluginLoader.logLibraryLoaded && !JavaPluginLoader.SuppressLibraryLoaderLogger) // Gale - Purpur - do not log plugin library loads
|
||||
logger.log(Level.INFO, "[{0}] Loaded library {1}", new Object[]
|
||||
{
|
||||
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), file // Paper - use configured log prefix
|
||||
@@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Tue, 29 Nov 2022 23:38:12 +0100
|
||||
Subject: [PATCH] Player#canSee by entity UUID
|
||||
|
||||
License: MIT (https://opensource.org/licenses/MIT)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Spread out and optimise player list ticksSpread out and optimise player list ticks"
|
||||
By: James Lyne <jim+github@not-null.co.uk>
|
||||
As part of: Purpur (https://github.com/PurpurMC/Purpur)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
* Purpur copyright *
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-2022 PurpurMC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 7b9324d121d39ef75dc4d709831472598c1c50a0..cb8da28d86d44b3633cf47f75141c9a093c63dab 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2113,6 +2113,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
boolean listPlayer(Player other);
|
||||
// Paper end
|
||||
|
||||
+ // Gale start - Purpur - Player#canSee by entity UUID
|
||||
+ /**
|
||||
+ * Checks to see if an entity has been visually hidden from this player.
|
||||
+ *
|
||||
+ * @param entityUUID The {@link Entity#getUniqueId()} of the entity to check
|
||||
+ * @return True if the entity with the provided UUID is not being hidden from this player
|
||||
+ */
|
||||
+ boolean canSeePlayer(UUID entityUUID);
|
||||
+ // Gale end - Purpur - Player#canSee by entity UUID
|
||||
+
|
||||
/**
|
||||
* Checks to see if this player is currently flying or not.
|
||||
*
|
||||
@@ -0,0 +1,82 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Wed, 30 Nov 2022 12:57:37 +0100
|
||||
Subject: [PATCH] Specific interval TPS API
|
||||
|
||||
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
||||
Gale - https://galemc.org
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index ee791bf6299d654fb56300fbda1f6ea50620a3e2..da63ffc2deedc0f431ed84bce2f8750162d30e3c 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2428,6 +2428,35 @@ public final class Bukkit {
|
||||
return server.getTPS();
|
||||
}
|
||||
|
||||
+ // Gale start - specific interval TPS API
|
||||
+ /**
|
||||
+ * Gets the average server TPS over the last 1 minute
|
||||
+ *
|
||||
+ * @return the average server TPS over the last 1 minute
|
||||
+ */
|
||||
+ public static double get1MinuteTPSAverage() {
|
||||
+ return server.get1MinuteTPSAverage();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the average server TPS over the last 5 minutes
|
||||
+ *
|
||||
+ * @return the average server TPS over the last 5 minutes
|
||||
+ */
|
||||
+ public static double get5MinuteTPSAverage() {
|
||||
+ return server.get5MinuteTPSAverage();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the average server TPS over the last 15 minutes
|
||||
+ *
|
||||
+ * @return the average server TPS over the last 15 minutes
|
||||
+ */
|
||||
+ public static double get15MinuteTPSAverage() {
|
||||
+ return server.get15MinuteTPSAverage();
|
||||
+ }
|
||||
+ // Gale end - specific interval TPS API
|
||||
+
|
||||
/**
|
||||
* Get a sample of the servers last tick times (in nanos)
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 0e1e19b60d8e790bdb3329c4582d80528825bf30..58cbf87e2f47da3ecad5e9d48f2eb4ff0206a7d6 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2119,6 +2119,29 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public double @NotNull [] getTPS();
|
||||
|
||||
+ // Gale start - specific interval TPS API
|
||||
+ /**
|
||||
+ * Gets the average server TPS over the last 1 minute
|
||||
+ *
|
||||
+ * @return the average server TPS over the last 1 minute
|
||||
+ */
|
||||
+ double get1MinuteTPSAverage();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the average server TPS over the last 5 minutes
|
||||
+ *
|
||||
+ * @return the average server TPS over the last 5 minutes
|
||||
+ */
|
||||
+ double get5MinuteTPSAverage();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the average server TPS over the last 15 minutes
|
||||
+ *
|
||||
+ * @return the average server TPS over the last 15 minutes
|
||||
+ */
|
||||
+ double get15MinuteTPSAverage();
|
||||
+ // Gale end - specific interval TPS API
|
||||
+
|
||||
/**
|
||||
* Get a sample of the servers last tick times (in nanos)
|
||||
*
|
||||
105
leaf-api/paper-patches/features/0010-5-second-TPS-average.patch
Normal file
105
leaf-api/paper-patches/features/0010-5-second-TPS-average.patch
Normal file
@@ -0,0 +1,105 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Wed, 30 Nov 2022 13:00:40 +0100
|
||||
Subject: [PATCH] 5 second TPS average
|
||||
|
||||
License: MIT (https://opensource.org/licenses/MIT)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Add 5 second tps average in /tps"
|
||||
By: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
As part of: Purpur (https://github.com/PurpurMC/Purpur)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
* Purpur copyright *
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-2022 PurpurMC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index da63ffc2deedc0f431ed84bce2f8750162d30e3c..ccdd6fba261cb148cf02017c2bf779b3d3bb070b 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2428,7 +2428,30 @@ public final class Bukkit {
|
||||
return server.getTPS();
|
||||
}
|
||||
|
||||
+ // Gale start - Purpur - 5 second TPS average
|
||||
+ /**
|
||||
+ * Gets the current server TPS
|
||||
+ * @return current server TPS (5s, 1m, 5m, 15m in Gale-Server)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static double[] getTPSIncluding5SecondAverage() {
|
||||
+ return server.getTPSIncluding5SecondAverage();
|
||||
+ }
|
||||
+ // Gale end - Purpur - 5 second TPS average
|
||||
+
|
||||
// Gale start - specific interval TPS API
|
||||
+
|
||||
+ // Gale start - Purpur - 5 second TPS average
|
||||
+ /**
|
||||
+ * Gets the average server TPS over the last 5 seconds
|
||||
+ *
|
||||
+ * @return the average server TPS over the last 5 seconds
|
||||
+ */
|
||||
+ public static double get5SecondTPSAverage() {
|
||||
+ return server.get5SecondTPSAverage();
|
||||
+ }
|
||||
+ // Gale end - Purpur - 5 second TPS average
|
||||
+
|
||||
/**
|
||||
* Gets the average server TPS over the last 1 minute
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 58cbf87e2f47da3ecad5e9d48f2eb4ff0206a7d6..2fd864e2b9ae21105d86c2b4dcc223e5f483f468 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2119,7 +2119,27 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public double @NotNull [] getTPS();
|
||||
|
||||
+ // Gale start - Purpur - 5 second TPS average
|
||||
+ /**
|
||||
+ * Gets the current server TPS
|
||||
+ *
|
||||
+ * @return current server TPS (5s, 1m, 5m, 15m in Gale-Server)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ double[] getTPSIncluding5SecondAverage();
|
||||
+ // Gale end - Purpur - 5 second TPS average
|
||||
+
|
||||
// Gale start - specific interval TPS API
|
||||
+
|
||||
+ // Gale start - Purpur - 5 second TPS average
|
||||
+ /**
|
||||
+ * Gets the average server TPS over the last 5 seconds
|
||||
+ *
|
||||
+ * @return the average server TPS over the last 5 seconds
|
||||
+ */
|
||||
+ double get5SecondTPSAverage();
|
||||
+ // Gale end - Purpur - 5 second TPS average
|
||||
+
|
||||
/**
|
||||
* Gets the average server TPS over the last 1 minute
|
||||
*
|
||||
@@ -0,0 +1,83 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
||||
Date: Sat, 26 Nov 2022 20:49:15 +0100
|
||||
Subject: [PATCH] Last tick time API
|
||||
|
||||
License: MIT (https://opensource.org/licenses/MIT)
|
||||
Gale - https://galemc.org
|
||||
|
||||
This patch is based on the following patch:
|
||||
"Add getLastTickMs api"
|
||||
By: tr7zw <tr7zw@live.de>
|
||||
As part of: YAPFA (https://github.com/tr7zw/YAPFA)
|
||||
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
||||
|
||||
* YAPFA copyright *
|
||||
|
||||
Copyright 2020 tr7zw
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index ccdd6fba261cb148cf02017c2bf779b3d3bb070b..10662089e8a08bae6c6077b72c30b14bb94cc2c7 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -3034,6 +3034,20 @@ public final class Bukkit {
|
||||
}
|
||||
// Paper end - Folia region threading API
|
||||
|
||||
+ // Gale start - YAPFA - last tick time - API
|
||||
+ public static long getLastTickTotalTime() {
|
||||
+ return server.getLastTickTotalTime();
|
||||
+ }
|
||||
+
|
||||
+ public static long getLastTickProperTime() {
|
||||
+ return server.getLastTickProperTime();
|
||||
+ }
|
||||
+
|
||||
+ public static long getLastTickOversleepTime() {
|
||||
+ return server.getLastTickOversleepTime();
|
||||
+ }
|
||||
+ // Gale end - YAPFA - last tick time - API
|
||||
+
|
||||
/**
|
||||
* @deprecated All methods on this class have been deprecated, see the individual methods for replacements.
|
||||
*/
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 2fd864e2b9ae21105d86c2b4dcc223e5f483f468..925b4c8903bb6f44a56af4ecc2c0a01c46f14107 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2765,4 +2765,29 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
|
||||
// Paper end - API to check if the server is sleeping
|
||||
+
|
||||
+ // Gale start - YAPFA - last tick time - API
|
||||
+ /**
|
||||
+ * Gets the total time spent in the last tick,
|
||||
+ * which includes both the time spent on processing as well as the time spent in oversleep.
|
||||
+ *
|
||||
+ * @return the total time spent in the last tick, in milliseconds
|
||||
+ */
|
||||
+ long getLastTickTotalTime();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the time spent on processing in the last tick,
|
||||
+ * not including the time spent in oversleep.
|
||||
+ *
|
||||
+ * @return the total time spent on processing in the last tick, in milliseconds
|
||||
+ */
|
||||
+ long getLastTickProperTime();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the time spent in oversleep in the last tick.
|
||||
+ *
|
||||
+ * @return the total time spent in oversleep in the last tick, in milliseconds
|
||||
+ */
|
||||
+ long getLastTickOversleepTime();
|
||||
+ // Gale end - YAPFA - last tick time - API
|
||||
}
|
||||
@@ -204,10 +204,10 @@ index 001465eedafa51ac027a4db51cba6223edfe1171..2e6d62c4f3687e299c34e876c503b400
|
||||
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 8acf45815b5841e3b2082a8bc5b7974e85cdd7f9..2fae50a9d1f0d9ecd91036697dedd64bc56f7d3b 100644
|
||||
index 539786355ac89b5eb8ad876e65662e844d4654e3..ce45dbc7b02c405f1b3460563cf87e7888702ba9 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -343,7 +343,13 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -336,7 +336,13 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
try {
|
||||
jPlugin.setEnabled(true);
|
||||
} catch (Throwable ex) {
|
||||
@@ -221,7 +221,7 @@ index 8acf45815b5841e3b2082a8bc5b7974e85cdd7f9..2fae50a9d1f0d9ecd91036697dedd64b
|
||||
}
|
||||
|
||||
// Perhaps abort here, rather than continue going, but as it stands,
|
||||
@@ -368,7 +374,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -361,7 +367,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
try {
|
||||
jPlugin.setEnabled(false);
|
||||
} catch (Throwable ex) {
|
||||
@@ -729,7 +729,7 @@ index 51d54b87106aa17c2de9ab22eae22d176c7d0bfc..00000000000000000000000000000000
|
||||
-}
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java
|
||||
deleted file mode 100644
|
||||
index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..0000000000000000000000000000000000000000
|
||||
index c8287776ad585d04fb4fa3290cd73d7097035ea0..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/co/aikar/timings/TimingHistory.java
|
||||
+++ /dev/null
|
||||
@@ -1,357 +0,0 @@
|
||||
@@ -1024,7 +1024,7 @@ index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..00000000000000000000000000000000
|
||||
- final TicksRecord ticksRecord = new TicksRecord();
|
||||
- final PingRecord pingRecord = new PingRecord();
|
||||
- final TimingData fst = TimingsManager.FULL_SERVER_TICK.minuteData.clone();
|
||||
- final double tps = 1E9 / ( System.nanoTime() - lastMinuteTime ) * ticksRecord.timed;
|
||||
- final double tps = 1E9 / (System.nanoTime() - lastMinuteTime) * ticksRecord.timed;
|
||||
- final double usedMemory = TimingsManager.FULL_SERVER_TICK.avgUsedMemory;
|
||||
- final double freeMemory = TimingsManager.FULL_SERVER_TICK.avgFreeMemory;
|
||||
- final double loadAvg = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage();
|
||||
@@ -1742,7 +1742,7 @@ index b83e5ff7ada8771fdf27ba9807c77ba6a4ce12da..00000000000000000000000000000000
|
||||
-}
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java
|
||||
deleted file mode 100644
|
||||
index e72ad05abada04426e32a73d02b21cb69079d268..0000000000000000000000000000000000000000
|
||||
index 83a70358e9b7d3d9ae76cf130915b3c33d09a793..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/co/aikar/timings/TimingsManager.java
|
||||
+++ /dev/null
|
||||
@@ -1,192 +0,0 @@
|
||||
@@ -1901,7 +1901,7 @@ index e72ad05abada04426e32a73d02b21cb69079d268..00000000000000000000000000000000
|
||||
- public static Timing getCommandTiming(@Nullable String pluginName, @NotNull Command command) {
|
||||
- Plugin plugin = null;
|
||||
- final Server server = Bukkit.getServer();
|
||||
- if (!( server == null || pluginName == null ||
|
||||
- if (!(server == null || pluginName == null ||
|
||||
- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) ||
|
||||
- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName)
|
||||
- )) {
|
||||
@@ -2910,7 +2910,7 @@ index abe256e1e45ce28036da4aa1586715bc8a1a3414..9eab8024e0675865f17669847759a26d
|
||||
return i >= j && i <= k;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 32c81559507a8e5085c91d466cda69d0dc11327e..7e9f1237f197094318fc41df2e2fa58fbc81e528 100644
|
||||
index 5df19bd701c67506689fc7f49d91f99ebfbc83f0..cfbf141dc47740822efdbb054208fccea917da66 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -39,7 +39,6 @@ public class SimpleCommandMap implements CommandMap {
|
||||
@@ -2929,9 +2929,9 @@ index 32c81559507a8e5085c91d466cda69d0dc11327e..7e9f1237f197094318fc41df2e2fa58f
|
||||
label = label.toLowerCase(Locale.ROOT).trim();
|
||||
fallbackPrefix = fallbackPrefix.toLowerCase(Locale.ROOT).trim();
|
||||
boolean registered = register(label, command, false, fallbackPrefix);
|
||||
@@ -166,23 +164,13 @@ public class SimpleCommandMap implements CommandMap {
|
||||
parsedArgs = event.getArgs();
|
||||
// Purpur end - ExecuteCommandEvent
|
||||
@@ -153,23 +151,13 @@ public class SimpleCommandMap implements CommandMap {
|
||||
return false;
|
||||
}
|
||||
|
||||
- // Paper start - Plugins do weird things to workaround normal registration
|
||||
- if (target.timings == null) {
|
||||
@@ -2942,7 +2942,7 @@ index 32c81559507a8e5085c91d466cda69d0dc11327e..7e9f1237f197094318fc41df2e2fa58f
|
||||
try {
|
||||
- try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources
|
||||
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
|
||||
target.execute(sender, sentCommandLabel, parsedArgs); // Purpur - ExecuteCommandEvent
|
||||
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
|
||||
- } // target.timings.stopTiming(); // Spigot // Paper
|
||||
} catch (CommandException ex) {
|
||||
server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
|
||||
@@ -2998,30 +2998,10 @@ index 2e6d62c4f3687e299c34e876c503b400e13be05a..e7f1a35610d53891d346a3284cca1bca
|
||||
|
||||
// Paper start
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 2fae50a9d1f0d9ecd91036697dedd64bc56f7d3b..bf299cfe88c383d489de0c36fd9a4922cfeab572 100644
|
||||
index ce45dbc7b02c405f1b3460563cf87e7888702ba9..c43ce5b7bed3297cd655a7f2ed4b4717e139bbfd 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -39,11 +39,9 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
import org.bukkit.plugin.SimplePluginManager;
|
||||
-import org.bukkit.plugin.TimedRegisteredListener;
|
||||
import org.bukkit.plugin.UnknownDependencyException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
-import org.spigotmc.CustomTimingsHandler; // Spigot
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
/**
|
||||
@@ -239,7 +237,6 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
Preconditions.checkArgument(plugin != null, "Plugin can not be null");
|
||||
Preconditions.checkArgument(listener != null, "Listener can not be null");
|
||||
|
||||
- boolean useTimings = server.getPluginManager().useTimings();
|
||||
Map<Class<? extends Event>, Set<RegisteredListener>> ret = new HashMap<Class<? extends Event>, Set<RegisteredListener>>();
|
||||
Set<Method> methods;
|
||||
try {
|
||||
@@ -300,7 +297,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -297,7 +297,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3030,21 +3010,15 @@ index 2fae50a9d1f0d9ecd91036697dedd64bc56f7d3b..bf299cfe88c383d489de0c36fd9a4922
|
||||
@Override
|
||||
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper
|
||||
try {
|
||||
@@ -314,12 +311,8 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
@@ -311,7 +311,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
throw new EventException(t);
|
||||
}
|
||||
}
|
||||
- }, plugin, method, eventClass); // Paper
|
||||
- if (false) { // Spigot - RL handles useTimings check now
|
||||
- eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
|
||||
- } else {
|
||||
- eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
|
||||
- }
|
||||
+ }; // Paper // Leaf - Remove Timings
|
||||
+ eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); // Leaf - Remove Timings
|
||||
eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java
|
||||
deleted file mode 100644
|
||||
index 5fbacfcf108432c5187aa9a4092d00d7d5b0fd53..0000000000000000000000000000000000000000
|
||||
@@ -7,13 +7,13 @@ 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 c806e63b5fc44e9e75035346591cbcea9fc12ca2..69f7a2fa54b667f2bb97454d6be9f6322a9aa43d 100644
|
||||
index cb8da28d86d44b3633cf47f75141c9a093c63dab..7d223c7da83b2e51c07aa832da08774bb1e9f206 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -4047,4 +4047,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
sendDeathScreen(message);
|
||||
}
|
||||
// Purpur end
|
||||
@@ -3904,4 +3904,23 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param score New death screen score of player
|
||||
*/
|
||||
void setDeathScreenScore(int score);
|
||||
+
|
||||
+ // Leaf start - KeYi - Player Skull API
|
||||
+ /**
|
||||
@@ -9,10 +9,10 @@ Original project: https://github.com/Cryptite/Slice
|
||||
Co-authored-by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 2a8abee51e8fad62b0aa58a47eadfbac2bf51fdf..716f99b4d09ffd415f8a53a90031c92d8931f125 100644
|
||||
index 7d223c7da83b2e51c07aa832da08774bb1e9f206..9363ba6f227a962668f64ebb672d036c6166e740 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3709,6 +3709,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -3685,6 +3685,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
String getClientBrandName();
|
||||
// Paper end
|
||||
|
||||
@@ -22,14 +22,14 @@ index 107705db2d82b7c191e5e625ec888e0bc3b03831..77a58fc7c173b1724d44b0eeaf23b4a1
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
index 211c093ce2253e918cd40725ebf1ef172d1b9bdf..096140a91f19eb31a10631b949f4402e37e1c601 100644
|
||||
index cfe41c0a67c8d729b6bd23b0cfa32db3c9db9f74..9f167a9cb4a93a79b8ed709b61214ce0138a875d 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
@@ -79,7 +79,19 @@ public class LibraryLoader
|
||||
session.setSystemProperties( System.getProperties() );
|
||||
@@ -74,7 +74,19 @@ public class LibraryLoader {
|
||||
session.setSystemProperties(System.getProperties());
|
||||
session.setReadOnly();
|
||||
|
||||
- this.repositories = repository.newResolutionRepositories( session, Arrays.asList( new RemoteRepository.Builder( "central", "default", "https://repo.maven.apache.org/maven2" ).build() ) );
|
||||
- this.repositories = repository.newResolutionRepositories(session, Arrays.asList(new RemoteRepository.Builder("central", "default", "https://repo.maven.apache.org/maven2").build()));
|
||||
+ // Leaf start - Configurable LibraryLoader maven repos
|
||||
+ this.repositories = repository.newResolutionRepositories(
|
||||
+ session,
|
||||
@@ -9,7 +9,7 @@ Added some asynchronous structure locate methods in World,
|
||||
requires async-locator to be enabled in Leaf config, or else it will fall back to sync methods.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index bc95f529bc7e443a9ec4e8a4a255a32a6c27f355..64ea97cce246d5eab8f45de64bbf92245c3f9330 100644
|
||||
index 50f9f84081573706ebd6f0ebc2cbf6c0596c9691..ed5b17ad660f61c01e86384c0a800e518679d070 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -4077,6 +4077,60 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
Reference in New Issue
Block a user