1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-06 06:37:28 +02:00

More work on the API

This commit is contained in:
Iaccidentally
2013-05-25 18:52:17 -04:00
parent bc29f9d4b1
commit cf3ab408b4
8 changed files with 126 additions and 31 deletions

View File

@@ -12,7 +12,7 @@ public interface IPlugin extends Plugin
/** /**
* Get an instance of essentials * Get an instance of essentials
* *
* @return * @return the instance
*/ */
IEssentials getEssentials(); IEssentials getEssentials();

View File

@@ -7,20 +7,23 @@ import net.ess3.storage.IStorageObjectHolder;
public interface ISettings extends IStorageObjectHolder<Settings> public interface ISettings extends IStorageObjectHolder<Settings>
{ {
/** /**
* Used to get the locale string
* *
* @return * @return the current locale string (i.e. en_US)
*/ */
String getLocale(); String getLocale();
/** /**
* Used to check if debug mode is enabled
* *
* @return * @return true if debug is enabled
*/ */
boolean isDebug(); boolean isDebug();
/** /**
* Used to set debug mode
* *
* @param b **TODO: rename this, "b" is a terrible name** * @param set
*/ */
void setDebug(boolean b); void setDebug(boolean set);
} }

View File

@@ -10,100 +10,117 @@ import org.bukkit.entity.Player;
public interface IUserMap extends IReload public interface IUserMap extends IReload
{ {
/** /**
* Used to check if a user exists (they exist if they have userdata)
* *
* @param name * @param name the name of the user to check
* @return * @return true if the user exists, false if not
*/ */
boolean userExists(final String name); boolean userExists(final String name);
/** /**
* Used to get the user associated with the given Player object
* *
* @param player * @param player the Player object
* @return * @return the User object
*/ */
IUser getUser(final Player player); IUser getUser(final Player player);
/** /**
* Used to get the user associated with the given name
* *
* @param playerName * @param playerName the name of the player
* @return * @return the User object
*/ */
IUser getUser(final String playerName); IUser getUser(final String playerName);
/** /**
* Used to remove a user from the userMap
* *
* @param name * @param name the name of the user to remove
* @throws InvalidNameException * @throws InvalidNameException if the name does not match any user in the UserMap
*/ */
void removeUser(final String name) throws InvalidNameException; void removeUser(final String name) throws InvalidNameException;
/** /**
* Gets a set of all the unique users in the UserMap
* *
* @return * @return the Users
*/ */
Set<String> getAllUniqueUsers(); Set<String> getAllUniqueUsers();
/** /**
* Gets the number of unique users in the UserMap
* *
* @return * @return the number of unique users
*/ */
int getUniqueUsers(); int getUniqueUsers();
/** /**
* Used to get the file of the given user
* *
* @param name * @param name the name of the user
* @return * @return the file
* @throws InvalidNameException * @throws InvalidNameException
*/ */
File getUserFile(final String name) throws InvalidNameException; File getUserFile(final String name) throws InvalidNameException;
/** /**
* Used to match a user to a given name
* This method never returns null and includes hidden players. * This method never returns null and includes hidden players.
* *
* @param name * @param name the name to match
* @param includeOffline * @param includeOffline set to true to check offline users as well, false if not
* @return * @return the matched user
* @throws TooManyMatchesException if more than one player is found matching the name * @throws TooManyMatchesException if more than one player is found matching the name
* @throws PlayerNotFoundException if the player matching the name is not found * @throws PlayerNotFoundException if the player matching the name is not found
*/ */
IUser matchUser(final String name, final boolean includeOffline) throws TooManyMatchesException, PlayerNotFoundException; IUser matchUser(final String name, final boolean includeOffline) throws TooManyMatchesException, PlayerNotFoundException;
/** /**
* Used to match a user to a given name
* This method never returns null and is for online players only. * This method never returns null and is for online players only.
* *
* @param name * @param name the name to match
* @param requester Can be null, if the requester is the console * @param requester Can be null, if the requester is the console
* @return * @return the matched user
* @throws TooManyMatchesException if more than one player is found matching the name * @throws TooManyMatchesException if more than one player is found matching the name
* @throws PlayerNotFoundException if the player matching the name is not found * @throws PlayerNotFoundException if the player matching the name is not found
*/ */
IUser matchUserExcludingHidden(final String name, final Player requester) throws TooManyMatchesException, PlayerNotFoundException; IUser matchUserExcludingHidden(final String name, final Player requester) throws TooManyMatchesException, PlayerNotFoundException;
/** /**
* Used to match multiple users
* This method never returns null and includes hidden players.
* *
* @param name * @param name the name to match
* @param includeOffline * @param includeOffline set to true to check offline users as well, false if not
* @return * @return the matched user(s)
*/ */
Set<IUser> matchUsers(final String name, final boolean includeOffline); Set<IUser> matchUsers(final String name, final boolean includeOffline);
/** /**
* Used to match multiple users
* This method never returns null and is for online players only.
* *
* @param name * @param name the name to match
* @param requester * @param requester Can be null, if the requester is the console
* @return * @return the matched user(s)
*/ */
Set<IUser> matchUsersExcludingHidden(final String name, final Player requester); Set<IUser> matchUsersExcludingHidden(final String name, final Player requester);
/** /**
* Used to add a player to the map of pre-joined players
* **TODO: we shouldn't be using player objects here**
* *
* @param player * @param player the player to add
*/ */
void addPrejoinedPlayer(Player player); void addPrejoinedPlayer(Player player);
/** /**
* Used to remove a player from the map of pre-joined players
* **TODO: we shouldn't be using player objects here**
* *
* @param player * @param player the player to remove
*/ */
void removePrejoinedPlayer(Player player); void removePrejoinedPlayer(Player player);
} }

