From 92c3ef1989eaecb3b1f50e5d5c70ad479e3557ff Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 16 Jun 2013 15:40:31 +1000 Subject: [PATCH] Fix custom tab API to allow using as soon as constructed --- api/src/main/java/net/md_5/bungee/api/ProxyServer.java | 3 ++- .../main/java/net/md_5/bungee/api/tab/TabListAdapter.java | 1 - proxy/src/main/java/net/md_5/bungee/BungeeCord.java | 4 ++-- proxy/src/main/java/net/md_5/bungee/tab/Custom.java | 6 ++++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java index d5bcfb63..5dc38031 100644 --- a/api/src/main/java/net/md_5/bungee/api/ProxyServer.java +++ b/api/src/main/java/net/md_5/bungee/api/ProxyServer.java @@ -245,7 +245,8 @@ public abstract class ProxyServer /** * Gets a new instance of this proxies custom tab list. * + * @param player the player to generate this list in the context of * @return a new {@link CustomTabList} instance */ - public abstract CustomTabList customTabList(); + public abstract CustomTabList customTabList(ProxiedPlayer player); } diff --git a/api/src/main/java/net/md_5/bungee/api/tab/TabListAdapter.java b/api/src/main/java/net/md_5/bungee/api/tab/TabListAdapter.java index 133a2ee9..e4425cfb 100644 --- a/api/src/main/java/net/md_5/bungee/api/tab/TabListAdapter.java +++ b/api/src/main/java/net/md_5/bungee/api/tab/TabListAdapter.java @@ -2,7 +2,6 @@ package net.md_5.bungee.api.tab; import lombok.Getter; import lombok.NoArgsConstructor; -import net.md_5.bungee.api.tab.TabListHandler; import net.md_5.bungee.api.connection.ProxiedPlayer; @NoArgsConstructor diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 02ddf3f8..d080b1b4 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -516,8 +516,8 @@ public class BungeeCord extends ProxyServer } @Override - public CustomTabList customTabList() + public CustomTabList customTabList(ProxiedPlayer player) { - return new Custom(); + return new Custom( player ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/tab/Custom.java b/proxy/src/main/java/net/md_5/bungee/tab/Custom.java index afc09257..4b0f7c55 100644 --- a/proxy/src/main/java/net/md_5/bungee/tab/Custom.java +++ b/proxy/src/main/java/net/md_5/bungee/tab/Custom.java @@ -4,6 +4,7 @@ import com.google.common.base.Preconditions; import java.util.Collection; import java.util.HashSet; import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.tab.CustomTabList; import net.md_5.bungee.api.tab.TabListAdapter; import net.md_5.bungee.protocol.packet.PacketC9PlayerListItem; @@ -26,6 +27,11 @@ public class Custom extends TabListAdapter implements CustomTabList private int rowLim; private int colLim; + public Custom(ProxiedPlayer player) + { + this.init( player ); + } + @Override public synchronized String setSlot(int row, int column, String text) {