mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Debug Marker API (#1072)
This commit is contained in:
341
patches/api/0051-Debug-Marker-API.patch
Normal file
341
patches/api/0051-Debug-Marker-API.patch
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
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 9b9af189b3865055570ba533b97c92c105cc5a37..ef478e1d21e9b134641faa5060152125d5c5ea13 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
|
@@ -2467,5 +2467,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 d73b7d72d00fa0edd6542226348af14c5203cf8d..b894ae05e566737680a444417c738c5aa8fc2450 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
|
@@ -2147,5 +2147,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 3d053490dc87724f57893a553f1ab9cf1a3b73c0..ec8c098ee07ac88c023ec6274788c94a4cffc835 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.
|
||||||
|
+ * <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 4766ebb24bdf02a045e2e8aba18b8ae314a0e201..6a99736f059a9034cd93e84a170f80e6168ea275 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||||
|
@@ -2839,5 +2839,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.
|
||||||
|
+ * <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
|
||||||
|
}
|
||||||
153
patches/server/0293-Debug-Marker-API.patch
Normal file
153
patches/server/0293-Debug-Marker-API.patch
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: YouHaveTrouble <youhavetrouble@youhavetrouble.me>
|
||||||
|
Date: Sat, 23 Jul 2022 14:40:38 +0200
|
||||||
|
Subject: [PATCH] Debug Marker API
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
index f61e0c8a12f2132b307b541525df729eda1a4f51..000007e77e73153d3d634a3ab5882916bd8b43a3 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
@@ -1461,6 +1461,42 @@ public final class CraftServer implements Server {
|
||||||
|
public void removeFuel(org.bukkit.Material material) {
|
||||||
|
net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity.removeFuel(net.minecraft.world.item.ItemStack.fromBukkitCopy(new ItemStack(material)));
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration) {
|
||||||
|
+ sendBlockHighlight(location, duration, "", 0x6400FF00);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, int argb) {
|
||||||
|
+ sendBlockHighlight(location, duration, "", argb);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, String text) {
|
||||||
|
+ sendBlockHighlight(location, duration, text, 0x6400FF00);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, String text, int argb) {
|
||||||
|
+ this.worlds.forEach((name, world) -> world.sendBlockHighlight(location, duration, text, argb));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, org.bukkit.Color color, int transparency) {
|
||||||
|
+ sendBlockHighlight(location, duration, "", color, transparency);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, String text, org.bukkit.Color color, int transparency) {
|
||||||
|
+ if (transparency < 0 || transparency > 255) throw new IllegalArgumentException("transparency is outside of 0-255 range");
|
||||||
|
+ sendBlockHighlight(location, duration, text, transparency << 24 | color.asRGB());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void clearBlockHighlights() {
|
||||||
|
+ this.worlds.forEach((name, world) -> clearBlockHighlights());
|
||||||
|
+ }
|
||||||
|
// Purpur End
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
|
index 0d428a9c6c8854a99f5f1a9860fe1a57c3fab392..94f042d8d3f15081e25f0cb938c01e3277918ac7 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
|
@@ -2240,6 +2240,42 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||||
|
public float getLocalDifficultyAt(Location location) {
|
||||||
|
return getHandle().getCurrentDifficultyAt(net.minecraft.server.MCUtil.toBlockPosition(location)).getEffectiveDifficulty();
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration) {
|
||||||
|
+ sendBlockHighlight(location, duration, "", 0x6400FF00);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, int argb) {
|
||||||
|
+ sendBlockHighlight(location, duration, "", argb);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, String text) {
|
||||||
|
+ sendBlockHighlight(location, duration, text, 0x6400FF00);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, String text, int argb) {
|
||||||
|
+ net.minecraft.network.protocol.game.DebugPackets.sendGameTestAddMarker(getHandle(), net.minecraft.server.MCUtil.toBlockPosition(location), text, argb, duration);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, org.bukkit.Color color, int transparency) {
|
||||||
|
+ sendBlockHighlight(location, duration, "", color, transparency);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, String text, org.bukkit.Color color, int transparency) {
|
||||||
|
+ if (transparency < 0 || transparency > 255) throw new IllegalArgumentException("transparency is outside of 0-255 range");
|
||||||
|
+ sendBlockHighlight(location, duration, text, transparency << 24 | color.asRGB());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void clearBlockHighlights() {
|
||||||
|
+ net.minecraft.network.protocol.game.DebugPackets.sendGameTestClearPacket(getHandle());
|
||||||
|
+ }
|
||||||
|
// Purpur end
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
index 753ef343b7daab339a4308935e3cec86e49481f0..92182c27b73e4841d2724b4286ddd21db65aea5c 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
@@ -2963,5 +2963,48 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
public boolean hasFlyingFallDamage() {
|
||||||
|
return getHandle().flyingFallDamage;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration) {
|
||||||
|
+ sendBlockHighlight(location, duration, "", 0x6400FF00);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, int argb) {
|
||||||
|
+ sendBlockHighlight(location, duration, "", argb);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, String text) {
|
||||||
|
+ sendBlockHighlight(location, duration, text, 0x6400FF00);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, String text, int argb) {
|
||||||
|
+ if (this.getHandle().connection == null) return;
|
||||||
|
+ FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||||
|
+ buf.writeBlockPos(net.minecraft.server.MCUtil.toBlockPosition(location));
|
||||||
|
+ buf.writeInt(argb);
|
||||||
|
+ buf.writeUtf(text);
|
||||||
|
+ buf.writeInt(duration);
|
||||||
|
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket(ClientboundCustomPayloadPacket.DEBUG_GAME_TEST_ADD_MARKER, buf));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, org.bukkit.Color color, int transparency) {
|
||||||
|
+ sendBlockHighlight(location, duration, "", color, transparency);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void sendBlockHighlight(Location location, int duration, String text, org.bukkit.Color color, int transparency) {
|
||||||
|
+ if (transparency < 0 || transparency > 255) throw new IllegalArgumentException("transparency is outside of 0-255 range");
|
||||||
|
+ sendBlockHighlight(location, duration, text, transparency << 24 | color.asRGB());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void clearBlockHighlights() {
|
||||||
|
+ if (this.getHandle().connection == null) return;
|
||||||
|
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket(ClientboundCustomPayloadPacket.DEBUG_GAME_TEST_CLEAR, new FriendlyByteBuf(io.netty.buffer.Unpooled.buffer())));
|
||||||
|
+ }
|
||||||
|
// Purpur end
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user