[Breaking] Close #423 by making tab list per listener.

This commit is contained in:
md_5
2013-06-08 13:13:17 +10:00
parent b5aecd5dcc
commit b75a2b5060
13 changed files with 104 additions and 125 deletions

View File

@@ -120,21 +120,6 @@ public abstract class ProxyServer
*/
public abstract void setConfigurationAdapter(ConfigurationAdapter adapter);
/**
* Get the currently in use tab list handle.
*
* @return the tab list handler
*/
public abstract TabListHandler getTabListHandler();
/**
* Set the used tab list handler, should not be changed once players have
* connected
*
* @param handler the tab list handler to set
*/
public abstract void setTabListHandler(TabListHandler handler);
/**
* Get the currently in use reconnect handler.
*

View File

@@ -1,23 +1,29 @@
package net.md_5.bungee.api;
import lombok.Data;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public interface TabListHandler
@Data
public abstract class TabListHandler
{
private final ProxiedPlayer player;
/**
* Called when this player first connects to the proxy.
*/
public void onConnect()
{
}
/**
* Called when a player first connects to the proxy.
*
* @param player the connecting player
*/
public void onConnect(ProxiedPlayer player);
/**
* Called when a player changes their connected server.
*
* @param player the player who changed servers
*/
public void onServerChange(ProxiedPlayer player);
public void onServerChange()
{
}
/**
* Called when a players ping changes. The new ping will have not updated in
@@ -26,14 +32,18 @@ public interface TabListHandler
* @param player the player who's ping changed
* @param ping the player's new ping.
*/
public void onPingChange(ProxiedPlayer player, int ping);
public void onPingChange(int ping)
{
}
/**
* Called when a player disconnects.
*
* @param player the disconnected player
*/
public void onDisconnect(ProxiedPlayer player);
public void onDisconnect()
{
}
/**
* Called when a list update packet is sent from server to client.
@@ -44,5 +54,5 @@ public interface TabListHandler
* @param ping ping of the subject player
* @return whether to send the packet to the client
*/
public boolean onListUpdate(ProxiedPlayer player, String name, boolean online, int ping);
public abstract boolean onListUpdate(String name, boolean online, int ping);
}

View File

@@ -3,6 +3,7 @@ package net.md_5.bungee.api.config;
import java.net.InetSocketAddress;
import java.util.Map;
import lombok.Data;
import net.md_5.bungee.api.TabListHandler;
/**
* Class representing the configuration of a server listener. Used for allowing
@@ -52,4 +53,8 @@ public class ListenerInfo
* null.
*/
private final TexturePackInfo texturePack;
/**
* Class used to build tab lists for this player.
*/
private final Class<? extends TabListHandler> tabList;
}