Player Tab List and Title APIs
This commit is contained in:
parent
52398f034c
commit
ee63dbebdc
|
@ -0,0 +1,103 @@
|
|||
From 42577385d23a22d17b6f80787db0bf27f8e970d7 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Tue, 16 Feb 2016 19:51:11 -0600
|
||||
Subject: [PATCH] Player Tab List and Title APIs
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 9ebfa47..78fd6dc 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -344,6 +344,78 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
* @param components the components to send
|
||||
*/
|
||||
public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components);
|
||||
+
|
||||
+ /**
|
||||
+ * Set the text displayed in the player list header and footer for this player
|
||||
+ *
|
||||
+ * @param header content for the top of the player list
|
||||
+ * @param footer content for the bottom of the player list
|
||||
+ */
|
||||
+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent[] header, net.md_5.bungee.api.chat.BaseComponent[] footer);
|
||||
+
|
||||
+ /**
|
||||
+ * Set the text displayed in the player list header and footer for this player
|
||||
+ *
|
||||
+ * @param header content for the top of the player list
|
||||
+ * @param footer content for the bottom of the player list
|
||||
+ */
|
||||
+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent header, net.md_5.bungee.api.chat.BaseComponent footer);
|
||||
+
|
||||
+ /**
|
||||
+ * Set the times for titles displayed to the player
|
||||
+ *
|
||||
+ * @param fadeInTicks ticks to fade-in
|
||||
+ * @param stayTicks ticks to stay visible
|
||||
+ * @param fadeOutTicks ticks to fade-out
|
||||
+ */
|
||||
+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks);
|
||||
+
|
||||
+ /**
|
||||
+ * Set the subtitle of titles displayed to the player
|
||||
+ */
|
||||
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent[] subtitle);
|
||||
+
|
||||
+ /**
|
||||
+ * Set the subtitle of titles displayed to the player
|
||||
+ */
|
||||
+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent subtitle);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title to the player, along with the last subtitle set, using the last set times
|
||||
+ */
|
||||
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title to the player, along with the last subtitle set, using the last set times
|
||||
+ */
|
||||
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title and subtitle to the player using the given times
|
||||
+ *
|
||||
+ * @param title big text
|
||||
+ * @param subtitle little text under it
|
||||
+ * @param fadeInTicks ticks to fade-in
|
||||
+ * @param stayTicks ticks to stay visible
|
||||
+ * @param fadeOutTicks ticks to fade-out
|
||||
+ */
|
||||
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title, net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
|
||||
+
|
||||
+ /**
|
||||
+ * Show the given title and subtitle to the player using the given times
|
||||
+ *
|
||||
+ * @param title big text
|
||||
+ * @param subtitle little text under it
|
||||
+ * @param fadeInTicks ticks to fade-in
|
||||
+ * @param stayTicks ticks to stay visible
|
||||
+ * @param fadeOutTicks ticks to fade-out
|
||||
+ */
|
||||
+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title, net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks);
|
||||
+
|
||||
+ /**
|
||||
+ * Hide any title that is currently visible to the player
|
||||
+ */
|
||||
+ public void hideTitle();
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
@@ -1086,9 +1158,8 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
|
||||
/**
|
||||
* Resets the title displayed to the player.
|
||||
- * @deprecated API subject to change.
|
||||
*/
|
||||
- @Deprecated
|
||||
+ // Paper - Undeprecate
|
||||
public void resetTitle();
|
||||
|
||||
// Spigot start
|
||||
--
|
||||
2.7.1
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
From cd3036746ad8fd0286f07c257fa2321f76ad610a Mon Sep 17 00:00:00 2001
|
||||
From e9f93a9efde92cdfd70b6d404621281f3761c519 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 25 May 2015 15:37:00 -0500
|
||||
Subject: [PATCH] mc-dev imports
|
||||
|
@ -3557,6 +3557,154 @@ index 0000000..d5eaa24
|
|||
+
|
||||
+ protected abstract boolean a(Vec3D vec3d, Vec3D vec3d1, int i, int j, int k);
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
|
||||
new file mode 100644
|
||||
index 0000000..1606d6d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
|
||||
@@ -0,0 +1,33 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import java.io.IOException;
|
||||
+
|
||||
+public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListenerPlayOut> {
|
||||
+
|
||||
+ private IChatBaseComponent a;
|
||||
+ private IChatBaseComponent b;
|
||||
+
|
||||
+ public PacketPlayOutPlayerListHeaderFooter() {}
|
||||
+
|
||||
+ public PacketPlayOutPlayerListHeaderFooter(IChatBaseComponent ichatbasecomponent) {
|
||||
+ this.a = ichatbasecomponent;
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
+ this.a = packetdataserializer.d();
|
||||
+ this.b = packetdataserializer.d();
|
||||
+ }
|
||||
+
|
||||
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
+ packetdataserializer.a(this.a);
|
||||
+ packetdataserializer.a(this.b);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
|
||||
+ packetlistenerplayout.a(this);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketListener packetlistener) {
|
||||
+ this.a((PacketListenerPlayOut) packetlistener);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
|
||||
new file mode 100644
|
||||
index 0000000..2711298
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
|
||||
@@ -0,0 +1,103 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import java.io.IOException;
|
||||
+
|
||||
+public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> {
|
||||
+
|
||||
+ private EnumTitleAction a;
|
||||
+ private IChatBaseComponent b;
|
||||
+ private int c;
|
||||
+ private int d;
|
||||
+ private int e;
|
||||
+
|
||||
+ public PacketPlayOutTitle() {}
|
||||
+
|
||||
+ public PacketPlayOutTitle(EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent) {
|
||||
+ this(packetplayouttitle_enumtitleaction, ichatbasecomponent, -1, -1, -1);
|
||||
+ }
|
||||
+
|
||||
+ public PacketPlayOutTitle(int i, int j, int k) {
|
||||
+ this(EnumTitleAction.TIMES, (IChatBaseComponent) null, i, j, k);
|
||||
+ }
|
||||
+
|
||||
+ public PacketPlayOutTitle(EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent, int i, int j, int k) {
|
||||
+ this.a = packetplayouttitle_enumtitleaction;
|
||||
+ this.b = ichatbasecomponent;
|
||||
+ this.c = i;
|
||||
+ this.d = j;
|
||||
+ this.e = k;
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
+ this.a = (EnumTitleAction) packetdataserializer.a(EnumTitleAction.class);
|
||||
+ if (this.a == EnumTitleAction.TITLE || this.a == EnumTitleAction.SUBTITLE) {
|
||||
+ this.b = packetdataserializer.d();
|
||||
+ }
|
||||
+
|
||||
+ if (this.a == EnumTitleAction.TIMES) {
|
||||
+ this.c = packetdataserializer.readInt();
|
||||
+ this.d = packetdataserializer.readInt();
|
||||
+ this.e = packetdataserializer.readInt();
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
+ packetdataserializer.a((Enum) this.a);
|
||||
+ if (this.a == EnumTitleAction.TITLE || this.a == EnumTitleAction.SUBTITLE) {
|
||||
+ packetdataserializer.a(this.b);
|
||||
+ }
|
||||
+
|
||||
+ if (this.a == EnumTitleAction.TIMES) {
|
||||
+ packetdataserializer.writeInt(this.c);
|
||||
+ packetdataserializer.writeInt(this.d);
|
||||
+ packetdataserializer.writeInt(this.e);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketListenerPlayOut packetlistenerplayout) {
|
||||
+ packetlistenerplayout.a(this);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketListener packetlistener) {
|
||||
+ this.a((PacketListenerPlayOut) packetlistener);
|
||||
+ }
|
||||
+
|
||||
+ public static enum EnumTitleAction {
|
||||
+
|
||||
+ TITLE, SUBTITLE, TIMES, CLEAR, RESET;
|
||||
+
|
||||
+ private EnumTitleAction() {}
|
||||
+
|
||||
+ public static EnumTitleAction a(String s) {
|
||||
+ EnumTitleAction[] apacketplayouttitle_enumtitleaction = values();
|
||||
+ int i = apacketplayouttitle_enumtitleaction.length;
|
||||
+
|
||||
+ for (int j = 0; j < i; ++j) {
|
||||
+ EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[j];
|
||||
+
|
||||
+ if (packetplayouttitle_enumtitleaction.name().equalsIgnoreCase(s)) {
|
||||
+ return packetplayouttitle_enumtitleaction;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return EnumTitleAction.TITLE;
|
||||
+ }
|
||||
+
|
||||
+ public static String[] a() {
|
||||
+ String[] astring = new String[values().length];
|
||||
+ int i = 0;
|
||||
+ EnumTitleAction[] apacketplayouttitle_enumtitleaction = values();
|
||||
+ int j = apacketplayouttitle_enumtitleaction.length;
|
||||
+
|
||||
+ for (int k = 0; k < j; ++k) {
|
||||
+ EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[k];
|
||||
+
|
||||
+ astring[i++] = packetplayouttitle_enumtitleaction.name().toLowerCase();
|
||||
+ }
|
||||
+
|
||||
+ return astring;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
|
||||
new file mode 100644
|
||||
index 0000000..6014b09
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
From c27a95f1caa97ff1b026429367c16abd20e46ed2 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Tue, 16 Feb 2016 19:45:55 -0600
|
||||
Subject: [PATCH] Player Tab List and Title APIs
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
|
||||
index 1606d6d..89a5056 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java
|
||||
@@ -4,6 +4,8 @@ import java.io.IOException;
|
||||
|
||||
public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListenerPlayOut> {
|
||||
|
||||
+ public net.md_5.bungee.api.chat.BaseComponent[] header, footer; // Paper
|
||||
+
|
||||
private IChatBaseComponent a;
|
||||
private IChatBaseComponent b;
|
||||
|
||||
@@ -19,15 +21,22 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListene
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
- packetdataserializer.a(this.a);
|
||||
- packetdataserializer.a(this.b);
|
||||
+ // Paper start
|
||||
+ if (this.header != null) {
|
||||
+ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.header));
|
||||
+ } else {
|
||||
+ packetdataserializer.a(this.a);
|
||||
+ }
|
||||
+
|
||||
+ if (this.footer != null) {
|
||||
+ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.footer));
|
||||
+ } else {
|
||||
+ packetdataserializer.a(this.b);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public void a(PacketListenerPlayOut packetlistenerplayout) {
|
||||
packetlistenerplayout.a(this);
|
||||
}
|
||||
-
|
||||
- public void a(PacketListener packetlistener) {
|
||||
- this.a((PacketListenerPlayOut) packetlistener);
|
||||
- }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
|
||||
index 2711298..071215e 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java
|
||||
@@ -10,6 +10,18 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> {
|
||||
private int d;
|
||||
private int e;
|
||||
|
||||
+ // Paper start
|
||||
+ public net.md_5.bungee.api.chat.BaseComponent[] components;
|
||||
+
|
||||
+ public PacketPlayOutTitle(EnumTitleAction action, net.md_5.bungee.api.chat.BaseComponent[] components, int fadeIn, int stay, int fadeOut) {
|
||||
+ this.a = action;
|
||||
+ this.components = components;
|
||||
+ this.c = fadeIn;
|
||||
+ this.d = stay;
|
||||
+ this.e = fadeOut;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public PacketPlayOutTitle() {}
|
||||
|
||||
public PacketPlayOutTitle(EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent) {
|
||||
@@ -45,7 +57,13 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> {
|
||||
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
packetdataserializer.a((Enum) this.a);
|
||||
if (this.a == EnumTitleAction.TITLE || this.a == EnumTitleAction.SUBTITLE) {
|
||||
- packetdataserializer.a(this.b);
|
||||
+ // Paper start
|
||||
+ if (this.components != null) {
|
||||
+ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components));
|
||||
+ } else {
|
||||
+ packetdataserializer.a(this.b);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
if (this.a == EnumTitleAction.TIMES) {
|
||||
@@ -60,10 +78,6 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> {
|
||||
packetlistenerplayout.a(this);
|
||||
}
|
||||
|
||||
- public void a(PacketListener packetlistener) {
|
||||
- this.a((PacketListenerPlayOut) packetlistener);
|
||||
- }
|
||||
-
|
||||
public static enum EnumTitleAction {
|
||||
|
||||
TITLE, SUBTITLE, TIMES, CLEAR, RESET;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index dba0520..cabef35 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -176,6 +176,65 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
packet.components = components;
|
||||
getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
|
||||
+ PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
|
||||
+ packet.header = header;
|
||||
+ packet.footer = footer;
|
||||
+ getHandle().playerConnection.sendPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setPlayerListHeaderFooter(BaseComponent header, BaseComponent footer) {
|
||||
+ this.setPlayerListHeaderFooter(header == null ? null : new BaseComponent[]{header},
|
||||
+ footer == null ? null : new BaseComponent[]{footer});
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @Override
|
||||
+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks) {
|
||||
+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TIMES, (BaseComponent[]) null, fadeInTicks, stayTicks, fadeOutTicks));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSubtitle(BaseComponent[] subtitle) {
|
||||
+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, subtitle, 0, 0, 0));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSubtitle(BaseComponent subtitle) {
|
||||
+ setSubtitle(new BaseComponent[]{subtitle});
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void showTitle(BaseComponent[] title) {
|
||||
+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, title, 0, 0, 0));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void showTitle(BaseComponent title) {
|
||||
+ showTitle(new BaseComponent[]{title});
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void showTitle(BaseComponent[] title, BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
|
||||
+ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks);
|
||||
+ setSubtitle(subtitle);
|
||||
+ showTitle(title);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void showTitle(BaseComponent title, BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
|
||||
+ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks);
|
||||
+ setSubtitle(subtitle);
|
||||
+ showTitle(title);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void hideTitle() {
|
||||
+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.CLEAR, (BaseComponent[]) null, 0, 0, 0));
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
--
|
||||
2.7.1
|
||||
|
Loading…
Reference in New Issue