diff options
author | ementalo <ementalodev@gmx.co.uk> | 2012-05-28 00:37:28 +0100 |
---|---|---|
committer | ementalo <ementalodev@gmx.co.uk> | 2012-05-28 00:37:28 +0100 |
commit | 373a48da5412c6005f7ad2fe4bec41c68d4eb2a2 (patch) | |
tree | 3ebc11bffcb1dde3f3bd338fca97656d03511e70 /Essentials/src/com/earth2me/essentials/api | |
parent | 45c1e347b0698318ebd3772c540a9a52b6509daf (diff) | |
parent | b69a16bcf0abac1ebd2ca3d35520cfcb5b433e88 (diff) | |
download | Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.tar Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.tar.gz Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.tar.lz Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.tar.xz Essentials-373a48da5412c6005f7ad2fe4bec41c68d4eb2a2.zip |
Master -> 3.0
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/api')
26 files changed, 331 insertions, 395 deletions
diff --git a/Essentials/src/com/earth2me/essentials/api/ChargeException.java b/Essentials/src/com/earth2me/essentials/api/ChargeException.java new file mode 100644 index 000000000..5b157ce63 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/ChargeException.java @@ -0,0 +1,15 @@ +package com.earth2me.essentials.api; + + +public class ChargeException extends Exception +{ + public ChargeException(final String message) + { + super(message); + } + + public ChargeException(final String message, final Throwable throwable) + { + super(message, throwable); + } +} diff --git a/Essentials/src/com/earth2me/essentials/api/Economy.java b/Essentials/src/com/earth2me/essentials/api/Economy.java deleted file mode 100644 index 6ed1829b3..000000000 --- a/Essentials/src/com/earth2me/essentials/api/Economy.java +++ /dev/null @@ -1,311 +0,0 @@ -package com.earth2me.essentials.api; - -import com.earth2me.essentials.EssentialsConf; -import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.User; -import com.earth2me.essentials.Util; -import java.io.File; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.bukkit.entity.Player; - - -/** - * Instead of using this api directly, we recommend to use the register plugin: - * http://bit.ly/RegisterMethod - */ -public final class Economy -{ - private Economy() - { - } - private static final Logger logger = Logger.getLogger("Minecraft"); - private static IEssentials ess; - private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded."; - - /** - * @param aEss the ess to set - */ - public static void setEss(IEssentials aEss) - { - ess = aEss; - } - - private static void createNPCFile(String name) - { - File folder = new File(ess.getDataFolder(), "userdata"); - if (!folder.exists()) - { - folder.mkdirs(); - } - EssentialsConf npcConfig = new EssentialsConf(new File(folder, Util.sanitizeFileName(name) + ".yml")); - npcConfig.load(); - npcConfig.setProperty("npc", true); - npcConfig.setProperty("money", ess.getSettings().getStartingBalance()); - npcConfig.save(); - } - - private static void deleteNPC(String name) - { - File folder = new File(ess.getDataFolder(), "userdata"); - if (!folder.exists()) - { - folder.mkdirs(); - } - File config = new File(folder, Util.sanitizeFileName(name) + ".yml"); - EssentialsConf npcConfig = new EssentialsConf(config); - npcConfig.load(); - if (npcConfig.hasProperty("npc") && npcConfig.getBoolean("npc", false)) - { - if (!config.delete()) - { - logger.log(Level.WARNING, _("deleteFileError", config)); - } - ess.getUserMap().removeUser(name); - } - } - - private static User getUserByName(String name) - { - if (ess == null) - { - throw new RuntimeException(noCallBeforeLoad); - } - User user; - Player player = ess.getServer().getPlayer(name); - if (player != null) - { - user = ess.getUser(player); - } - else - { - user = ess.getOfflineUser(name); - } - return user; - } - - /** - * Returns the balance of a user - * @param name Name of the user - * @return balance - * @throws UserDoesNotExistException - */ - public static double getMoney(String name) throws UserDoesNotExistException - { - User user = getUserByName(name); - if (user == null) - { - throw new UserDoesNotExistException(name); - } - return user.getMoney(); - } - - /** - * Sets the balance of a user - * @param name Name of the user - * @param balance The balance you want to set - * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance - */ - public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException - { - User user = getUserByName(name); - if (user == null) - { - throw new UserDoesNotExistException(name); - } - if (balance < ess.getSettings().getMinMoney()) - { - throw new NoLoanPermittedException(); - } - if (balance < 0.0 && !user.isAuthorized("essentials.eco.loan")) - { - throw new NoLoanPermittedException(); - } - user.setMoney(balance); - } - - /** - * Adds money to the balance of a user - * @param name Name of the user - * @param amount The money you want to add - * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance - */ - public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException - { - double result = getMoney(name) + amount; - setMoney(name, result); - } - - /** - * Substracts money from the balance of a user - * @param name Name of the user - * @param amount The money you want to substract - * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance - */ - public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException - { - double result = getMoney(name) - amount; - setMoney(name, result); - } - - /** - * Divides the balance of a user by a value - * @param name Name of the user - * @param value The balance is divided by this value - * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance - */ - public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException - { - double result = getMoney(name) / value; - setMoney(name, result); - } - - /** - * Multiplies the balance of a user by a value - * @param name Name of the user - * @param value The balance is multiplied by this value - * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance - */ - public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException - { - double result = getMoney(name) * value; - setMoney(name, result); - } - - /** - * Resets the balance of a user to the starting balance - * @param name Name of the user - * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance - */ - public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException - { - if (ess == null) - { - throw new RuntimeException(noCallBeforeLoad); - } - setMoney(name, ess.getSettings().getStartingBalance()); - } - - /** - * @param name Name of the user - * @param amount The amount of money the user should have - * @return true, if the user has more or an equal amount of money - * @throws UserDoesNotExistException If a user by that name does not exists - */ - public static boolean hasEnough(String name, double amount) throws UserDoesNotExistException - { - return amount <= getMoney(name); - } - - /** - * @param name Name of the user - * @param amount The amount of money the user should have - * @return true, if the user has more money - * @throws UserDoesNotExistException If a user by that name does not exists - */ - public static boolean hasMore(String name, double amount) throws UserDoesNotExistException - { - return amount < getMoney(name); - } - - /** - * @param name Name of the user - * @param amount The amount of money the user should not have - * @return true, if the user has less money - * @throws UserDoesNotExistException If a user by that name does not exists - */ - public static boolean hasLess(String name, double amount) throws UserDoesNotExistException - { - return amount > getMoney(name); - } - - /** - * Test if the user has a negative balance - * @param name Name of the user - * @return true, if the user has a negative balance - * @throws UserDoesNotExistException If a user by that name does not exists - */ - public static boolean isNegative(String name) throws UserDoesNotExistException - { - return getMoney(name) < 0.0; - } - - /** - * Formats the amount of money like all other Essentials functions. - * Example: $100000 or $12345.67 - * @param amount The amount of money - * @return Formatted money - */ - public static String format(double amount) - { - if (ess == null) - { - throw new RuntimeException(noCallBeforeLoad); - } - return Util.displayCurrency(amount, ess); - } - - /** - * Test if a player exists to avoid the UserDoesNotExistException - * @param name Name of the user - * @return true, if the user exists - */ - public static boolean playerExists(String name) - { - return getUserByName(name) != null; - } - - /** - * Test if a player is a npc - * @param name Name of the player - * @return true, if it's a npc - * @throws UserDoesNotExistException - */ - public static boolean isNPC(String name) throws UserDoesNotExistException - { - User user = getUserByName(name); - if (user == null) - { - throw new UserDoesNotExistException(name); - } - return user.isNPC(); - } - - /** - * Creates dummy files for a npc, if there is no player yet with that name. - * @param name Name of the player - * @return true, if a new npc was created - */ - public static boolean createNPC(String name) - { - User user = getUserByName(name); - if (user == null) - { - createNPCFile(name); - return true; - } - return false; - } - - /** - * Deletes a user, if it is marked as npc. - * @param name Name of the player - * @throws UserDoesNotExistException - */ - public static void removeNPC(String name) throws UserDoesNotExistException - { - User user = getUserByName(name); - if (user == null) - { - throw new UserDoesNotExistException(name); - } - deleteNPC(name); - } -} diff --git a/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java deleted file mode 100644 index 11619bca4..000000000 --- a/Essentials/src/com/earth2me/essentials/api/IAlternativeCommandsHandler.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.earth2me.essentials.api; - -import java.util.Map; -import org.bukkit.command.PluginCommand; - - -public interface IAlternativeCommandsHandler -{ - Map<String, String> disabledCommands(); -} diff --git a/Essentials/src/com/earth2me/essentials/api/IBackup.java b/Essentials/src/com/earth2me/essentials/api/IBackup.java new file mode 100644 index 000000000..8af074c54 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IBackup.java @@ -0,0 +1,7 @@ +package com.earth2me.essentials.api; + + +public interface IBackup extends Runnable +{ + public void startTask(); +} diff --git a/Essentials/src/com/earth2me/essentials/api/ICommandHandler.java b/Essentials/src/com/earth2me/essentials/api/ICommandHandler.java new file mode 100644 index 000000000..f756c16c4 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/ICommandHandler.java @@ -0,0 +1,20 @@ +package com.earth2me.essentials.api; + +import java.util.Map; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.Plugin; + + +public interface ICommandHandler extends IReload +{ + Map<String, String> disabledCommands(); + + public void removePlugin(Plugin plugin); + + public void addPlugin(Plugin plugin); + + boolean handleCommand(CommandSender sender, Command command, String commandLabel, String[] args); + + void showCommandError(CommandSender sender, String commandLabel, Throwable exception); +} diff --git a/Essentials/src/com/earth2me/essentials/api/IEconomy.java b/Essentials/src/com/earth2me/essentials/api/IEconomy.java new file mode 100644 index 000000000..092d86c88 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IEconomy.java @@ -0,0 +1,21 @@ +package com.earth2me.essentials.api; + + +public interface IEconomy extends IReload +{ + public double getMoney(String name) throws UserDoesNotExistException; + + public void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException; + + public void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException; + + public String format(double amount); + + public boolean playerExists(String name); + + public boolean isNPC(String name) throws UserDoesNotExistException; + + public boolean createNPC(String name); + + public void removeNPC(String name) throws UserDoesNotExistException; +} diff --git a/Essentials/src/com/earth2me/essentials/api/IEssentials.java b/Essentials/src/com/earth2me/essentials/api/IEssentials.java index c04bed0bd..42c9a964d 100644 --- a/Essentials/src/com/earth2me/essentials/api/IEssentials.java +++ b/Essentials/src/com/earth2me/essentials/api/IEssentials.java @@ -1,17 +1,19 @@ package com.earth2me.essentials.api; -import com.earth2me.essentials.perm.IPermissionsHandler; -import com.earth2me.essentials.register.payment.Methods; +import com.earth2me.essentials.listener.TntExplodeListener; +import com.earth2me.essentials.economy.register.Methods; import org.bukkit.World; -import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -public interface IEssentials extends Plugin, IReload +public interface IEssentials extends Plugin { void addReloadListener(IReload listener); - IUser getUser(Object base); + IUser getUser(Player player); + + IUser getUser(String playerName); int broadcastMessage(IUser sender, String message); @@ -19,7 +21,11 @@ public interface IEssentials extends Plugin, IReload ISettings getSettings(); - IJails getJail(); + IRanks getRanks(); + + IJails getJails(); + + IKits getKits(); IWarps getWarps(); @@ -29,7 +35,9 @@ public interface IEssentials extends Plugin, IReload IUserMap getUserMap(); - IEssentialsEconomy getEconomy(); + IBackup getBackup(); + + ICommandHandler getCommandHandler(); World getWorld(String name); @@ -43,9 +51,14 @@ public interface IEssentials extends Plugin, IReload int scheduleSyncRepeatingTask(Runnable run, long delay, long period); - IPermissionsHandler getPermissionsHandler(); + //IPermissionsHandler getPermissionsHandler(); + void reload(); + + TntExplodeListener getTNTListener(); + + void setRanks(IRanks groups); - IAlternativeCommandsHandler getAlternativeCommandsHandler(); + void removeReloadListener(IReload groups); - void showCommandError(CommandSender sender, String commandLabel, Throwable exception); + IEconomy getEconomy(); } diff --git a/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java b/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java deleted file mode 100644 index 72fb89d26..000000000 --- a/Essentials/src/com/earth2me/essentials/api/IEssentialsEconomy.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.earth2me.essentials.api; - - -public interface IEssentialsEconomy -{ - double getMoney(String name) throws UserDoesNotExistException; - - void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException; - - void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException; - - void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException; - - void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException; - - void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException; - - void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException; - - boolean hasEnough(String name, double amount) throws UserDoesNotExistException; - - boolean hasMore(String name, double amount) throws UserDoesNotExistException; - - boolean hasLess(String name, double amount) throws UserDoesNotExistException; - - boolean isNegative(String name) throws UserDoesNotExistException; - - String format(double amount); - - boolean playerExists(String name); - - boolean isNPC(String name) throws UserDoesNotExistException; - - boolean createNPC(String name); - - void removeNPC(String name) throws UserDoesNotExistException; -} diff --git a/Essentials/src/com/earth2me/essentials/api/IEssentialsModule.java b/Essentials/src/com/earth2me/essentials/api/IEssentialsModule.java new file mode 100644 index 000000000..cc185980a --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IEssentialsModule.java @@ -0,0 +1,6 @@ +package com.earth2me.essentials.api; + + +public interface IEssentialsModule +{ +} diff --git a/Essentials/src/com/earth2me/essentials/api/IItemDb.java b/Essentials/src/com/earth2me/essentials/api/IItemDb.java index ee4819215..29f97488c 100644 --- a/Essentials/src/com/earth2me/essentials/api/IItemDb.java +++ b/Essentials/src/com/earth2me/essentials/api/IItemDb.java @@ -3,9 +3,11 @@ package com.earth2me.essentials.api; import org.bukkit.inventory.ItemStack; -public interface IItemDb +public interface IItemDb extends IReload { + ItemStack get(final String name, final IUser user) throws Exception; + ItemStack get(final String name, final int quantity) throws Exception; - + ItemStack get(final String name) throws Exception; } diff --git a/Essentials/src/com/earth2me/essentials/api/IJails.java b/Essentials/src/com/earth2me/essentials/api/IJails.java index e19b76837..fb8d2f090 100644 --- a/Essentials/src/com/earth2me/essentials/api/IJails.java +++ b/Essentials/src/com/earth2me/essentials/api/IJails.java @@ -14,7 +14,7 @@ public interface IJails extends IReload void removeJail(String jail) throws Exception; - void sendToJail(com.earth2me.essentials.IUser user, String jail) throws Exception; + void sendToJail(IUser user, String jail) throws Exception; void setJail(String jailName, Location loc) throws Exception; } diff --git a/Essentials/src/com/earth2me/essentials/api/IKits.java b/Essentials/src/com/earth2me/essentials/api/IKits.java new file mode 100644 index 000000000..85ca4cdea --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IKits.java @@ -0,0 +1,18 @@ +package com.earth2me.essentials.api; + +import com.earth2me.essentials.settings.Kit; +import java.util.Collection; + + +public interface IKits extends IReload +{ + Kit getKit(String kit) throws Exception; + + void sendKit(IUser user, String kit) throws Exception; + + void sendKit(IUser user, Kit kit) throws Exception; + + Collection<String> getList() throws Exception; + + boolean isEmpty(); +} diff --git a/Essentials/src/com/earth2me/essentials/api/IPermission.java b/Essentials/src/com/earth2me/essentials/api/IPermission.java new file mode 100644 index 000000000..d388bff47 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IPermission.java @@ -0,0 +1,17 @@ +package com.earth2me.essentials.api; + +import org.bukkit.command.CommandSender; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; + + +public interface IPermission +{ + String getPermission(); + + boolean isAuthorized(CommandSender sender); + + Permission getBukkitPermission(); + + PermissionDefault getPermissionDefault(); +} diff --git a/Essentials/src/com/earth2me/essentials/api/IRanks.java b/Essentials/src/com/earth2me/essentials/api/IRanks.java new file mode 100644 index 000000000..e29b31302 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IRanks.java @@ -0,0 +1,25 @@ +package com.earth2me.essentials.api; + +import java.text.MessageFormat; + + +public interface IRanks +{ + String getMainGroup(IUser player); + + boolean inGroup(IUser player, String groupname); + + double getHealCooldown(IUser player); + + double getTeleportCooldown(IUser player); + + double getTeleportDelay(IUser player); + + String getPrefix(IUser player); + + String getSuffix(IUser player); + + int getHomeLimit(IUser player); + + MessageFormat getChatFormat(IUser player); +} diff --git a/Essentials/src/com/earth2me/essentials/api/IReplyTo.java b/Essentials/src/com/earth2me/essentials/api/IReplyTo.java new file mode 100644 index 000000000..3003ca3df --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IReplyTo.java @@ -0,0 +1,11 @@ +package com.earth2me.essentials.api; + +import org.bukkit.command.CommandSender; + + +public interface IReplyTo +{ + void setReplyTo(CommandSender user); + + CommandSender getReplyTo(); +} diff --git a/Essentials/src/com/earth2me/essentials/api/ISettings.java b/Essentials/src/com/earth2me/essentials/api/ISettings.java index eff65ad87..a445d21b4 100644 --- a/Essentials/src/com/earth2me/essentials/api/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/api/ISettings.java @@ -6,5 +6,9 @@ import com.earth2me.essentials.storage.IStorageObjectHolder; public interface ISettings extends IStorageObjectHolder<Settings> { - + public String getLocale(); + + public boolean isDebug(); + + public void setDebug(boolean b); } diff --git a/Essentials/src/com/earth2me/essentials/api/ITeleport.java b/Essentials/src/com/earth2me/essentials/api/ITeleport.java index 5b9a19757..3a5f25f78 100644 --- a/Essentials/src/com/earth2me/essentials/api/ITeleport.java +++ b/Essentials/src/com/earth2me/essentials/api/ITeleport.java @@ -1,10 +1,28 @@ package com.earth2me.essentials.api; +import com.earth2me.essentials.economy.Trade; import org.bukkit.Location; +import org.bukkit.entity.Entity; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public interface ITeleport { void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception; + + void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception; + + void back(Trade chargeFor) throws Exception; + + void teleport(Location bed, Trade charge, TeleportCause teleportCause) throws Exception; + + void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception; + + void home(IUser player, String toLowerCase, Trade charge) throws Exception; + + void respawn(Trade charge, TeleportCause teleportCause) throws Exception; + + void back() throws Exception; + + public void warp(String name, Trade charge, TeleportCause teleportCause) throws Exception; } diff --git a/Essentials/src/com/earth2me/essentials/api/IUser.java b/Essentials/src/com/earth2me/essentials/api/IUser.java index 5d2f9d4b8..091b141df 100644 --- a/Essentials/src/com/earth2me/essentials/api/IUser.java +++ b/Essentials/src/com/earth2me/essentials/api/IUser.java @@ -1,43 +1,110 @@ package com.earth2me.essentials.api; -import com.earth2me.essentials.commands.IEssentialsCommand; +import com.earth2me.essentials.storage.IStorageObjectHolder; +import com.earth2me.essentials.user.CooldownException; +import com.earth2me.essentials.user.UserData; +import java.util.List; import org.bukkit.Location; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; -public interface IUser extends Player, IReload +public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload, IReplyTo, Comparable<IUser> { - long getLastTeleportTimestamp(); + Player getBase(); - boolean isAuthorized(String node); + double getMoney(); - boolean isAuthorized(IEssentialsCommand cmd); + void takeMoney(double value); - boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix); + void takeMoney(double value, CommandSender initiator); - void setLastTeleportTimestamp(long time); + void giveMoney(double value); - Location getLastLocation(); + void giveMoney(double value, CommandSender initiator); - Player getBase(); + void giveItems(ItemStack itemStack, Boolean canSpew) throws ChargeException; - double getMoney(); + void giveItems(List<ItemStack> itemStacks, Boolean canSpew) throws ChargeException; - void takeMoney(double value); - - void giveMoney(double value); + void setMoney(double value); - String getGroup(); + void payUser(final IUser reciever, final double value) throws Exception; void setLastLocation(); Location getHome(String name) throws Exception; - Location getHome(Location loc) throws Exception; + Location getHome(Location loc); boolean isHidden(); - + ITeleport getTeleport(); - - void setJail(String jail); + + void checkCooldown(UserData.TimestampType cooldownType, double cooldown, boolean set, IPermission bypassPermission) throws CooldownException; + + boolean toggleAfk(); + + void updateActivity(boolean broadcast); + + void updateDisplayName(); + + boolean checkJailTimeout(long currentTime); + + boolean checkMuteTimeout(long currentTime); + + boolean checkBanTimeout(long currentTime); + + long getTimestamp(UserData.TimestampType name); + + void setTimestamp(UserData.TimestampType name, long value); + + void setLastOnlineActivity(long currentTime); + + void checkActivity(); + + long getLastOnlineActivity(); + + boolean isGodModeEnabled(); + + boolean isIgnoringPlayer(String name); + + void setIgnoredPlayer(String name, boolean set); + + Location getAfkPosition(); + + boolean toggleGodModeEnabled(); + + void dispose(); + + void updateCompass(); + + List<String> getHomes(); + + void addMail(String string); + + boolean toggleMuted(); + + boolean toggleSocialSpy(); + + void requestTeleport(IUser user, boolean b); + + boolean isTeleportRequestHere(); + + IUser getTeleportRequester(); + + boolean toggleTeleportEnabled(); + + long getTeleportRequestTime(); + + boolean gotMailInfo(); + + List<String> getMails(); + + public boolean canAfford(double money); + + public void updateMoneyCache(double userMoney); + + public boolean canAfford(double amount, boolean b); } diff --git a/Essentials/src/com/earth2me/essentials/api/IUserMap.java b/Essentials/src/com/earth2me/essentials/api/IUserMap.java index 9e609ab37..fbe6cfa0e 100644 --- a/Essentials/src/com/earth2me/essentials/api/IUserMap.java +++ b/Essentials/src/com/earth2me/essentials/api/IUserMap.java @@ -2,19 +2,22 @@ package com.earth2me.essentials.api; import java.io.File; import java.util.Set; +import org.bukkit.entity.Player; -public interface IUserMap +public interface IUserMap extends IReload { boolean userExists(final String name); - IUser getUser(final String name); + IUser getUser(final Player player); - void removeUser(final String name); + IUser getUser(final String playerName); + + void removeUser(final String name) throws InvalidNameException; Set<String> getAllUniqueUsers(); int getUniqueUsers(); - File getUserFile(final String name); + File getUserFile(final String name) throws InvalidNameException; } diff --git a/Essentials/src/com/earth2me/essentials/api/IWarp.java b/Essentials/src/com/earth2me/essentials/api/IWarp.java new file mode 100644 index 000000000..f08e5757d --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/IWarp.java @@ -0,0 +1,9 @@ +package com.earth2me.essentials.api; + +import com.earth2me.essentials.settings.Warp; +import com.earth2me.essentials.storage.IStorageObjectHolder; + + +public interface IWarp extends IStorageObjectHolder<Warp> +{ +} diff --git a/Essentials/src/com/earth2me/essentials/api/IWarps.java b/Essentials/src/com/earth2me/essentials/api/IWarps.java index 14779e327..2a98ecc64 100644 --- a/Essentials/src/com/earth2me/essentials/api/IWarps.java +++ b/Essentials/src/com/earth2me/essentials/api/IWarps.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.api; +import java.io.File; import java.util.Collection; import org.bukkit.Location; @@ -8,9 +9,13 @@ public interface IWarps extends IReload { Location getWarp(String warp) throws Exception; - Collection<String> getWarps(); + Collection<String> getList(); void removeWarp(String name) throws Exception; void setWarp(String name, Location loc) throws Exception; + + public boolean isEmpty(); + + public File getWarpFile(String name) throws InvalidNameException; } diff --git a/Essentials/src/com/earth2me/essentials/api/InvalidNameException.java b/Essentials/src/com/earth2me/essentials/api/InvalidNameException.java new file mode 100644 index 000000000..951c66b17 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/InvalidNameException.java @@ -0,0 +1,10 @@ +package com.earth2me.essentials.api; + + +public class InvalidNameException extends Exception +{ + public InvalidNameException(Throwable thrwbl) + { + super(thrwbl); + } +} diff --git a/Essentials/src/com/earth2me/essentials/api/server/IPermission.java b/Essentials/src/com/earth2me/essentials/api/server/IPermission.java new file mode 100644 index 000000000..3b5cf2eb4 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/server/IPermission.java @@ -0,0 +1,5 @@ +package com.earth2me.essentials.api.server; + +public interface IPermission { + +} diff --git a/Essentials/src/com/earth2me/essentials/api/server/IPermissionsManager.java b/Essentials/src/com/earth2me/essentials/api/server/IPermissionsManager.java new file mode 100644 index 000000000..d8f017e20 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/server/IPermissionsManager.java @@ -0,0 +1,8 @@ +package com.earth2me.essentials.api.server; + +public interface IPermissionsManager { + + IPermission registerPermission(); + + boolean checkPermission(IPlayer player, IPermission perm); +} diff --git a/Essentials/src/com/earth2me/essentials/api/server/IPlayer.java b/Essentials/src/com/earth2me/essentials/api/server/IPlayer.java new file mode 100644 index 000000000..7d0899e81 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/server/IPlayer.java @@ -0,0 +1,5 @@ +package com.earth2me.essentials.api.server; + +public interface IPlayer { + +} diff --git a/Essentials/src/com/earth2me/essentials/api/server/IServer.java b/Essentials/src/com/earth2me/essentials/api/server/IServer.java new file mode 100644 index 000000000..2c267b6cb --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/api/server/IServer.java @@ -0,0 +1,5 @@ +package com.earth2me.essentials.api.server; + +public interface IServer { + +} |