Add ping event, change group management and other stuff.

This commit is contained in:
md_5 2013-01-12 14:17:02 +11:00
parent 4ce799ac9b
commit ded4d52151
5 changed files with 94 additions and 9 deletions

View File

@ -5,17 +5,54 @@ import java.util.Collection;
public interface CommandSender
{
/**
* Get the unique name of this command sender.
*
* @return the senders username
*/
public String getName();
/**
* Send a message to this sender.
*
* @param message the message to send
*/
public void sendMessage(String message);
/**
* Get all groups this user is part of.
*
* @return the users groups
*/
public Collection<String> getGroups();
/**
* Adds groups to a this user for the current session only.
*
* @param groups the groups to add
*/
public void addGroups(String... groups);
/**
* Remove groups from this user for the current session only.
*
* @param groups the groups to remove
*/
public void removeGroups(String... groups);
/**
* Checks if this user has the specified permission node.
*
* @param permission the node to check
* @return whether they have this node
*/
public boolean hasPermission(String permission);
public boolean setPermission(String permission, boolean value);
/**
* Set a permission node for this user.
*
* @param permission the node to set
* @param value the value of the node
*/
public void setPermission(String permission, boolean value);
}

View File

@ -1,5 +1,6 @@
package net.md_5.bungee.api.config;
import java.util.Collection;
import java.util.List;
import net.md_5.bungee.api.CommandSender;
@ -32,26 +33,36 @@ public interface ConfigurationAdapter
* @param path the path to retrieve the list from.
* @return the retrieved list.
*/
public List<String> getStringList(String path);
public Collection<String> getStrings(String path);
/**
* Get the configuration all servers which may be accessible via the proxy.
*
* @return all accessible servers
*/
public List<ServerInfo> getServers();
public Collection<ServerInfo> getServers();
/**
* Get information about all hosts to bind the proxy to.
*
* @return a list of all hosts to bind to
*/
public List<ListenerInfo> getListeners();
public Collection<ListenerInfo> getListeners();
/**
* Set the permissions of the specified {@link CommandSender}
* Get all groups this user is in.
*
* @param sender the sender to set permissions on.
* @param user the user to check
* @return all the user's groups.
*/
public void setPermissions(CommandSender sender);
public Collection<String> getGroups(String user);
/**
* Get all permission corresponding to the specified group. The result of
* this method may or may not be cached, depending on the implementation.
*
* @param group the group to check
* @return all true permissions for this group
*/
public Collection<String> getPermissions(String group);
}

View File

@ -3,6 +3,6 @@ package net.md_5.bungee.api.connection;
/**
* Represents a player physically connected to the world hosted on this server.
*/
public interface ConnectedPlayer extends ProxiedPlayer
public abstract class ConnectedPlayer extends ProxiedPlayer
{
}

View File

@ -1,14 +1,19 @@
package net.md_5.bungee.api.event;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;
/**
* Event called to represent a player logging in.
*/
@Data
public class LoginEvent implements Cancellable
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class LoginEvent extends Event implements Cancellable
{
/**

View File

@ -0,0 +1,32 @@
package net.md_5.bungee.api.event;
import java.net.InetSocketAddress;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.config.ListenerInfo;
import net.md_5.bungee.api.plugin.Event;
/**
* Called when the proxy is pinged with packet 0xFE from the server list.
*/
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class ProxyPingEvent extends Event
{
/**
* The address of the user pinging.
*/
private final InetSocketAddress remoteAddress;
/**
* The data corresponding to the server which received this ping.
*/
private final ListenerInfo server;
/**
* The data to respond with.
*/
private ServerPing response;
}