mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
maybe we API
This commit is contained in:
@@ -64,7 +64,7 @@ Maven
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.purpurmc.purpur</groupId>
|
<groupId>org.purpurmc.purpur</groupId>
|
||||||
<artifactId>purpur-api</artifactId>
|
<artifactId>purpur-api</artifactId>
|
||||||
<version>1.18.2-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
@@ -77,7 +77,7 @@ repositories {
|
|||||||
```
|
```
|
||||||
```kotlin
|
```kotlin
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.purpurmc.purpur", "purpur-api", "1.18.2-R0.1-SNAPSHOT")
|
compileOnly("org.purpurmc.purpur", "purpur-api", "1.19-R0.1-SNAPSHOT")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
remapper("net.fabricmc:tiny-remapper:0.8.2:fat")
|
remapper("net.fabricmc:tiny-remapper:0.8.2:fat")
|
||||||
decompiler("net.minecraftforge:forgeflower:1.5.498.29")
|
decompiler("net.minecraftforge:forgeflower:1.5.605.7")
|
||||||
paperclip("io.papermc:paperclip:3.0.2")
|
paperclip("io.papermc:paperclip:3.0.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
group = org.purpurmc.purpur
|
group = org.purpurmc.purpur
|
||||||
version = 1.18.2-R0.1-SNAPSHOT
|
version = 1.19-R0.1-SNAPSHOT
|
||||||
|
|
||||||
paperCommit = 276d830d223ddf68611beacc248285ae5a4e8a1f
|
paperCommit = a9c507310b02836e37d5d1e3ed9ba9620289fdb1
|
||||||
|
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
|
|||||||
@@ -1,514 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kevin Raneri <kevin.raneri@gmail.com>
|
|
||||||
Date: Tue, 9 Nov 2021 14:01:56 -0500
|
|
||||||
Subject: [PATCH] Pufferfish API Changes
|
|
||||||
|
|
||||||
Pufferfish
|
|
||||||
Copyright (C) 2022 Pufferfish Studios LLC
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
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/>.
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
|
||||||
index 01798255d45f2a642df00156f11dd2bcd8108079..9d7bd0f965c7dc3a60246310688aa5f93a4594a4 100644
|
|
||||||
--- a/build.gradle.kts
|
|
||||||
+++ b/build.gradle.kts
|
|
||||||
@@ -41,6 +41,7 @@ dependencies {
|
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
|
||||||
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
|
|
||||||
|
|
||||||
implementation("org.ow2.asm:asm:9.2")
|
|
||||||
implementation("org.ow2.asm:asm-commons:9.2")
|
|
||||||
@@ -82,6 +83,13 @@ val generateApiVersioningFile by tasks.registering {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+// Pufferfish Start
|
|
||||||
+tasks.withType<JavaCompile> {
|
|
||||||
+ val compilerArgs = options.compilerArgs
|
|
||||||
+ compilerArgs.add("--add-modules=jdk.incubator.vector")
|
|
||||||
+}
|
|
||||||
+// Pufferfish End
|
|
||||||
+
|
|
||||||
tasks.jar {
|
|
||||||
from(generateApiVersioningFile.map { it.outputs.files.singleFile }) {
|
|
||||||
into("META-INF/maven/${project.group}/${project.name}")
|
|
||||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8eb08fb68a
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
|
|
||||||
@@ -0,0 +1,161 @@
|
|
||||||
+package gg.pufferfish.pufferfish.sentry;
|
|
||||||
+
|
|
||||||
+import com.google.gson.Gson;
|
|
||||||
+import java.lang.reflect.Field;
|
|
||||||
+import java.lang.reflect.Modifier;
|
|
||||||
+import java.util.Map;
|
|
||||||
+import java.util.TreeMap;
|
|
||||||
+import org.apache.logging.log4j.ThreadContext;
|
|
||||||
+import org.bukkit.command.Command;
|
|
||||||
+import org.bukkit.command.CommandSender;
|
|
||||||
+import org.bukkit.entity.Player;
|
|
||||||
+import org.bukkit.event.Event;
|
|
||||||
+import org.bukkit.event.player.PlayerEvent;
|
|
||||||
+import org.bukkit.plugin.Plugin;
|
|
||||||
+import org.bukkit.plugin.RegisteredListener;
|
|
||||||
+import org.jetbrains.annotations.Nullable;
|
|
||||||
+
|
|
||||||
+public class SentryContext {
|
|
||||||
+
|
|
||||||
+ private static final Gson GSON = new Gson();
|
|
||||||
+
|
|
||||||
+ public static void setPluginContext(@Nullable Plugin plugin) {
|
|
||||||
+ if (plugin != null) {
|
|
||||||
+ ThreadContext.put("pufferfishsentry_pluginname", plugin.getName());
|
|
||||||
+ ThreadContext.put("pufferfishsentry_pluginversion", plugin.getDescription().getVersion());
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void removePluginContext() {
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_pluginname");
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_pluginversion");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void setSenderContext(@Nullable CommandSender sender) {
|
|
||||||
+ if (sender != null) {
|
|
||||||
+ ThreadContext.put("pufferfishsentry_playername", sender.getName());
|
|
||||||
+ if (sender instanceof Player player) {
|
|
||||||
+ ThreadContext.put("pufferfishsentry_playerid", player.getUniqueId().toString());
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void removeSenderContext() {
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_playername");
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_playerid");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void setEventContext(Event event, RegisteredListener registration) {
|
|
||||||
+ setPluginContext(registration.getPlugin());
|
|
||||||
+
|
|
||||||
+ try {
|
|
||||||
+ // Find the player that was involved with this event
|
|
||||||
+ Player player = null;
|
|
||||||
+ if (event instanceof PlayerEvent) {
|
|
||||||
+ player = ((PlayerEvent) event).getPlayer();
|
|
||||||
+ } else {
|
|
||||||
+ Class<? extends Event> eventClass = event.getClass();
|
|
||||||
+
|
|
||||||
+ Field playerField = null;
|
|
||||||
+
|
|
||||||
+ for (Field field : eventClass.getDeclaredFields()) {
|
|
||||||
+ if (field.getType().equals(Player.class)) {
|
|
||||||
+ playerField = field;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (playerField != null) {
|
|
||||||
+ playerField.setAccessible(true);
|
|
||||||
+ player = (Player) playerField.get(event);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (player != null) {
|
|
||||||
+ setSenderContext(player);
|
|
||||||
+ }
|
|
||||||
+ } catch (Exception e) {} // We can't really safely log exceptions.
|
|
||||||
+
|
|
||||||
+ ThreadContext.put("pufferfishsentry_eventdata", GSON.toJson(serializeFields(event)));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void removeEventContext() {
|
|
||||||
+ removePluginContext();
|
|
||||||
+ removeSenderContext();
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_eventdata");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private static Map<String, String> serializeFields(Object object) {
|
|
||||||
+ Map<String, String> fields = new TreeMap<>();
|
|
||||||
+ fields.put("_class", object.getClass().getName());
|
|
||||||
+ for (Field declaredField : object.getClass().getDeclaredFields()) {
|
|
||||||
+ try {
|
|
||||||
+ if (Modifier.isStatic(declaredField.getModifiers())) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ String fieldName = declaredField.getName();
|
|
||||||
+ if (fieldName.equals("handlers")) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ declaredField.setAccessible(true);
|
|
||||||
+ Object value = declaredField.get(object);
|
|
||||||
+ if (value != null) {
|
|
||||||
+ fields.put(fieldName, value.toString());
|
|
||||||
+ } else {
|
|
||||||
+ fields.put(fieldName, "<null>");
|
|
||||||
+ }
|
|
||||||
+ } catch (Exception e) {} // We can't really safely log exceptions.
|
|
||||||
+ }
|
|
||||||
+ return fields;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static class State {
|
|
||||||
+
|
|
||||||
+ private Plugin plugin;
|
|
||||||
+ private Command command;
|
|
||||||
+ private String commandLine;
|
|
||||||
+ private Event event;
|
|
||||||
+ private RegisteredListener registeredListener;
|
|
||||||
+
|
|
||||||
+ public Plugin getPlugin() {
|
|
||||||
+ return plugin;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setPlugin(Plugin plugin) {
|
|
||||||
+ this.plugin = plugin;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public Command getCommand() {
|
|
||||||
+ return command;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setCommand(Command command) {
|
|
||||||
+ this.command = command;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public String getCommandLine() {
|
|
||||||
+ return commandLine;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setCommandLine(String commandLine) {
|
|
||||||
+ this.commandLine = commandLine;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public Event getEvent() {
|
|
||||||
+ return event;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setEvent(Event event) {
|
|
||||||
+ this.event = event;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public RegisteredListener getRegisteredListener() {
|
|
||||||
+ return registeredListener;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setRegisteredListener(RegisteredListener registeredListener) {
|
|
||||||
+ this.registeredListener = registeredListener;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
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..93f5d7ca36e043e6c0f959450d38e6946b348eaf
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
|
|
||||||
@@ -0,0 +1,40 @@
|
|
||||||
+package gg.pufferfish.pufferfish.simd;
|
|
||||||
+
|
|
||||||
+import java.util.logging.Level;
|
|
||||||
+import java.util.logging.Logger;
|
|
||||||
+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 {
|
|
||||||
+
|
|
||||||
+ @Deprecated
|
|
||||||
+ public static boolean canEnable(Logger logger) {
|
|
||||||
+ try {
|
|
||||||
+ if (SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18) {
|
|
||||||
+ return false;
|
|
||||||
+ } else {
|
|
||||||
+ SIMDDetection.testRun = true;
|
|
||||||
+
|
|
||||||
+ VectorSpecies<Integer> ISPEC = IntVector.SPECIES_PREFERRED;
|
|
||||||
+ VectorSpecies<Float> FSPEC = FloatVector.SPECIES_PREFERRED;
|
|
||||||
+
|
|
||||||
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + ISPEC.vectorBitSize() + " bits (int)");
|
|
||||||
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + FSPEC.vectorBitSize() + " bits (float)");
|
|
||||||
+
|
|
||||||
+ if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) {
|
|
||||||
+ logger.log(Level.WARNING, "SIMD is not properly supported on this system!");
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ } catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
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..a84889d3e9cfc4d7ab5f867820a6484c6070711b
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
|
|
||||||
@@ -0,0 +1,35 @@
|
|
||||||
+package gg.pufferfish.pufferfish.simd;
|
|
||||||
+
|
|
||||||
+import java.util.logging.Logger;
|
|
||||||
+
|
|
||||||
+@Deprecated
|
|
||||||
+public class SIMDDetection {
|
|
||||||
+
|
|
||||||
+ public static boolean isEnabled = false;
|
|
||||||
+ public static boolean versionLimited = false;
|
|
||||||
+ public static boolean testRun = false;
|
|
||||||
+
|
|
||||||
+ @Deprecated
|
|
||||||
+ public static boolean canEnable(Logger logger) {
|
|
||||||
+ try {
|
|
||||||
+ return SIMDChecker.canEnable(logger);
|
|
||||||
+ } catch (NoClassDefFoundError | Exception ignored) {
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Deprecated
|
|
||||||
+ 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);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
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..ae2464920c9412ac90b819a540ee58be0741465f
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
|
|
||||||
@@ -0,0 +1,83 @@
|
|
||||||
+package gg.pufferfish.pufferfish.simd;
|
|
||||||
+
|
|
||||||
+import java.awt.Color;
|
|
||||||
+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;
|
|
||||||
+
|
|
||||||
+@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 b937441d2fb46b108644c49fcf073859765aa02e..d95b01bfd0657cf089c0f5412453cca08e36c02f 100644
|
|
||||||
--- a/src/main/java/org/bukkit/map/MapPalette.java
|
|
||||||
+++ b/src/main/java/org/bukkit/map/MapPalette.java
|
|
||||||
@@ -1,5 +1,6 @@
|
|
||||||
package org.bukkit.map;
|
|
||||||
|
|
||||||
+import gg.pufferfish.pufferfish.simd.SIMDDetection;
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Image;
|
|
||||||
@@ -34,7 +35,7 @@ public final class MapPalette {
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
- static final Color[] colors = {
|
|
||||||
+ public static final Color[] colors = { // Pufferfish - public access
|
|
||||||
c(0, 0, 0), c(0, 0, 0), c(0, 0, 0), c(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),
|
|
||||||
@@ -205,9 +206,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()];
|
|
||||||
+ // Pufferfish start
|
|
||||||
+ if (!SIMDDetection.isEnabled) {
|
|
||||||
for (int i = 0; i < pixels.length; i++) {
|
|
||||||
result[i] = matchColor(new Color(pixels[i], true));
|
|
||||||
}
|
|
||||||
+ } else {
|
|
||||||
+ gg.pufferfish.pufferfish.simd.VectorMapPalette.matchColorVectorized(pixels, result);
|
|
||||||
+ }
|
|
||||||
+ // Pufferfish end
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
||||||
index bab8bb3a52cdeef5f7052d4e3f404c42f37d117d..dba9041784e7d3051b5248cbc24e4879e60103c1 100644
|
|
||||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
||||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
||||||
@@ -622,7 +622,9 @@ public final class SimplePluginManager implements PluginManager {
|
|
||||||
|
|
||||||
// Paper start
|
|
||||||
private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
|
|
||||||
server.getLogger().log(Level.SEVERE, msg, ex);
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
|
||||||
callEvent(new ServerExceptionEvent(new ServerPluginEnableDisableException(msg, ex, plugin)));
|
|
||||||
}
|
|
||||||
// Paper end
|
|
||||||
@@ -681,9 +683,11 @@ public final class SimplePluginManager implements PluginManager {
|
|
||||||
));
|
|
||||||
}
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.setEventContext(event, registration); // Pufferfish
|
|
||||||
// Paper start - error reporting
|
|
||||||
String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
|
|
||||||
server.getLogger().log(Level.SEVERE, msg, ex);
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.removeEventContext(); // Pufferfish
|
|
||||||
if (!(event instanceof ServerExceptionEvent)) { // We don't want to cause an endless event loop
|
|
||||||
callEvent(new ServerExceptionEvent(new 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 c8b11793c6a3baabc1c9566e0463ab1d6e293827..2b9218ddd262e89180588c3014dad328317dd8db 100644
|
|
||||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
||||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
||||||
@@ -369,7 +369,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
|
||||||
try {
|
|
||||||
jPlugin.setEnabled(true);
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
|
|
||||||
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
|
||||||
// Paper start - Disable plugins that fail to load
|
|
||||||
this.server.getPluginManager().disablePlugin(jPlugin);
|
|
||||||
return;
|
|
||||||
@@ -398,7 +400,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
|
||||||
try {
|
|
||||||
jPlugin.setEnabled(false);
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
|
|
||||||
server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cloader instanceof PluginClassLoader) {
|
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
||||||
index 9938ebb38353f4aa2adf1bb08cd1c347ddd9fc88..dc76cdbe93a0229a8ff552e4048613e3d8e050ce 100644
|
|
||||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
||||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
||||||
@@ -46,6 +46,8 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
|
||||||
private final Set<String> seenIllegalAccess = Collections.newSetFromMap(new ConcurrentHashMap<>());
|
|
||||||
private java.util.logging.Logger logger; // Paper - add field
|
|
||||||
|
|
||||||
+ private boolean closed = false; // Pufferfish
|
|
||||||
+
|
|
||||||
static {
|
|
||||||
ClassLoader.registerAsParallelCapable();
|
|
||||||
}
|
|
||||||
@@ -151,6 +153,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
|
||||||
throw new ClassNotFoundException(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public boolean _airplane_hasClass(@NotNull String name) { return this.classes.containsKey(name); } // Pufferfish
|
|
||||||
@Override
|
|
||||||
protected Class<?> findClass(String name) throws ClassNotFoundException {
|
|
||||||
if (name.startsWith("org.bukkit.") || name.startsWith("net.minecraft.")) {
|
|
||||||
@@ -158,7 +161,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
|
||||||
}
|
|
||||||
Class<?> result = classes.get(name);
|
|
||||||
|
|
||||||
- if (result == null) {
|
|
||||||
+ if (result == null && !this.closed) { // Pufferfish
|
|
||||||
String path = name.replace('.', '/').concat(".class");
|
|
||||||
JarEntry entry = jar.getJarEntry(path);
|
|
||||||
|
|
||||||
@@ -213,6 +216,7 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
|
||||||
try {
|
|
||||||
super.close();
|
|
||||||
} finally {
|
|
||||||
+ this.closed = true; // Pufferfish
|
|
||||||
jar.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Build System Changes
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 0007c6b1d81373cb6592c8b9e02f464405050f68..30d3086fae6aaac493a3ad536447911ef5b2c1b1 100644
|
index ac0a4aea48436201b5712b166413bb7dc0d0b9d8..6326d99ed2fb157da200bb53d67a639a2c3d6cc1 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -102,6 +102,8 @@ tasks.jar {
|
@@ -93,6 +93,8 @@ tasks.jar {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<Javadoc> {
|
tasks.withType<Javadoc> {
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Bring back server name
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
index d8666481f9a407403d0114ff02024fd3c50c27c4..a1374b608c20d47fde15135089bf8aceb98d6129 100644
|
index a87399fa4838d4b2c1ff9cc35d433ae76cc149bf..2d9a065aa8c6a835e49eee76acdf8cfa6af420bf 100644
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -2368,4 +2368,15 @@ public final class Bukkit {
|
@@ -2368,4 +2368,15 @@ public final class Bukkit {
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] ExecuteCommandEvent
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||||
index 74252236b138969560e6513f24e7ecc6dc4a4127..9c3d02b949fe806e17200d0ff6127fc367ef2abc 100644
|
index b8623575b1c1b565560c2dd6438190716845a652..0bc24d0effe9b2e44c41a1c00060b0ebf7395c4a 100644
|
||||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||||
@@ -147,6 +147,19 @@ public class SimpleCommandMap implements CommandMap {
|
@@ -143,6 +143,19 @@ public class SimpleCommandMap implements CommandMap {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ index 74252236b138969560e6513f24e7ecc6dc4a4127..9c3d02b949fe806e17200d0ff6127fc3
|
|||||||
// Paper start - Plugins do weird things to workaround normal registration
|
// Paper start - Plugins do weird things to workaround normal registration
|
||||||
if (target.timings == null) {
|
if (target.timings == null) {
|
||||||
target.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, target);
|
target.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, target);
|
||||||
@@ -156,7 +169,7 @@ public class SimpleCommandMap implements CommandMap {
|
@@ -152,7 +165,7 @@ public class SimpleCommandMap implements CommandMap {
|
||||||
try {
|
try {
|
||||||
try (co.aikar.timings.Timing ignored = target.timings.startTiming()) { // Paper - use try with resources
|
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)
|
// Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false)
|
||||||
@@ -36,7 +36,7 @@ index 74252236b138969560e6513f24e7ecc6dc4a4127..9c3d02b949fe806e17200d0ff6127fc3
|
|||||||
+ target.execute(sender, sentCommandLabel, parsedArgs); // Purpur
|
+ target.execute(sender, sentCommandLabel, parsedArgs); // Purpur
|
||||||
} // target.timings.stopTiming(); // Spigot // Paper
|
} // target.timings.stopTiming(); // Spigot // Paper
|
||||||
} catch (CommandException ex) {
|
} catch (CommandException ex) {
|
||||||
server.getPluginManager().callEvent(new ServerExceptionEvent(new ServerCommandException(ex, target, sender, args))); // Paper
|
server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/event/ExecuteCommandEvent.java b/src/main/java/org/purpurmc/purpur/event/ExecuteCommandEvent.java
|
diff --git a/src/main/java/org/purpurmc/purpur/event/ExecuteCommandEvent.java b/src/main/java/org/purpurmc/purpur/event/ExecuteCommandEvent.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..103d5699d0993f358749b3d288b924e48b734693
|
index 0000000000000000000000000000000000000000..103d5699d0993f358749b3d288b924e48b734693
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Lagging threshold
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
index a1374b608c20d47fde15135089bf8aceb98d6129..e7bca7fc74a6a2914c966183c9f83340dd510bf0 100644
|
index 2d9a065aa8c6a835e49eee76acdf8cfa6af420bf..cd7e04aa1de8f051ff4bb23f36912830ab573987 100644
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -2378,5 +2378,14 @@ public final class Bukkit {
|
@@ -2378,5 +2378,14 @@ public final class Bukkit {
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack convenience methods
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||||
index a39e7af2529fb8e65641d76f78e2d8eb12900853..8418eecabcb5319ef4db0785f4350920fa433278 100644
|
index 2d39ecea67cd033858eaa713e405260a87c718a3..b20b3d54342a8c81d1ff4062028c7b7d2eec4fe5 100644
|
||||||
--- a/src/main/java/org/bukkit/Material.java
|
--- a/src/main/java/org/bukkit/Material.java
|
||||||
+++ b/src/main/java/org/bukkit/Material.java
|
+++ b/src/main/java/org/bukkit/Material.java
|
||||||
@@ -9871,4 +9871,39 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata
|
@@ -10219,4 +10219,39 @@ public enum Material implements Keyed, net.kyori.adventure.translation.Translata
|
||||||
return Bukkit.getUnsafe().getCreativeCategory(this);
|
return Bukkit.getUnsafe().getCreativeCategory(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,10 +49,10 @@ index a39e7af2529fb8e65641d76f78e2d8eb12900853..8418eecabcb5319ef4db0785f4350920
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||||
index 62841846ec3e14daa46564509671cab146984cc6..6ebfa971cf5bd8dac84eb29402b764feb5e6b974 100644
|
index b8a344fd900dcbd4b28085a54b85b16c742e9c6f..346788b5524248e5dd431927ab206f073db01c38 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||||
@@ -17,6 +17,18 @@ import org.bukkit.inventory.meta.ItemMeta;
|
@@ -16,6 +16,18 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.material.MaterialData;
|
import org.bukkit.material.MaterialData;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -71,7 +71,7 @@ index 62841846ec3e14daa46564509671cab146984cc6..6ebfa971cf5bd8dac84eb29402b764fe
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a stack of items.
|
* Represents a stack of items.
|
||||||
@@ -979,4 +991,626 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
@@ -978,4 +990,626 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||||
return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this);
|
return Bukkit.getUnsafe().isValidRepairItemStack(toBeRepaired, this);
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
@@ -5,17 +5,17 @@ Subject: [PATCH] ChatColor conveniences
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
|
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
|
||||||
index 4594701d77c5d0f744bece871b98d9f6f73eb5a7..924af5982b1990492cafe6ef8d9f284f7933e7c4 100644
|
index f6eb30f53dad684f156102cf7147b2f00c82c71e..f1239a2618b08fa92e0e20692d1c3d20d1558502 100644
|
||||||
--- a/src/main/java/org/bukkit/ChatColor.java
|
--- a/src/main/java/org/bukkit/ChatColor.java
|
||||||
+++ b/src/main/java/org/bukkit/ChatColor.java
|
+++ b/src/main/java/org/bukkit/ChatColor.java
|
||||||
@@ -2,6 +2,7 @@ package org.bukkit;
|
@@ -3,6 +3,7 @@ package org.bukkit;
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
+import java.util.regex.Matcher;
|
+import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -413,4 +414,77 @@ public enum ChatColor {
|
@@ -413,4 +414,77 @@ public enum ChatColor {
|
||||||
BY_CHAR.put(color.code, color);
|
BY_CHAR.put(color.code, color);
|
||||||
}
|
}
|
||||||
@@ -591,7 +591,7 @@ index 943d324435350d3f16fad3e21cb472a01a3ff60b..9f66a44977ab3248ce41733e424b5b71
|
|||||||
this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper
|
this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
|
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
|
||||||
index 172697ac5dc0ea3551a61b5589416ac68f372cd1..fffe2ab5a9f282b60d5d7ae316c063d8945a65c0 100644
|
index 12cdae95c338d21684991d34aea5a643f4b4bcd3..f88356e5be4d33f403617b004e5cd76fe17f2e24 100644
|
||||||
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
|
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
|
||||||
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
|
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
|
||||||
@@ -113,7 +113,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
|
@@ -113,7 +113,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
|
||||||
@@ -22,30 +22,30 @@ index a736d7bcdc5861a01b66ba36158db1c716339346..22fc165fd9c95f0f3ae1be7a0857e48c
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||||
index 57a21495843f3a144cd73473cdc8781d6129b7ca..b7fa160a305ee89004c11a3d8a01ac3b721f59b6 100644
|
index e40f017f87d6b6b4770501b106c76dc69ec69abb..eac5830986cd0638950bbb1e6f10a30e246e09a7 100644
|
||||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||||
@@ -199,7 +199,7 @@ public class VersionCommand extends BukkitCommand {
|
@@ -198,7 +198,7 @@ public class VersionCommand extends BukkitCommand {
|
||||||
String version = Bukkit.getVersion();
|
String version = Bukkit.getVersion();
|
||||||
// Paper start
|
// Paper start
|
||||||
if (version.startsWith("null")) { // running from ide?
|
if (version.startsWith("null")) { // running from ide?
|
||||||
- setVersionMessage(Component.text("Unknown version, custom build?", net.kyori.adventure.text.format.NamedTextColor.YELLOW));
|
- setVersionMessage(net.kyori.adventure.text.Component.text("Unknown version, custom build?", net.kyori.adventure.text.format.NamedTextColor.YELLOW));
|
||||||
+ setVersionMessage(Component.text("* Unknown version, custom build?", net.kyori.adventure.text.format.NamedTextColor.RED)); // Purpur
|
+ setVersionMessage(net.kyori.adventure.text.Component.text("* Unknown version, custom build?", net.kyori.adventure.text.format.NamedTextColor.RED)); // Purpur
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setVersionMessage(getVersionFetcher().getVersionMessage(version));
|
setVersionMessage(getVersionFetcher().getVersionMessage(version));
|
||||||
@@ -240,9 +240,11 @@ public class VersionCommand extends BukkitCommand {
|
@@ -239,9 +239,11 @@ public class VersionCommand extends BukkitCommand {
|
||||||
// Paper start
|
// Paper start
|
||||||
private void setVersionMessage(final @NotNull Component msg) {
|
private void setVersionMessage(final @NotNull net.kyori.adventure.text.Component msg) {
|
||||||
lastCheck = System.currentTimeMillis();
|
lastCheck = System.currentTimeMillis();
|
||||||
- final Component message = net.kyori.adventure.text.TextComponent.ofChildren(
|
- final net.kyori.adventure.text.Component message = net.kyori.adventure.text.TextComponent.ofChildren(
|
||||||
- Component.text(Bukkit.getVersionMessage(), net.kyori.adventure.text.format.NamedTextColor.WHITE),
|
- net.kyori.adventure.text.Component.text(Bukkit.getVersionMessage(), net.kyori.adventure.text.format.NamedTextColor.WHITE),
|
||||||
- Component.newline(),
|
- net.kyori.adventure.text.Component.newline(),
|
||||||
+ // Purpur start
|
+ // Purpur start
|
||||||
+ int distance = getVersionFetcher().distance();
|
+ int distance = getVersionFetcher().distance();
|
||||||
+ final Component message = Component.join(net.kyori.adventure.text.JoinConfiguration.separator(Component.newline()),
|
+ final net.kyori.adventure.text.Component message = net.kyori.adventure.text.Component.join(net.kyori.adventure.text.JoinConfiguration.separator(net.kyori.adventure.text.Component.newline()),
|
||||||
+ ChatColor.parseMM("<grey>Current: %s%s*", distance == 0 ? "<green>" : distance > 0 ? "<yellow>" : "<red>", Bukkit.getVersion()),
|
+ ChatColor.parseMM("<grey>Current: %s%s*", distance == 0 ? "<green>" : distance > 0 ? "<yellow>" : "<red>", Bukkit.getVersion()),
|
||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
msg
|
msg
|
||||||
);
|
);
|
||||||
this.versionMessage = Component.text()
|
this.versionMessage = net.kyori.adventure.text.Component.text()
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Added the ability to add combustible items
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
index 9189ada0644a226038eeb7967d45c72ddfc89085..8c37680ca16adbf030cfd3098330d2592d4aaa23 100644
|
index 9ff99a1ea5183042d7eea89bb310386c6630663a..c17e49f1eea2a70c70eea84820fc17fd5e263304 100644
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -2387,5 +2387,24 @@ public final class Bukkit {
|
@@ -2387,5 +2387,24 @@ public final class Bukkit {
|
||||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Potion NamespacedKey
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java
|
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||||
index 74767751199bce03d63f2a9524712656193f850c..52a31aa6d77e6c9afac78e76829d0265e903b029 100644
|
index 24e36cdf580da885ac64002673a786b9c5a3f787..d20cc4d4f5b37a3de9cb3cf47af7a908e9dbc2fc 100644
|
||||||
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
|
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||||
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
|
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||||
@@ -5,6 +5,7 @@ import java.util.Map;
|
@@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
+import org.bukkit.NamespacedKey;
|
+import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
||||||
@@ -65,7 +65,7 @@ index 74767751199bce03d63f2a9524712656193f850c..52a31aa6d77e6c9afac78e76829d0265
|
|||||||
+ */
|
+ */
|
||||||
+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable NamespacedKey key) {
|
+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable NamespacedKey key) {
|
||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
Validate.notNull(type, "effect type cannot be null");
|
Preconditions.checkArgument(type != null, "effect type cannot be null");
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
@@ -51,6 +84,7 @@ public class PotionEffect implements ConfigurationSerializable {
|
@@ -51,6 +84,7 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||||
0
patches/server/.keep
Normal file
0
patches/server/.keep
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,112 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Nahuel <nahueldolores@hotmail.com>
|
|
||||||
Date: Sat, 9 Jan 2021 15:33:52 +0100
|
|
||||||
Subject: [PATCH] Add StructureGenerateEvent
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
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 <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/event/world/WorldEvent.java b/src/main/java/org/bukkit/event/world/WorldEvent.java
|
|
||||||
index cffeff33f007d3b03b7c862b25be453f705da739..1fa083d53dce161ef9e9f19407f230c94b2d7d15 100644
|
|
||||||
--- a/src/main/java/org/bukkit/event/world/WorldEvent.java
|
|
||||||
+++ b/src/main/java/org/bukkit/event/world/WorldEvent.java
|
|
||||||
@@ -10,6 +10,13 @@ import org.jetbrains.annotations.NotNull;
|
|
||||||
public abstract class WorldEvent extends Event {
|
|
||||||
private final World world;
|
|
||||||
|
|
||||||
+ // Purpur start
|
|
||||||
+ public WorldEvent(boolean isAsync, @NotNull final World world) {
|
|
||||||
+ super(isAsync);
|
|
||||||
+ this.world = world;
|
|
||||||
+ }
|
|
||||||
+ // Purpur end
|
|
||||||
+
|
|
||||||
public WorldEvent(@NotNull final World world) {
|
|
||||||
this.world = world;
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/event/world/StructureGenerateEvent.java b/src/main/java/org/purpurmc/purpur/event/world/StructureGenerateEvent.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..c49d0da74f59e06176e616f80dffd65c918e1389
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/event/world/StructureGenerateEvent.java
|
|
||||||
@@ -0,0 +1,68 @@
|
|
||||||
+package org.purpurmc.purpur.event.world;
|
|
||||||
+
|
|
||||||
+import org.bukkit.Bukkit;
|
|
||||||
+import org.bukkit.StructureType;
|
|
||||||
+import org.bukkit.World;
|
|
||||||
+import org.bukkit.event.Cancellable;
|
|
||||||
+import org.bukkit.event.HandlerList;
|
|
||||||
+import org.bukkit.event.world.WorldEvent;
|
|
||||||
+import org.jetbrains.annotations.NotNull;
|
|
||||||
+
|
|
||||||
+public class StructureGenerateEvent extends WorldEvent implements Cancellable {
|
|
||||||
+ private static final HandlerList handlers = new HandlerList();
|
|
||||||
+
|
|
||||||
+ @NotNull
|
|
||||||
+ private final StructureType structureType;
|
|
||||||
+ private final int chunkX;
|
|
||||||
+ private final int chunkZ;
|
|
||||||
+
|
|
||||||
+ private boolean cancel = false;
|
|
||||||
+
|
|
||||||
+ public StructureGenerateEvent(@NotNull World world,
|
|
||||||
+ @NotNull StructureType structureType, int chunkX, int chunkZ) {
|
|
||||||
+ super(!Bukkit.isPrimaryThread(), world); // Structure generation is not necessarily on the main thread as of 1.16.
|
|
||||||
+ this.structureType = structureType;
|
|
||||||
+ this.chunkX = chunkX;
|
|
||||||
+ this.chunkZ = chunkZ;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @NotNull
|
|
||||||
+ @Override
|
|
||||||
+ public World getWorld() {
|
|
||||||
+ return super.getWorld();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @NotNull
|
|
||||||
+ public StructureType getStructureType() {
|
|
||||||
+ return structureType;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public int getChunkX() {
|
|
||||||
+ return chunkX;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public int getChunkZ() {
|
|
||||||
+ return chunkZ;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public void setCancelled(boolean cancel) {
|
|
||||||
+ this.cancel = cancel;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public boolean isCancelled() {
|
|
||||||
+ return this.cancel;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @NotNull
|
|
||||||
+ @Override
|
|
||||||
+ public HandlerList getHandlers() {
|
|
||||||
+ return handlers;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @NotNull
|
|
||||||
+ public static HandlerList getHandlerList() {
|
|
||||||
+ return handlers;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user