-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
3,568 additions
and
2,785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: AlphaKR93 <[email protected]> | ||
Date: Sat, 23 Sep 2023 10:20:55 +0000 | ||
From: Kevin Raneri <[email protected]> | ||
Date: Wed, 27 Sep 2023 05:21:18 +0000 | ||
Subject: [PATCH] Pufferfish API Changes | ||
|
||
Original: Kevin Raneri <[email protected]> | ||
|
@@ -20,7 +20,7 @@ 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 aed834334385ff3038ae69f3f34d129ad2507960..1ae1907f94a19c37b5820cfb3e9df3bd6bb1a49d 100644 | ||
index 639651972fddce4dff63a0f0a7e566a15b9e2dd6..6c0df825238ca037abeb2ba619983b6f554180ea 100644 | ||
--- a/build.gradle.kts | ||
+++ b/build.gradle.kts | ||
@@ -46,6 +46,7 @@ dependencies { | ||
|
@@ -31,26 +31,21 @@ index aed834334385ff3038ae69f3f34d129ad2507960..1ae1907f94a19c37b5820cfb3e9df3bd | |
|
||
implementation("org.ow2.asm:asm:9.4") | ||
implementation("org.ow2.asm:asm-commons:9.4") | ||
@@ -89,6 +90,13 @@ val generateApiVersioningFile by tasks.registering { | ||
} | ||
} | ||
@@ -102,6 +103,8 @@ tasks.jar { | ||
|
||
+// 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}") | ||
tasks.withType<Javadoc> { | ||
val options = options as StandardJavadocDocletOptions | ||
+ options.addStringOption("-add-modules", "jdk.incubator.vector") // Pufferfish | ||
+ options.addStringOption("Xdoclint:none", "-quiet") // Pufferfish | ||
options.overview = "src/main/javadoc/overview.html" | ||
options.use() | ||
options.isDocFilesSubDirs = true | ||
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 | ||
index 0000000000000000000000000000000000000000..ff42019da93c365ea1365e2e0f7c51b196a10948 | ||
--- /dev/null | ||
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java | ||
@@ -0,0 +1,161 @@ | ||
@@ -0,0 +1,162 @@ | ||
+package gg.pufferfish.pufferfish.sentry; | ||
+ | ||
+import com.google.gson.Gson; | ||
|
@@ -66,6 +61,7 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e | |
+import org.bukkit.event.player.PlayerEvent; | ||
+import org.bukkit.plugin.Plugin; | ||
+import org.bukkit.plugin.RegisteredListener; | ||
+import org.jetbrains.annotations.NotNull; | ||
+import org.jetbrains.annotations.Nullable; | ||
+ | ||
+public class SentryContext { | ||
|
@@ -98,7 +94,7 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e | |
+ ThreadContext.remove("pufferfishsentry_playerid"); | ||
+ } | ||
+ | ||
+ public static void setEventContext(Event event, RegisteredListener registration) { | ||
+ public static void setEventContext(@NotNull Event event, @NotNull RegisteredListener registration) { | ||
+ setPluginContext(registration.getPlugin()); | ||
+ | ||
+ try { | ||
|
@@ -171,43 +167,43 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e | |
+ private Event event; | ||
+ private RegisteredListener registeredListener; | ||
+ | ||
+ public Plugin getPlugin() { | ||
+ public @Nullable Plugin getPlugin() { | ||
+ return plugin; | ||
+ } | ||
+ | ||
+ public void setPlugin(Plugin plugin) { | ||
+ public void setPlugin(@Nullable Plugin plugin) { | ||
+ this.plugin = plugin; | ||
+ } | ||
+ | ||
+ public Command getCommand() { | ||
+ public @Nullable Command getCommand() { | ||
+ return command; | ||
+ } | ||
+ | ||
+ public void setCommand(Command command) { | ||
+ public void setCommand(@Nullable Command command) { | ||
+ this.command = command; | ||
+ } | ||
+ | ||
+ public String getCommandLine() { | ||
+ public @Nullable String getCommandLine() { | ||
+ return commandLine; | ||
+ } | ||
+ | ||
+ public void setCommandLine(String commandLine) { | ||
+ public void setCommandLine(@Nullable String commandLine) { | ||
+ this.commandLine = commandLine; | ||
+ } | ||
+ | ||
+ public Event getEvent() { | ||
+ public @Nullable Event getEvent() { | ||
+ return event; | ||
+ } | ||
+ | ||
+ public void setEvent(Event event) { | ||
+ public void setEvent(@Nullable Event event) { | ||
+ this.event = event; | ||
+ } | ||
+ | ||
+ public RegisteredListener getRegisteredListener() { | ||
+ public @Nullable RegisteredListener getRegisteredListener() { | ||
+ return registeredListener; | ||
+ } | ||
+ | ||
+ public void setRegisteredListener(RegisteredListener registeredListener) { | ||
+ public void setRegisteredListener(@Nullable RegisteredListener registeredListener) { | ||
+ this.registeredListener = registeredListener; | ||
+ } | ||
+ } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: AlphaKR93 <[email protected]> | ||
Date: Sat, 23 Sep 2023 10:28:31 +0000 | ||
From: William Blake Galbreath <[email protected]> | ||
Date: Wed, 27 Sep 2023 05:28:53 +0000 | ||
Subject: [PATCH] Purpur API Changes | ||
|
||
Original: PurpurMC | ||
|
@@ -24,19 +24,6 @@ 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/build.gradle.kts b/build.gradle.kts | ||
index 1ae1907f94a19c37b5820cfb3e9df3bd6bb1a49d..dfb989a18ab17fec3b8f0cf90ce2fc1048215265 100644 | ||
--- a/build.gradle.kts | ||
+++ b/build.gradle.kts | ||
@@ -109,6 +109,8 @@ tasks.jar { | ||
} | ||
|
||
tasks.withType<Javadoc> { | ||
+ (options as StandardJavadocDocletOptions).addStringOption("-add-modules", "jdk.incubator.vector") // Purpur - our javadocs need this for pufferfish's SIMD patch | ||
+ (options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet") // Purpur - silence Paper's bajillion javadoc warnings | ||
val options = options as StandardJavadocDocletOptions | ||
options.overview = "src/main/javadoc/overview.html" | ||
options.use() | ||
diff --git a/src/main/java/co/aikar/timings/TimedEventExecutor.java b/src/main/java/co/aikar/timings/TimedEventExecutor.java | ||
index 8f29c1561ba5916cb5634392edd8bd2a5a294a51..6fbc64e0f214d0c8e5afcbe385e414a4e1fe1c72 100644 | ||
--- a/src/main/java/co/aikar/timings/TimedEventExecutor.java | ||
|
@@ -169,10 +156,10 @@ index e801e79fa57c44b2e5d359647c920f88064826f1..1abfcee0f6d632f4cd8d74b4994a90c9 | |
new ArrayList<String>(TIMINGS_SUBCOMMANDS.size())); | ||
} | ||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java | ||
index b7a2cecb334ce39fa09d8ab949a29eedbdc44c36..b1f35c68373edfe666ca05b50f0ec022a1859ce9 100644 | ||
index 0c4dbb9ef63fa8575b5546239443cb2bd91ba847..b347224c223569297ee67ac630a710fdf28748ea 100644 | ||
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java | ||
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java | ||
@@ -201,6 +201,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> { | ||
@@ -198,6 +198,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> { | ||
GoalKey<Mob> CLIMB_ON_TOP_OF_POWDER_SNOW = GoalKey.of(Mob.class, NamespacedKey.minecraft("climb_on_top_of_powder_snow")); | ||
GoalKey<Wolf> WOLF_PANIC = GoalKey.of(Wolf.class, NamespacedKey.minecraft("wolf_panic")); | ||
|
||
|
@@ -189,7 +176,7 @@ index b7a2cecb334ce39fa09d8ab949a29eedbdc44c36..b1f35c68373edfe666ca05b50f0ec022 | |
+ // Purpur end | ||
+ | ||
/** | ||
* @deprecated removed in 1.16 | ||
* @deprecated removed in 1.20.2 | ||
*/ | ||
diff --git a/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java | ||
index a736d7bcdc5861a01b66ba36158db1c716339346..22fc165fd9c95f0f3ae1be7a0857e48cc50fad5b 100644 | ||
|
@@ -431,10 +418,10 @@ index 918a045165cdcde264bc24082b7afebb407271de..687d11619379aead7f665d4a5f8f8bcc | |
+ // Purpur end | ||
} | ||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java | ||
index 03b47012447430a350e152920f754d993d4023db..3ad843d519e239430c5f4f5754a8da3026ed0f8e 100644 | ||
index 060a77008871682cc2deac72833a3641031408de..865512385d08c6f93c30e1eb83f604e354b60d9b 100644 | ||
--- a/src/main/java/org/bukkit/Material.java | ||
+++ b/src/main/java/org/bukkit/Material.java | ||
@@ -11047,4 +11047,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla | ||
@@ -11050,4 +11050,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla | ||
public boolean isEnabledByFeature(@NotNull World world) { | ||
return Bukkit.getDataPackManager().isEnabledByFeature(this, world); | ||
} | ||
|
@@ -724,7 +711,7 @@ index 8d8fe04e6b09d2a5b1cc05002073df5c58cdcb96..aaef58468a3c31f35e5067ed4263e9dd | |
+ // Purpur end | ||
} | ||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java | ||
index b8b97df069b28fa3cf32f1ad1f01f586a0cfbc78..63bf1d70cce9176f47a158a4a767b1bf38d60dbd 100644 | ||
index da524a71af74b02515b037f7fe09ba6988e2c8bf..3679c3b8d31ab8de08ecabd56bf92ffc062f971c 100644 | ||
--- a/src/main/java/org/bukkit/World.java | ||
+++ b/src/main/java/org/bukkit/World.java | ||
@@ -4008,6 +4008,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient | ||
|
@@ -1200,10 +1187,10 @@ index bc84b892cae5fe7019a3ad481e9da79956efa1fe..48eb5b00c460cccde29d327cef1d63fc | |
+ // Purpur end | ||
} | ||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java | ||
index f59cbc92334c7b7b20e593a58232fb3c4434f12b..d3d5d2c78cc4ee36beaa355ef7e61ef13332abab 100644 | ||
index 20fa1024f9ad8f478a347be5c554b5e45b398a1c..0df709ed758401f04b3f565dc1f6492a55f5363c 100644 | ||
--- a/src/main/java/org/bukkit/entity/Player.java | ||
+++ b/src/main/java/org/bukkit/entity/Player.java | ||
@@ -3273,4 +3273,143 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM | ||
@@ -3278,4 +3278,122 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM | ||
@Override | ||
Spigot spigot(); | ||
// Spigot end | ||
|
@@ -1236,27 +1223,6 @@ index f59cbc92334c7b7b20e593a58232fb3c4434f12b..d3d5d2c78cc4ee36beaa355ef7e61ef1 | |
+ void resetIdleTimer(); | ||
+ | ||
+ /** | ||
+ * Check if player is invulnerable from recently spawning or accepting a resource pack | ||
+ * | ||
+ * @return True if invulnerable | ||
+ */ | ||
+ boolean isSpawnInvulnerable(); | ||
+ | ||
+ /** | ||
+ * Get invulnerable ticks remaining | ||
+ * | ||
+ * @return Invulnerable ticks | ||
+ */ | ||
+ int getSpawnInvulnerableTicks(); | ||
+ | ||
+ /** | ||
+ * Set invulnerable ticks remaining | ||
+ * | ||
+ * @param invulnerableTicks Invulnerable ticks remaining | ||
+ */ | ||
+ void setSpawnInvulnerableTicks(int invulnerableTicks); | ||
+ | ||
+ /** | ||
+ * Creates debug block highlight on specified block location and show it to this player. | ||
+ * <p> | ||
+ * Clients may be inconsistent in displaying it. | ||
|
@@ -2266,18 +2232,10 @@ index e4b6f278a811acbb0070e311c5c3bdaff7b00474..ee83ecb054099cb85168a9499dfe967a | |
{ | ||
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), file // Paper - use configured log prefix | ||
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java | ||
index ccdca0d75868135dc7b96daeff2236b225c4add1..cad9f4ddc6be23c595e79419872f8f026703cb80 100644 | ||
index 037af5fd6d71a526c0e6620f2db0cd6df9625261..939ed1931492854c5854cab06730cf235eba7e89 100644 | ||
--- a/src/main/java/org/bukkit/potion/PotionEffect.java | ||
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java | ||
@@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableMap; | ||
import java.util.Map; | ||
import java.util.NoSuchElementException; | ||
import org.bukkit.Color; | ||
+import org.bukkit.NamespacedKey; | ||
import org.bukkit.configuration.serialization.ConfigurationSerializable; | ||
import org.bukkit.configuration.serialization.SerializableAs; | ||
import org.bukkit.entity.LivingEntity; | ||
@@ -31,12 +32,14 @@ public class PotionEffect implements ConfigurationSerializable { | ||
@@ -32,12 +32,14 @@ public class PotionEffect implements ConfigurationSerializable { | ||
private static final String AMBIENT = "ambient"; | ||
private static final String PARTICLES = "has-particles"; | ||
private static final String ICON = "has-icon"; | ||
|
@@ -2292,7 +2250,7 @@ index ccdca0d75868135dc7b96daeff2236b225c4add1..cad9f4ddc6be23c595e79419872f8f02 | |
|
||
/** | ||
* Creates a potion effect. | ||
@@ -49,6 +52,36 @@ public class PotionEffect implements ConfigurationSerializable { | ||
@@ -50,6 +52,36 @@ public class PotionEffect implements ConfigurationSerializable { | ||
* @param icon the icon status, see {@link PotionEffect#hasIcon()} | ||
*/ | ||
public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) { | ||
|
@@ -2329,15 +2287,15 @@ index ccdca0d75868135dc7b96daeff2236b225c4add1..cad9f4ddc6be23c595e79419872f8f02 | |
Preconditions.checkArgument(type != null, "effect type cannot be null"); | ||
this.type = type; | ||
this.duration = duration; | ||
@@ -56,6 +89,7 @@ public class PotionEffect implements ConfigurationSerializable { | ||
@@ -57,6 +89,7 @@ public class PotionEffect implements ConfigurationSerializable { | ||
this.ambient = ambient; | ||
this.particles = particles; | ||
this.icon = icon; | ||
+ this.key = key; // Purpur - add key | ||
} | ||
|
||
/** | ||
@@ -103,36 +137,43 @@ public class PotionEffect implements ConfigurationSerializable { | ||
@@ -104,36 +137,43 @@ public class PotionEffect implements ConfigurationSerializable { | ||
* @param map the map to deserialize from | ||
*/ | ||
public PotionEffect(@NotNull Map<String, Object> map) { | ||
|
@@ -2387,8 +2345,8 @@ index ccdca0d75868135dc7b96daeff2236b225c4add1..cad9f4ddc6be23c595e79419872f8f02 | |
+ | ||
@NotNull | ||
private static PotionEffectType getEffectType(@NotNull Map<?, ?> map) { | ||
int type = getInt(map, TYPE); | ||
@@ -159,17 +200,33 @@ public class PotionEffect implements ConfigurationSerializable { | ||
PotionEffectType effect; | ||
@@ -166,17 +206,33 @@ public class PotionEffect implements ConfigurationSerializable { | ||
return def; | ||
} | ||
|
||
|
@@ -2407,21 +2365,16 @@ index ccdca0d75868135dc7b96daeff2236b225c4add1..cad9f4ddc6be23c595e79419872f8f02 | |
@NotNull | ||
public Map<String, Object> serialize() { | ||
- return ImmutableMap.<String, Object>builder() | ||
- .put(TYPE, type.getId()) | ||
- .put(DURATION, duration) | ||
- .put(AMPLIFIER, amplifier) | ||
- .put(AMBIENT, ambient) | ||
- .put(PARTICLES, particles) | ||
- .put(ICON, icon) | ||
- .build(); | ||
+ // Purpur start - add key, don't serialize if null. | ||
+ ImmutableMap.Builder<String, Object> builder = ImmutableMap.<String, Object>builder() | ||
+ .put(TYPE, type.getId()) | ||
+ .put(DURATION, duration) | ||
+ .put(AMPLIFIER, amplifier) | ||
+ .put(AMBIENT, ambient) | ||
+ .put(PARTICLES, particles) | ||
+ .put(ICON, icon); | ||
.put(TYPE, type.getKey().toString()) | ||
.put(DURATION, duration) | ||
.put(AMPLIFIER, amplifier) | ||
.put(AMBIENT, ambient) | ||
.put(PARTICLES, particles) | ||
- .put(ICON, icon) | ||
- .build(); | ||
+ .put(ICON, icon); | ||
+ if(key != null) { | ||
+ builder.put(KEY, key.toString()); | ||
+ } | ||
|
@@ -2430,7 +2383,7 @@ index ccdca0d75868135dc7b96daeff2236b225c4add1..cad9f4ddc6be23c595e79419872f8f02 | |
} | ||
|
||
/** | ||
@@ -193,7 +250,7 @@ public class PotionEffect implements ConfigurationSerializable { | ||
@@ -200,7 +256,7 @@ public class PotionEffect implements ConfigurationSerializable { | ||
return false; | ||
} | ||
PotionEffect that = (PotionEffect) obj; | ||
|
@@ -2439,7 +2392,7 @@ index ccdca0d75868135dc7b96daeff2236b225c4add1..cad9f4ddc6be23c595e79419872f8f02 | |
} | ||
|
||
/** | ||
@@ -289,6 +346,24 @@ public class PotionEffect implements ConfigurationSerializable { | ||
@@ -296,6 +352,24 @@ public class PotionEffect implements ConfigurationSerializable { | ||
return icon; | ||
} | ||
|
||
|
@@ -2464,7 +2417,7 @@ index ccdca0d75868135dc7b96daeff2236b225c4add1..cad9f4ddc6be23c595e79419872f8f02 | |
@Override | ||
public int hashCode() { | ||
int hash = 1; | ||
@@ -303,6 +378,6 @@ public class PotionEffect implements ConfigurationSerializable { | ||
@@ -310,6 +384,6 @@ public class PotionEffect implements ConfigurationSerializable { | ||
|
||
@Override | ||
public String toString() { | ||
|
@@ -4128,18 +4081,3 @@ index 12946bd55fcf7c40d39081779a7fa30049ee6165..9c2d605c50cbf9aefa56ec209df9f6ce | |
+ public void stopTiming() { /*handler.stopTiming();*/ } // Purpur | ||
|
||
} | ||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java | ||
index 06e96e5c98f1a7a68c8b4b5e527314c1aa774e38..49bba9a7a02b9cf3a552583315eff2b7dbe060c0 100644 | ||
--- a/src/test/java/org/bukkit/AnnotationTest.java | ||
+++ b/src/test/java/org/bukkit/AnnotationTest.java | ||
@@ -47,6 +47,10 @@ public class AnnotationTest { | ||
"org/bukkit/plugin/java/PluginClassLoader", | ||
// Generic functional interface | ||
"org/bukkit/util/Consumer", | ||
+ // Purpur start | ||
+ "gg/pufferfish/pufferfish/sentry/SentryContext", | ||
+ "gg/pufferfish/pufferfish/sentry/SentryContext$State", | ||
+ // Purpur end | ||
// Paper start | ||
"io/papermc/paper/util/TransformingRandomAccessList", | ||
"io/papermc/paper/util/TransformingRandomAccessList$TransformedListIterator", |
Oops, something went wrong.