2019-05-27 11:13:41 +02:00
|
|
|
From 9a7975a46570f5b6745635e8927fae84a4ab8c78 Mon Sep 17 00:00:00 2001
|
2016-12-27 21:06:14 +01:00
|
|
|
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
|
2019-05-27 11:13:41 +02:00
|
|
|
index c96f3ed17..1f6a12632 100644
|
2016-12-27 21:06:14 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
2018-09-04 01:59:54 +02:00
|
|
|
@@ -2,6 +2,7 @@ package net.minecraft.server;
|
2016-12-27 21:06:14 +01:00
|
|
|
|
2018-09-04 01:59:54 +02:00
|
|
|
import com.destroystokyo.paper.block.TargetBlockInfo;
|
2016-12-27 21:06:14 +01:00
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
|
|
|
+import org.apache.commons.lang.exception.ExceptionUtils;
|
|
|
|
import org.bukkit.Location;
|
2018-09-04 01:59:54 +02:00
|
|
|
import org.bukkit.block.BlockFace;
|
|
|
|
import org.bukkit.craftbukkit.CraftWorld;
|
|
|
|
@@ -24,6 +25,24 @@ public final class MCUtil {
|
2016-12-27 21:06:14 +01:00
|
|
|
|
|
|
|
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));
|
|
|
|
+ }
|
|
|
|
|
2018-07-22 06:45:49 +02:00
|
|
|
public static boolean isMainThread() {
|
|
|
|
return MinecraftServer.getServer().isMainThread();
|
2016-12-27 21:06:14 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2019-05-27 11:13:41 +02:00
|
|
|
index eca8c0ded..f7ce4b106 100644
|
2016-12-27 21:06:14 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2019-05-06 04:58:04 +02:00
|
|
|
@@ -214,6 +214,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2018-03-10 14:07:40 +01:00
|
|
|
}
|
2016-12-27 21:06:14 +01:00
|
|
|
|
|
|
|
// Paper start
|
2018-03-10 14:07:40 +01:00
|
|
|
+ @Override
|
2016-12-27 21:06:14 +01:00
|
|
|
+ public void sendActionBar(String message) {
|
|
|
|
+ if (getHandle().playerConnection == null || message == null || message.isEmpty()) return;
|
2018-07-19 06:42:43 +02:00
|
|
|
+ getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new net.minecraft.server.ChatComponentText(message), net.minecraft.server.ChatMessageType.GAME_INFO));
|
2016-12-27 21:06:14 +01:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void sendActionBar(char alternateChar, String message) {
|
|
|
|
+ if (message == null || message.isEmpty()) return;
|
|
|
|
+ sendActionBar(org.bukkit.ChatColor.translateAlternateColorCodes(alternateChar, message));
|
|
|
|
+ }
|
|
|
|
+
|
2018-03-10 14:07:40 +01:00
|
|
|
@Override
|
2016-12-27 21:06:14 +01:00
|
|
|
public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
|
2018-09-01 12:09:13 +02:00
|
|
|
if (header != null) {
|
2016-12-27 21:06:14 +01:00
|
|
|
--
|
2019-04-22 23:36:14 +02:00
|
|
|
2.21.0
|
2016-12-27 21:06:14 +01:00
|
|
|
|