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 a3ddf173..d6145f91 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 @@ -1,5 +1,6 @@ package net.md_5.bungee.api; +import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.plugin.PluginManager; import com.google.common.base.Preconditions; import java.util.Collection; diff --git a/api/src/main/java/net/md_5/bungee/api/TabListHandler.java b/api/src/main/java/net/md_5/bungee/api/TabListHandler.java new file mode 100644 index 00000000..832e95c5 --- /dev/null +++ b/api/src/main/java/net/md_5/bungee/api/TabListHandler.java @@ -0,0 +1,47 @@ +package net.md_5.bungee.api; + +import net.md_5.bungee.api.connection.ProxiedPlayer; + +public interface TabListHandler +{ + + /** + * 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); + + /** + * Called when a players ping changes. + * + * @param player the player who's ping changed + * @param ping the player's new ping. + */ + public void onPingChange(ProxiedPlayer player, int ping); + + /** + * Called when a player disconnects. + * + * @param player the disconnected player + */ + public void onDisconnect(ProxiedPlayer player); + + /** + * Called when a list update packet is sent from server to client. + * + * @param player receiving this packet + * @param name the player which this packet is relevant to + * @param online whether the subject player is online + * @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); +} diff --git a/api/src/main/java/net/md_5/bungee/api/ConnectedPlayer.java b/api/src/main/java/net/md_5/bungee/api/connection/ConnectedPlayer.java similarity index 78% rename from api/src/main/java/net/md_5/bungee/api/ConnectedPlayer.java rename to api/src/main/java/net/md_5/bungee/api/connection/ConnectedPlayer.java index 6c82fa08..cf09a65a 100644 --- a/api/src/main/java/net/md_5/bungee/api/ConnectedPlayer.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/ConnectedPlayer.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.api; +package net.md_5.bungee.api.connection; /** * Represents a player physically connected to the world hosted on this server. diff --git a/api/src/main/java/net/md_5/bungee/api/Connection.java b/api/src/main/java/net/md_5/bungee/api/connection/Connection.java similarity index 91% rename from api/src/main/java/net/md_5/bungee/api/Connection.java rename to api/src/main/java/net/md_5/bungee/api/connection/Connection.java index bd1cbfec..3962b9a9 100644 --- a/api/src/main/java/net/md_5/bungee/api/Connection.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/Connection.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.api; +package net.md_5.bungee.api.connection; import java.net.InetSocketAddress; diff --git a/api/src/main/java/net/md_5/bungee/api/PendingConnection.java b/api/src/main/java/net/md_5/bungee/api/connection/PendingConnection.java similarity index 75% rename from api/src/main/java/net/md_5/bungee/api/PendingConnection.java rename to api/src/main/java/net/md_5/bungee/api/connection/PendingConnection.java index 246dc44c..54fc4e8e 100644 --- a/api/src/main/java/net/md_5/bungee/api/PendingConnection.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/PendingConnection.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.api; +package net.md_5.bungee.api.connection; /** * Represents a user attempting to log into the proxy. diff --git a/api/src/main/java/net/md_5/bungee/api/ProxiedPlayer.java b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java similarity index 70% rename from api/src/main/java/net/md_5/bungee/api/ProxiedPlayer.java rename to api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java index c858cb49..166b43a6 100644 --- a/api/src/main/java/net/md_5/bungee/api/ProxiedPlayer.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java @@ -1,4 +1,6 @@ -package net.md_5.bungee.api; +package net.md_5.bungee.api.connection; + +import net.md_5.bungee.api.CommandSender; /** * Represents a player who's connection is being connected to somewhere else, diff --git a/api/src/main/java/net/md_5/bungee/api/Server.java b/api/src/main/java/net/md_5/bungee/api/connection/Server.java similarity index 86% rename from api/src/main/java/net/md_5/bungee/api/Server.java rename to api/src/main/java/net/md_5/bungee/api/connection/Server.java index 12476d0d..6e746f04 100644 --- a/api/src/main/java/net/md_5/bungee/api/Server.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/Server.java @@ -1,7 +1,9 @@ -package net.md_5.bungee.api; +package net.md_5.bungee.api.connection; import lombok.Getter; import lombok.RequiredArgsConstructor; +import net.md_5.bungee.api.Callback; +import net.md_5.bungee.api.ServerPing; /** * Represents a destination which this proxy might connect to. diff --git a/api/src/main/java/net/md_5/bungee/api/event/ChatEvent.java b/api/src/main/java/net/md_5/bungee/api/event/ChatEvent.java index af76d1d7..d0285329 100644 --- a/api/src/main/java/net/md_5/bungee/api/event/ChatEvent.java +++ b/api/src/main/java/net/md_5/bungee/api/event/ChatEvent.java @@ -3,7 +3,7 @@ package net.md_5.bungee.api.event; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import net.md_5.bungee.api.Connection; +import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.plugin.Cancellable; /** diff --git a/api/src/main/java/net/md_5/bungee/api/event/LoginEvent.java b/api/src/main/java/net/md_5/bungee/api/event/LoginEvent.java index bc300590..8b7db16c 100644 --- a/api/src/main/java/net/md_5/bungee/api/event/LoginEvent.java +++ b/api/src/main/java/net/md_5/bungee/api/event/LoginEvent.java @@ -1,7 +1,7 @@ package net.md_5.bungee.api.event; import lombok.Data; -import net.md_5.bungee.api.PendingConnection; +import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.plugin.Cancellable; /** diff --git a/api/src/main/java/net/md_5/bungee/api/event/PluginMessageEvent.java b/api/src/main/java/net/md_5/bungee/api/event/PluginMessageEvent.java index 3daec111..8ef3ac9b 100644 --- a/api/src/main/java/net/md_5/bungee/api/event/PluginMessageEvent.java +++ b/api/src/main/java/net/md_5/bungee/api/event/PluginMessageEvent.java @@ -3,7 +3,7 @@ package net.md_5.bungee.api.event; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import net.md_5.bungee.api.Connection; +import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.plugin.Cancellable; /** diff --git a/api/src/main/java/net/md_5/bungee/api/event/TargetedEvent.java b/api/src/main/java/net/md_5/bungee/api/event/TargetedEvent.java index c04d9be6..b4d3208c 100644 --- a/api/src/main/java/net/md_5/bungee/api/event/TargetedEvent.java +++ b/api/src/main/java/net/md_5/bungee/api/event/TargetedEvent.java @@ -2,7 +2,7 @@ package net.md_5.bungee.api.event; import lombok.AllArgsConstructor; import lombok.Data; -import net.md_5.bungee.api.Connection; +import net.md_5.bungee.api.connection.Connection; /** * An event which occurs in the communication between two nodes. It is not