mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 04:09:54 +01:00
d16a5d8813
Prereq changes for the coming storm of performance patches. Includes optimising incremental saving
70 lines
2.6 KiB
Diff
70 lines
2.6 KiB
Diff
From f0e1f1fa1e613324eec3095d858a8cf79f02b85c 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 9fa88d79d8..ee2174a9ca 100644
|
|
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
|
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
|
@@ -2,6 +2,7 @@ package net.minecraft.server;
|
|
|
|
import com.destroystokyo.paper.block.TargetBlockInfo;
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
|
+import org.apache.commons.lang.exception.ExceptionUtils;
|
|
import org.bukkit.Location;
|
|
import org.bukkit.block.BlockFace;
|
|
import org.bukkit.craftbukkit.CraftWorld;
|
|
@@ -94,6 +95,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));
|
|
+ }
|
|
|
|
public static boolean isMainThread() {
|
|
return MinecraftServer.getServer().isMainThread();
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 447ecf636d..3a2a886180 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -217,6 +217,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 net.minecraft.server.ChatComponentText(message), net.minecraft.server.ChatMessageType.GAME_INFO));
|
|
+ }
|
|
+
|
|
+ @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) {
|
|
if (header != null) {
|
|
--
|
|
2.25.0.windows.1
|
|
|