mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
49 lines
2.5 KiB
Diff
49 lines
2.5 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/Util.java b/src/main/java/net/minecraft/Util.java
|
|
index 67fa685f4b8de3eae1431c0de399c246678b542a..7b36274718b7cce24ac00530697f145648d52590 100644
|
|
--- a/src/main/java/net/minecraft/Util.java
|
|
+++ b/src/main/java/net/minecraft/Util.java
|
|
@@ -58,7 +58,7 @@ public class Util {
|
|
private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
|
|
private static final ExecutorService IO_POOL = makeIoExecutor();
|
|
public static LongSupplier timeSource = System::nanoTime;
|
|
- public static final UUID NIL_UUID = new UUID(0L, 0L);
|
|
+ public static final UUID NIL_UUID = new UUID(0L, 0L); public static final UUID getNullUUID() {return NIL_UUID;} // Paper OBFHELPER
|
|
private static final Logger LOGGER = LogManager.getLogger();
|
|
|
|
public static <K, V> Collector<Entry<? extends K, ? extends V>, ?, Map<K, V>> toMap() {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index fc19b4cacd223b928fbdf922b828beaed630bf2e..d6d4e5ab7551f802dc2d3ab055d340d471ed0bc2 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -242,6 +242,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
}
|
|
|
|
// Paper start
|
|
+ @Override
|
|
+ public void sendActionBar(BaseComponent[] message) {
|
|
+ if (getHandle().connection == null) return;
|
|
+ getHandle().connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.ACTIONBAR, message, -1, -1, -1));
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void sendActionBar(String message) {
|
|
+ if (getHandle().connection == null || message == null || message.isEmpty()) return;
|
|
+ getHandle().connection.send(new ClientboundSetTitlesPacket(ClientboundSetTitlesPacket.Type.ACTIONBAR, CraftChatMessage.fromStringOrNull(message)));
|
|
+ }
|
|
+
|
|
+ @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) {
|