mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 11:42:55 +01:00
974b0afca9
CraftBukkit removed their implementation that caused this issue, switching to Mojang's implementation which doesn't appear to share it. I already removed the important bit in the last upstream merge, this is just unused and unnecessary now. So we remove it.
89 lines
3.1 KiB
Diff
89 lines
3.1 KiB
Diff
From e3751676733cbb710d6a2bb4bea2352b06268c0e Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Tue, 27 Dec 2016 15:02:42 -0500
|
|
Subject: [PATCH] String based Action Bar API
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
|
index 1159eea1a..38359517c 100644
|
|
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
|
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
|
@@ -1,10 +1,13 @@
|
|
package net.minecraft.server;
|
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
|
+import org.apache.commons.lang.exception.ExceptionUtils;
|
|
import org.bukkit.Location;
|
|
+import org.bukkit.craftbukkit.CraftWorld;
|
|
import org.bukkit.craftbukkit.util.Waitable;
|
|
import org.spigotmc.AsyncCatcher;
|
|
|
|
+import javax.annotation.Nonnull;
|
|
import javax.annotation.Nullable;
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.Executor;
|
|
@@ -17,6 +20,24 @@ public final class MCUtil {
|
|
|
|
private MCUtil() {}
|
|
|
|
+ /**
|
|
+ * Quickly generate a stack trace for current location
|
|
+ *
|
|
+ * @return Stacktrace
|
|
+ */
|
|
+ public static String stack() {
|
|
+ return ExceptionUtils.getFullStackTrace(new Throwable());
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Quickly generate a stack trace for current location with message
|
|
+ *
|
|
+ * @param str
|
|
+ * @return Stacktrace
|
|
+ */
|
|
+ public static String stack(String str) {
|
|
+ return ExceptionUtils.getFullStackTrace(new Throwable(str));
|
|
+ }
|
|
|
|
/**
|
|
* Ensures the target code is running on the main thread
|
|
@@ -186,4 +207,13 @@ public final class MCUtil {
|
|
}
|
|
return null;
|
|
}
|
|
+
|
|
+ @Nonnull
|
|
+ public static World getNMSWorld(@Nonnull org.bukkit.World world) {
|
|
+ return ((CraftWorld) world).getHandle();
|
|
+ }
|
|
+
|
|
+ public static World getNMSWorld(@Nonnull org.bukkit.entity.Entity entity) {
|
|
+ return getNMSWorld(entity.getWorld());
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 61c32223d..072b59125 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -165,6 +165,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
// Paper start
|
|
@Override
|
|
+ public void sendActionBar(String message) {
|
|
+ if (getHandle().playerConnection == null || message == null || message.isEmpty()) return;
|
|
+ getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new ChatComponentText(message), (byte) 2));
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void sendActionBar(char alternateChar, String message) {
|
|
+ if (message == null || message.isEmpty()) return;
|
|
+ sendActionBar(org.bukkit.ChatColor.translateAlternateColorCodes(alternateChar, message));
|
|
+ }
|
|
+
|
|
+ @Override
|
|
public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
|
|
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
|
|
packet.header = header;
|
|
--
|
|
2.12.2.windows.2
|
|
|