Pretty close to compiling for the first time in ages. It wont be anywhere near working though.

This commit is contained in:
md_5
2013-01-19 10:49:11 +11:00
parent 8bff34b8b6
commit cf42a10ba4
7 changed files with 120 additions and 120 deletions

View File

@@ -6,6 +6,7 @@ import java.util.Collection;
import java.util.logging.Logger;
import lombok.Getter;
import net.md_5.bungee.api.config.ConfigurationAdapter;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.plugin.Plugin;
@@ -74,13 +75,6 @@ public abstract class ProxyServer
*/
public abstract Server getServer(String name);
/**
* Return all servers configured as proxy targets.
*
* @return all known target servers
*/
public abstract Collection<Server> getServers();
/**
* Get the {@link PluginManager} associated with loading plugins and
* dispatching events. It is recommended that implementations use the

View File

@@ -1,8 +1,13 @@
package net.md_5.bungee.api.config;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Synchronized;
import net.md_5.bungee.api.connection.ProxiedPlayer;
/**
* Class used to represent a server to connect to.
@@ -24,4 +29,41 @@ public class ServerInfo
* Permission node required to access this server.
*/
private String permission;
/**
* Players connected to a server defined by these properties.
*/
private final Collection<ProxiedPlayer> players = new ArrayList<>();
/**
* Add a player to the internal set of this server.
*
* @param player the player to add
*/
@Synchronized("players")
public void addPlayer(ProxiedPlayer player)
{
players.add(player);
}
/**
* Remove a player form the internal set of this server.
*
* @param player the player to remove
*/
@Synchronized("players")
public void removePlayer(ProxiedPlayer player)
{
players.remove(player);
}
/**
* Get the set of all players on this server.
*
* @return an unmodifiable collection of all players on this server
*/
@Synchronized("players")
public Collection<ProxiedPlayer> getPlayers()
{
return Collections.unmodifiableCollection(players);
}
}

View File

@@ -1,8 +1,7 @@
package net.md_5.bungee.api.connection;
import lombok.Getter;
import lombok.Setter;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.config.ServerInfo;
/**
* Represents a player who's connection is being connected to somewhere else,
@@ -31,9 +30,9 @@ public interface ProxiedPlayer extends Connection, CommandSender
* closing the current one. Depending on the implementation, this method
* might return before the user has been connected.
*
* @param server the new server to connect to
* @param target the new server to connect to
*/
public void connect(Server server);
public void connect(ServerInfo target);
/**
* Gets the server this player is connected to.

View File

@@ -4,8 +4,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.plugin.Event;
@Data
@@ -22,5 +22,5 @@ public class ServerConnectEvent extends Event
/**
* Server the player will be connected to.
*/
private Server target;
private ServerInfo target;
}