Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 19:10:09 +01:00
a207d14a0e
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
49 Zeilen
2.5 KiB
Diff
49 Zeilen
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) {
|