View File

@@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
public class UserMap extends StorageObjectMap<IUser> implements IUserMap public class UserMap extends StorageObjectMap<IUser> implements IUserMap
{ {
private final Map<String, Player> prejoinedPlayers = new HashMap<String, Player>(); private final Map<String, Player> prejoinedPlayers = new HashMap<String, Player>(); //TODO: We shouldn't be using a player object here
public UserMap(final IEssentials ess) public UserMap(final IEssentials ess)
{ {

View File

@@ -5,9 +5,21 @@ import org.bukkit.plugin.Plugin;
public interface IAntiBuild extends Plugin public interface IAntiBuild extends Plugin
{ {
/**
*
* @return
*/
EssentialsConnect getEssentialsConnect(); EssentialsConnect getEssentialsConnect();
/**
*
* @return
*/
AntiBuildHolder getSettings(); AntiBuildHolder getSettings();
/**
*
* @param settings
*/
void setSettings(AntiBuildHolder settings); void setSettings(AntiBuildHolder settings);
} }

View File

@@ -5,9 +5,21 @@ import org.bukkit.plugin.Plugin;
public interface IProtect extends Plugin public interface IProtect extends Plugin
{ {
/**
*
* @return
*/
EssentialsConnect getEssentialsConnect(); EssentialsConnect getEssentialsConnect();
/**
*
* @return
*/
ProtectHolder getSettings(); ProtectHolder getSettings();
/**
*
* @param settings
*/
void setSettings(ProtectHolder settings); void setSettings(ProtectHolder settings);
} }

View File

@@ -3,5 +3,9 @@ package net.ess3.signs;
public interface ISignsPlugin public interface ISignsPlugin
{ {
/**
*
* @return
*/
SignsConfigHolder getSettings(); SignsConfigHolder getSettings();
} }

View File

@@ -8,21 +8,68 @@ import org.bukkit.plugin.Plugin;
public interface IEssentialsXMPP extends Plugin public interface IEssentialsXMPP extends Plugin
{ {
/**
*
* @param user
* @return
*/
String getAddress(final CommandSender user); String getAddress(final CommandSender user);
/**
*
* @param name
* @return
*/
String getAddress(final String name); String getAddress(final String name);
/**
*
* @return
*/
List<String> getSpyUsers(); List<String> getSpyUsers();
/**
*
* @param address
* @return
*/
IUser getUserByAddress(final String address); IUser getUserByAddress(final String address);
/**
*
* @param user
* @param message
* @return
*/
boolean sendMessage(final CommandSender user, final String message); boolean sendMessage(final CommandSender user, final String message);
/**
*
* @param address
* @param message
* @return
*/
boolean sendMessage(final String address, final String message); boolean sendMessage(final String address, final String message);
/**
*
* @param user
* @param address
*/
void setAddress(final CommandSender user, final String address); void setAddress(final CommandSender user, final String address);
/**
*
* @param user
* @return
*/
boolean toggleSpy(final CommandSender user); boolean toggleSpy(final CommandSender user);
/**
*
* @param sender
* @param message
* @param xmppAddress
*/
void broadcastMessage(final IUser sender, final String message, final String xmppAddress); void broadcastMessage(final IUser sender, final String message, final String xmppAddress);
} }