From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble 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 6d46cc8674e488aa988722e09749f756a423b9e4..e5943f1313f97dd6a353873d54424ae70d46dcef 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -2500,5 +2500,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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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 3ebce913ff1063de417aa3dc3b4af6d538078db2..a7e2fab3e174fe2c1d79d904f7eaff88dd0c3c82 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -2179,5 +2179,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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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 8effbbd33c0af0ac421e5aef1586e8579ef097e4..0cd49cb31b21e52009f6220d505aa2a3713381b3 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -3993,6 +3993,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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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 8d1bdf02266799c9ca33ec72a6c063856916e3fc..d2e749b08ab660ffc8ed50e4243cdb4da3447611 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -2912,5 +2912,75 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @return True if fall damage is enabled when {@link #getAllowFlight()} is true */ public boolean hasFlyingFallDamage(); + + /** + * Creates debug block highlight on specified block location and show it to this player. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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. + *

+ * 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 }