Paper/Spigot-Server-Patches/0132-String-based-Action-Bar-API.patch
Aikar 986ebc68fc
Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
983305bb SPIGOT-5856: Soul Campfire BlockState cannot be cast to Campfire
2020-06-27 17:37:09 -04:00

43 Zeilen
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 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/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java
index 275c1d2d1eb2649de9a9b5aece6e88c21362efba..d72ba7f76c42fd525a5b59a999a0c08e35d0ef78 100644
--- a/src/main/java/net/minecraft/server/SystemUtils.java
+++ b/src/main/java/net/minecraft/server/SystemUtils.java
@@ -48,7 +48,7 @@ public class SystemUtils {
private static final ExecutorService e = a("Main");
private static final ExecutorService f = n();
public static LongSupplier a = System::nanoTime;
- public static final UUID b = new UUID(0L, 0L);
+ public static final UUID b = new UUID(0L, 0L); public static final UUID getNullUUID() {return b;} // Paper OBFHELPER
private static final Logger LOGGER = LogManager.getLogger();
public static <K, V> Collector<Entry<? extends K, ? extends V>, ?, Map<K, V>> a() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 43b50d56f87a1ac52eae1529875834ab85733aa4..a490d6330474a77d81a0e25ac74ea36c183e7cf0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -219,6 +219,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, SystemUtils.getNullUUID()));
+ }
+
+ @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) {