Files
Purpur/patches/unapplied-api/0039-Debug-Marker-API.patch
2024-12-03 20:24:56 -08:00

342 lines
16 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: YouHaveTrouble <youhavetrouble@youhavetrouble.me>
Date: Sat, 23 Jul 2022 14:40:17 +0200
Subject: [PATCH] Debug Marker API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index c4de1352f3f061e950d3fdc114b6542cf13a34ce..d42c463ff5e60318470e6c3270ff7bc6f0aaaeb1 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -3006,5 +3006,89 @@ public final class Bukkit {
public static void removeFuel(@NotNull Material material) {
server.removeFuel(material);
}
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ */
+ public static void sendBlockHighlight(@NotNull Location location, int duration) {
+ server.sendBlockHighlight(location, duration);
+ }
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
+ */
+ public static void sendBlockHighlight(@NotNull Location location, int duration, int argb) {
+ server.sendBlockHighlight(location, duration, argb);
+ }
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ */
+ public static void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text) {
+ server.sendBlockHighlight(location, duration, text);
+ }
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
+ */
+ public static void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, int argb) {
+ server.sendBlockHighlight(location, duration, text, argb);
+ }
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
+ * @param transparency Transparency of the highlight
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
+ */
+ public static void sendBlockHighlight(@NotNull Location location, int duration, @NotNull org.bukkit.Color color, int transparency) {
+ server.sendBlockHighlight(location, duration, color, transparency);
+ }
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
+ * @param transparency Transparency of the highlight
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
+ */
+ public static void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, @NotNull org.bukkit.Color color, int transparency) {
+ server.sendBlockHighlight(location, duration, text, color, transparency);
+ }
+
+ /**
+ * Clears all debug block highlights for all players on the server.
+ */
+ public static void clearBlockHighlights() {
+ server.clearBlockHighlights();
+ }
// Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 30e52ca06cac23f35143767937ce474a8339018a..9a25dd2166892d612d32a4611a2531a3cee6754f 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2649,5 +2649,75 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param material The material that will no longer be a fuel
*/
public void removeFuel(@NotNull Material material);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, int argb);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, int argb);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
+ * @param transparency Transparency of the highlight
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull org.bukkit.Color color, int transparency);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on the server.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
+ * @param transparency Transparency of the highlight
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, @NotNull org.bukkit.Color color, int transparency);
+
+ /**
+ * Clears all debug block highlights for all players on the server.
+ */
+ void clearBlockHighlights();
// Purpur end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 26a0ed5437842492432a26778fadd9ae41dc0569..820c22c7a20d19a74139bc1537515405b4b2f46c 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4254,6 +4254,76 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return The local difficulty
*/
public float getLocalDifficultyAt(@NotNull Location location);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on this world.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on this world.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, int argb);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on this world.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on this world.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, int argb);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on this world.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
+ * @param transparency Transparency of the highlight
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull org.bukkit.Color color, int transparency);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to all players on this world.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
+ * @param transparency Transparency of the highlight
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, @NotNull org.bukkit.Color color, int transparency);
+
+ /**
+ * Clears all debug block highlights for all players on this world.
+ */
+ void clearBlockHighlights();
// Purpur end
/**
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 5d449299f958cb747e62e9ccfc8ff6cc32236dcd..0b8f7c39ff90b57eb7104d3a0cf1c29ee551b522 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3939,5 +3939,75 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @deprecated Use {@link #resetIdleDuration()} instead
*/
void resetIdleTimer();
+
+ /**
+ * Creates debug block highlight on specified block location and show it to this player.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to this player.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, int argb);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to this player.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to this player.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, int argb);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to this player.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
+ * @param transparency Transparency of the highlight
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull org.bukkit.Color color, int transparency);
+
+ /**
+ * Creates debug block highlight on specified block location and show it to this player.
+ * <p>
+ * Clients may be inconsistent in displaying it.
+ * @param location Location to highlight
+ * @param duration Duration for highlight to show in milliseconds
+ * @param text Text to show above the highlight
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
+ * @param transparency Transparency of the highlight
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
+ */
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, @NotNull org.bukkit.Color color, int transparency);
+
+ /**
+ * Clears all debug block highlights
+ */
+ void clearBlockHighlights();
// Purpur end
}