diff --git a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java index e9cb6fe19..59eb5326b 100644 --- a/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java +++ b/Essentials/src/com/earth2me/essentials/AlternativeCommandsHandler.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/Essentials/src/com/earth2me/essentials/Backup.java b/Essentials/src/com/earth2me/essentials/Backup.java index 3b7d9297c..0c47c4800 100644 --- a/Essentials/src/com/earth2me/essentials/Backup.java +++ b/Essentials/src/com/earth2me/essentials/Backup.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import java.io.BufferedReader; import java.io.IOException; diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index c5ec3556a..24827e099 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -17,9 +17,12 @@ */ package com.earth2me.essentials; +import net.ess3.api.ISettings; +import net.ess3.api.IEssentials; +import net.ess3.api.IUser; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.api.Economy; -import com.earth2me.essentials.api.IJails; +import net.ess3.api.Economy; +import net.ess3.api.IJails; import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.commands.NoChargeException; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java index a10015b79..890b8e248 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.utils.LocationUtil; import java.util.Locale; import org.bukkit.GameMode; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index d0a27e7aa..2827332eb 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -2,7 +2,7 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.api.InvalidWorldException; +import net.ess3.api.InvalidWorldException; import com.google.common.io.Files; import java.io.*; import java.math.BigDecimal; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 9bfc15eea..d1fa7e9e7 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import java.util.List; import java.util.logging.Level; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 75bdbde34..c012347a5 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.textreader.IText; import com.earth2me.essentials.textreader.KeywordReplacer; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java index 75cb278e3..e071c3d98 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import java.util.logging.Level; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java index 2d3b4a1cc..e0881b080 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsTimer.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsTimer.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java index 5fabf8c7b..8286d46f6 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.utils.StringUtil; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.craftbukkit.FakeWorld; diff --git a/Essentials/src/com/earth2me/essentials/I18n.java b/Essentials/src/com/earth2me/essentials/I18n.java index 2773a96c4..ab5953daa 100644 --- a/Essentials/src/com/earth2me/essentials/I18n.java +++ b/Essentials/src/com/earth2me/essentials/I18n.java @@ -1,6 +1,7 @@ package com.earth2me.essentials; -import com.earth2me.essentials.api.II18n; +import net.ess3.api.IEssentials; +import net.ess3.api.II18n; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; diff --git a/Essentials/src/com/earth2me/essentials/IEssentials.java b/Essentials/src/com/earth2me/essentials/IEssentials.java index 88dd81c46..3f541ee8c 100644 --- a/Essentials/src/com/earth2me/essentials/IEssentials.java +++ b/Essentials/src/com/earth2me/essentials/IEssentials.java @@ -1,82 +1,7 @@ package com.earth2me.essentials; -import com.earth2me.essentials.api.IJails; -import com.earth2me.essentials.api.IWarps; -import com.earth2me.essentials.metrics.Metrics; -import com.earth2me.essentials.perm.PermissionsHandler; -import com.earth2me.essentials.register.payment.Methods; -import java.util.List; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.plugin.Plugin; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - -public interface IEssentials extends Plugin +public interface IEssentials extends net.ess3.api.IEssentials { - void addReloadListener(IConf listener); - void reload(); - - boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath, String permissionPrefix, IEssentialsModule module); - - User getUser(Object base); - - I18n getI18n(); - - User getOfflineUser(String name); - - World getWorld(String name); - - int broadcastMessage(String message); - - int broadcastMessage(IUser sender, String message); - - int broadcastMessage(String permission, String message); - - ISettings getSettings(); - - BukkitScheduler getScheduler(); - - IJails getJails(); - - IWarps getWarps(); - - Worth getWorth(); - - Backup getBackup(); - - Methods getPaymentMethod(); - - BukkitTask runTaskAsynchronously(Runnable run); - - BukkitTask runTaskLaterAsynchronously(Runnable run, long delay); - - int scheduleSyncDelayedTask(Runnable run); - - int scheduleSyncDelayedTask(Runnable run, long delay); - - int scheduleSyncRepeatingTask(final Runnable run, long delay, long period); - - TNTExplodeListener getTNTListener(); - - PermissionsHandler getPermissionsHandler(); - - AlternativeCommandsHandler getAlternativeCommandsHandler(); - - void showError(final CommandSender sender, final Throwable exception, final String commandLabel); - - ItemDb getItemDb(); - - UserMap getUserMap(); - - Metrics getMetrics(); - - void setMetrics(Metrics metrics); - - EssentialsTimer getTimer(); - - List getVanishedPlayers(); } diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 229d85e65..a50aa0af0 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -1,199 +1,7 @@ package com.earth2me.essentials; -import com.earth2me.essentials.commands.IEssentialsCommand; -import com.earth2me.essentials.signs.EssentialsSign; -import com.earth2me.essentials.textreader.IText; -import java.math.BigDecimal; -import java.text.MessageFormat; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.bukkit.ChatColor; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.event.EventPriority; - -public interface ISettings extends IConf +public interface ISettings extends net.ess3.api.ISettings { - boolean areSignsDisabled(); - IText getAnnounceNewPlayerFormat(); - - boolean getAnnounceNewPlayers(); - - String getNewPlayerKit(); - - String getBackupCommand(); - - long getBackupInterval(); - - String getChatFormat(String group); - - int getChatRadius(); - - BigDecimal getCommandCost(IEssentialsCommand cmd); - - BigDecimal getCommandCost(String label); - - String getCurrencySymbol(); - - int getOversizedStackSize(); - - int getDefaultStackSize(); - - double getHealCooldown(); - - Set getSocialSpyCommands(); - - Map getKit(String name); - - ConfigurationSection getKits(); - - String getLocale(); - - String getNewbieSpawn(); - - String getNicknamePrefix(); - - ChatColor getOperatorColor() throws Exception; - - boolean getPerWarpPermission(); - - boolean getProtectBoolean(final String configName, boolean def); - - int getProtectCreeperMaxHeight(); - - List getProtectList(final String configName); - - boolean getProtectPreventSpawn(final String creatureName); - - String getProtectString(final String configName); - - boolean getRespawnAtHome(); - - Set getMultipleHomes(); - - int getHomeLimit(String set); - - int getHomeLimit(User user); - - int getSpawnMobLimit(); - - BigDecimal getStartingBalance(); - - double getTeleportCooldown(); - - double getTeleportDelay(); - - boolean hidePermissionlessHelp(); - - boolean isCommandDisabled(final IEssentialsCommand cmd); - - boolean isCommandDisabled(String label); - - boolean isCommandOverridden(String name); - - boolean isDebug(); - - boolean isEcoDisabled(); - - boolean isTradeInStacks(int id); - - List itemSpawnBlacklist(); - - List enabledSigns(); - - boolean permissionBasedItemSpawn(); - - boolean showNonEssCommandsInHelp(); - - boolean warnOnBuildDisallow(); - - boolean warnOnSmite(); - - BigDecimal getMaxMoney(); - - BigDecimal getMinMoney(); - - boolean isEcoLogEnabled(); - - boolean isEcoLogUpdateEnabled(); - - boolean removeGodOnDisconnect(); - - boolean changeDisplayName(); - - boolean changePlayerListName(); - - boolean isPlayerCommand(String string); - - boolean useBukkitPermissions(); - - boolean addPrefixSuffix(); - - boolean disablePrefix(); - - boolean disableSuffix(); - - long getAutoAfk(); - - long getAutoAfkKick(); - - boolean getFreezeAfkPlayers(); - - boolean cancelAfkOnMove(); - - boolean cancelAfkOnInteract(); - - boolean areDeathMessagesEnabled(); - - public void setDebug(boolean debug); - - Set getNoGodWorlds(); - - boolean getUpdateBedAtDaytime(); - - boolean allowUnsafeEnchantments(); - - boolean getRepairEnchanted(); - - boolean isWorldTeleportPermissions(); - - boolean isWorldHomePermissions(); - - boolean registerBackInListener(); - - boolean getDisableItemPickupWhileAfk(); - - EventPriority getRespawnPriority(); - - long getTpaAcceptCancellation(); - - boolean isMetricsEnabled(); - - void setMetricsEnabled(boolean metricsEnabled); - - long getTeleportInvulnerability(); - - boolean isTeleportInvulnerability(); - - long getLoginAttackDelay(); - - int getSignUsePerSecond(); - - double getMaxFlySpeed(); - - double getMaxWalkSpeed(); - - public int getMailsPerMinute(); - - public long getEconomyLagWarning(); - - public void setEssentialsChatActive(boolean b); - - long getMaxTempban(); - - public Map getListGroupConfig(); - - public int getMaxNickLength(); } diff --git a/Essentials/src/com/earth2me/essentials/IUser.java b/Essentials/src/com/earth2me/essentials/IUser.java index 83808554d..c9822e90e 100644 --- a/Essentials/src/com/earth2me/essentials/IUser.java +++ b/Essentials/src/com/earth2me/essentials/IUser.java @@ -1,93 +1,7 @@ package com.earth2me.essentials; -import com.earth2me.essentials.api.ITeleport; -import com.earth2me.essentials.commands.IEssentialsCommand; -import java.math.BigDecimal; -import java.util.Map; -import java.util.Set; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public interface IUser +public interface IUser extends net.ess3.api.IUser { - long getLastTeleportTimestamp(); - boolean isAuthorized(String node); - - boolean isAuthorized(IEssentialsCommand cmd); - - boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix); - - void setLastTeleportTimestamp(long time); - - Location getLastLocation(); - - Player getBase(); - - BigDecimal getMoney(); - - void takeMoney(BigDecimal value); - - void giveMoney(BigDecimal value); - - boolean canAfford(BigDecimal value); - - String getGroup(); - - void setLastLocation(); - - Location getHome(String name) throws Exception; - - Location getHome(Location loc) throws Exception; - - /** - * 'Hidden' Represents when a player is hidden from others. This status includes when the player is hidden via other - * supported plugins. Use isVanished() if you want to check if a user is vanished by Essentials. - * - * @return If the user is hidden or not - * @see isVanished - */ - boolean isHidden(); - - void setHidden(boolean vanish); - - /** - * 'Vanished' Represents when a player is hidden from others by Essentials. This status does NOT include when the - * player is hidden via other plugins. Use isHidden() if you want to check if a user is vanished by any supported - * plugin. - * - * @return If the user is vanished or not - * @see isHidden - */ - boolean isVanished(); - - void setVanished(boolean vanish); - - ITeleport getTeleport(); - - void setJail(String jail); - - boolean isIgnoreExempt(); - - boolean isAfk(); - - void setAfk(final boolean set); - - void setLogoutLocation(); - - Location getLogoutLocation(); - - void setConfigProperty(String node, Object object); - - Set getConfigKeys(); - - Map getConfigMap(); - - Map getConfigMap(String node); - - public void sendMessage(String message); - - public String getName(); } diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index f4e9e43b6..63cf6f509 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -1,8 +1,9 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.utils.StringUtil; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.api.IItemDb; +import net.ess3.api.IItemDb; import com.earth2me.essentials.utils.NumberUtil; import java.util.*; import java.util.regex.Pattern; diff --git a/Essentials/src/com/earth2me/essentials/Jails.java b/Essentials/src/com/earth2me/essentials/Jails.java index 531b420e3..75e3573b5 100644 --- a/Essentials/src/com/earth2me/essentials/Jails.java +++ b/Essentials/src/com/earth2me/essentials/Jails.java @@ -1,7 +1,9 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; +import net.ess3.api.IUser; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.api.IJails; +import net.ess3.api.IJails; import com.earth2me.essentials.storage.AsyncStorageObjectHolder; import java.io.File; import java.util.*; diff --git a/Essentials/src/com/earth2me/essentials/Kit.java b/Essentials/src/com/earth2me/essentials/Kit.java index 11d1c9cc1..02268a796 100644 --- a/Essentials/src/com/earth2me/essentials/Kit.java +++ b/Essentials/src/com/earth2me/essentials/Kit.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n.capitalCase; import com.earth2me.essentials.Trade.OverflowType; diff --git a/Essentials/src/com/earth2me/essentials/ManagedFile.java b/Essentials/src/com/earth2me/essentials/ManagedFile.java index a1918fa20..a3e0ad2e0 100644 --- a/Essentials/src/com/earth2me/essentials/ManagedFile.java +++ b/Essentials/src/com/earth2me/essentials/ManagedFile.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import java.io.*; import java.math.BigInteger; diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java index ffe39d080..57426ed4b 100644 --- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java +++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.textreader.BookInput; import com.earth2me.essentials.textreader.BookPager; diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index ec868d9bd..604380c26 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import java.net.InetSocketAddress; import java.util.*; diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index dc0146f80..669405479 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -1,5 +1,7 @@ package com.earth2me.essentials; +import net.ess3.api.ISettings; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.signs.EssentialsSign; diff --git a/Essentials/src/com/earth2me/essentials/SpawnMob.java b/Essentials/src/com/earth2me/essentials/SpawnMob.java index 6038c7903..1fb5b12fe 100644 --- a/Essentials/src/com/earth2me/essentials/SpawnMob.java +++ b/Essentials/src/com/earth2me/essentials/SpawnMob.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.utils.StringUtil; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Mob.MobException; diff --git a/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java b/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java index 79cdfa7b4..2318347c8 100644 --- a/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java +++ b/Essentials/src/com/earth2me/essentials/TNTExplodeListener.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import org.bukkit.entity.LivingEntity; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index 869c2d13d..4db461849 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -1,7 +1,9 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; +import net.ess3.api.IUser; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.api.ITeleport; +import net.ess3.api.ITeleport; import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.LocationUtil; import java.util.Calendar; diff --git a/Essentials/src/com/earth2me/essentials/TimedTeleport.java b/Essentials/src/com/earth2me/essentials/TimedTeleport.java index 7d346cf71..f0da994d4 100644 --- a/Essentials/src/com/earth2me/essentials/TimedTeleport.java +++ b/Essentials/src/com/earth2me/essentials/TimedTeleport.java @@ -1,5 +1,7 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; +import net.ess3.api.IUser; import static com.earth2me.essentials.I18n._; import org.bukkit.Location; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java index d987c95e8..09104488a 100644 --- a/Essentials/src/com/earth2me/essentials/Trade.java +++ b/Essentials/src/com/earth2me/essentials/Trade.java @@ -1,5 +1,7 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; +import net.ess3.api.IUser; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import com.earth2me.essentials.craftbukkit.SetExpFix; diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 84809f488..b253ec097 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -1,5 +1,7 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; +import net.ess3.api.IUser; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.register.payment.Method; diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 2aa2db6aa..090f40ef7 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -1,5 +1,7 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; +import net.ess3.api.IUser; import com.earth2me.essentials.utils.StringUtil; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.utils.NumberUtil; diff --git a/Essentials/src/com/earth2me/essentials/UserMap.java b/Essentials/src/com/earth2me/essentials/UserMap.java index 6261b0300..c2912f377 100644 --- a/Essentials/src/com/earth2me/essentials/UserMap.java +++ b/Essentials/src/com/earth2me/essentials/UserMap.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.utils.StringUtil; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; diff --git a/Essentials/src/com/earth2me/essentials/Warps.java b/Essentials/src/com/earth2me/essentials/Warps.java index abe8e8dc1..6ee2f625c 100644 --- a/Essentials/src/com/earth2me/essentials/Warps.java +++ b/Essentials/src/com/earth2me/essentials/Warps.java @@ -2,9 +2,9 @@ package com.earth2me.essentials; import com.earth2me.essentials.utils.StringUtil; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.api.IWarps; -import com.earth2me.essentials.api.InvalidNameException; -import com.earth2me.essentials.api.InvalidWorldException; +import net.ess3.api.IWarps; +import net.ess3.api.InvalidNameException; +import net.ess3.api.InvalidWorldException; import com.earth2me.essentials.commands.WarpNotFoundException; import java.io.File; import java.io.IOException; diff --git a/Essentials/src/com/earth2me/essentials/api/Economy.java b/Essentials/src/com/earth2me/essentials/api/Economy.java index 9f5ae5d6d..0de818538 100644 --- a/Essentials/src/com/earth2me/essentials/api/Economy.java +++ b/Essentials/src/com/earth2me/essentials/api/Economy.java @@ -1,442 +1,7 @@ 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.utils.StringUtil; -import com.earth2me.essentials.utils.NumberUtil; -import java.io.File; -import java.math.BigDecimal; -import java.math.MathContext; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Instead of using this api directly, we recommend to use the register plugin: http://bit.ly/RegisterMethod - */ -public final class Economy +public class Economy extends net.ess3.api.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."; - public static final MathContext MATH_CONTEXT = MathContext.DECIMAL128; - /** - * @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, StringUtil.sanitizeFileName(name) + ".yml")); - npcConfig.load(); - npcConfig.setProperty("npc", true); - npcConfig.setProperty("money", ess.getSettings().getStartingBalance()); - npcConfig.forceSave(); - } - - private static void deleteNPC(String name) - { - File folder = new File(ess.getDataFolder(), "userdata"); - if (!folder.exists()) - { - folder.mkdirs(); - } - File config = new File(folder, StringUtil.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); - } - return ess.getUser(name); - } - - /** - * Returns the balance of a user - * - * @param name Name of the user - * @return balance - * @throws UserDoesNotExistException - */ - @Deprecated - public static double getMoney(String name) throws UserDoesNotExistException - { - return getMoneyExact(name).doubleValue(); - } - - public static BigDecimal getMoneyExact(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 - */ - @Deprecated - public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException - { - try - { - setMoney(name, BigDecimal.valueOf(balance)); - } - catch (ArithmeticException e) - { - logger.log(Level.WARNING, "Failed to set balance of " + name + " to " + balance + ": " + e.getMessage(), e); - } - } - - public static void setMoney(String name, BigDecimal balance) throws UserDoesNotExistException, NoLoanPermittedException - { - User user = getUserByName(name); - if (user == null) - { - throw new UserDoesNotExistException(name); - } - if (balance.compareTo(ess.getSettings().getMinMoney()) < 0) - { - throw new NoLoanPermittedException(); - } - if (balance.signum() < 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 - */ - @Deprecated - public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException - { - try - { - add(name, BigDecimal.valueOf(amount)); - } - catch (ArithmeticException e) - { - logger.log(Level.WARNING, "Failed to add " + amount + " to balance of " + name + ": " + e.getMessage(), e); - } - } - - public static void add(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException - { - BigDecimal result = getMoneyExact(name).add(amount, MATH_CONTEXT); - 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 - */ - @Deprecated - public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException - { - try - { - substract(name, BigDecimal.valueOf(amount)); - } - catch (ArithmeticException e) - { - logger.log(Level.WARNING, "Failed to substract " + amount + " of balance of " + name + ": " + e.getMessage(), e); - } - } - - public static void substract(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException - { - BigDecimal result = getMoneyExact(name).subtract(amount, MATH_CONTEXT); - 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 - */ - @Deprecated - public static void divide(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException - { - try - { - divide(name, BigDecimal.valueOf(amount)); - } - catch (ArithmeticException e) - { - logger.log(Level.WARNING, "Failed to divide balance of " + name + " by " + amount + ": " + e.getMessage(), e); - } - } - - public static void divide(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException - { - BigDecimal result = getMoneyExact(name).divide(amount, MATH_CONTEXT); - 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 - */ - @Deprecated - public static void multiply(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException - { - try - { - multiply(name, BigDecimal.valueOf(amount)); - } - catch (ArithmeticException e) - { - logger.log(Level.WARNING, "Failed to multiply balance of " + name + " by " + amount + ": " + e.getMessage(), e); - } - } - - public static void multiply(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException - { - BigDecimal result = getMoneyExact(name).multiply(amount, MATH_CONTEXT); - 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 - */ - @Deprecated - public static boolean hasEnough(String name, double amount) throws UserDoesNotExistException - { - try - { - return hasEnough(name, BigDecimal.valueOf(amount)); - } - catch (ArithmeticException e) - { - logger.log(Level.WARNING, "Failed to compare balance of " + name + " with " + amount + ": " + e.getMessage(), e); - return false; - } - } - - public static boolean hasEnough(String name, BigDecimal amount) throws UserDoesNotExistException, ArithmeticException - { - return amount.compareTo(getMoneyExact(name)) <= 0; - } - - /** - * @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 - */ - @Deprecated - public static boolean hasMore(String name, double amount) throws UserDoesNotExistException - { - try - { - return hasMore(name, BigDecimal.valueOf(amount)); - } - catch (ArithmeticException e) - { - logger.log(Level.WARNING, "Failed to compare balance of " + name + " with " + amount + ": " + e.getMessage(), e); - return false; - } - } - - public static boolean hasMore(String name, BigDecimal amount) throws UserDoesNotExistException, ArithmeticException - { - return amount.compareTo(getMoneyExact(name)) < 0; - } - - /** - * @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 - */ - @Deprecated - public static boolean hasLess(String name, double amount) throws UserDoesNotExistException - { - try - { - return hasLess(name, BigDecimal.valueOf(amount)); - } - catch (ArithmeticException e) - { - logger.log(Level.WARNING, "Failed to compare balance of " + name + " with " + amount + ": " + e.getMessage(), e); - return false; - } - } - - public static boolean hasLess(String name, BigDecimal amount) throws UserDoesNotExistException, ArithmeticException - { - return amount.compareTo(getMoneyExact(name)) > 0; - } - - /** - * 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 getMoneyExact(name).signum() < 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 - */ - @Deprecated - public static String format(double amount) - { - try - { - return format(BigDecimal.valueOf(amount)); - } - catch (NumberFormatException e) - { - logger.log(Level.WARNING, "Failed to display " + amount + ": " + e.getMessage(), e); - return "NaN"; - } - } - - public static String format(BigDecimal amount) - { - if (ess == null) - { - throw new RuntimeException(noCallBeforeLoad); - } - return NumberUtil.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/II18n.java b/Essentials/src/com/earth2me/essentials/api/II18n.java index 6845ba8d1..2c0df4f64 100644 --- a/Essentials/src/com/earth2me/essentials/api/II18n.java +++ b/Essentials/src/com/earth2me/essentials/api/II18n.java @@ -1,13 +1,7 @@ package com.earth2me.essentials.api; -import java.util.Locale; - -public interface II18n +public interface II18n extends net.ess3.api.II18n { - /** - * Gets the current locale setting - * @return the current locale, if not set it will return the default locale - */ - Locale getCurrentLocale(); + } diff --git a/Essentials/src/com/earth2me/essentials/api/IItemDb.java b/Essentials/src/com/earth2me/essentials/api/IItemDb.java index d8fcfde0b..24cd9df19 100644 --- a/Essentials/src/com/earth2me/essentials/api/IItemDb.java +++ b/Essentials/src/com/earth2me/essentials/api/IItemDb.java @@ -1,11 +1,8 @@ + package com.earth2me.essentials.api; -import org.bukkit.inventory.ItemStack; - -public interface IItemDb +public interface IItemDb extends net.ess3.api.IItemDb { - 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 8316813d2..c12a427da 100644 --- a/Essentials/src/com/earth2me/essentials/api/IJails.java +++ b/Essentials/src/com/earth2me/essentials/api/IJails.java @@ -1,52 +1,7 @@ package com.earth2me.essentials.api; -import java.util.Collection; -import org.bukkit.Location; - -public interface IJails extends IReload +public interface IJails extends net.ess3.api.IJails { - /** - * Gets the location of the jail with the given name - * @param jailName The name of the jail - * @return the location of the jail - * @throws Exception if the jail does not exist - */ - Location getJail(String jailName) throws Exception; - /** - * Gets a list of jails by names - * @return a list of jails, if there are none the list will be empty - * @throws Exception - */ - Collection getList() throws Exception; - - /** - * Gets the number of jails - * @return the size of the list of jails - */ - int getCount(); - - /** - * Remove the jail with the given name - * @param jail the jail to remove - * @throws Exception if the jail does not exist - */ - void removeJail(String jail) throws Exception; - - /** - * Attempts to send the given user to the given jail - * @param user the user to send to jail - * @param jail the jail to send the user to - * @throws Exception if the user is offline or jail does not exist - */ - void sendToJail(com.earth2me.essentials.IUser user, String jail) throws Exception; - - /** - * Set a new jail with the given name and location - * @param jailName the name of the jail being set - * @param loc the location of the jail being set - * @throws Exception - */ - void setJail(String jailName, Location loc) throws Exception; } diff --git a/Essentials/src/com/earth2me/essentials/api/IReload.java b/Essentials/src/com/earth2me/essentials/api/IReload.java index 75403b55c..7a598ce4d 100644 --- a/Essentials/src/com/earth2me/essentials/api/IReload.java +++ b/Essentials/src/com/earth2me/essentials/api/IReload.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.api; -public interface IReload +public interface IReload extends net.ess3.api.IReload { - void onReload(); + } diff --git a/Essentials/src/com/earth2me/essentials/api/ITeleport.java b/Essentials/src/com/earth2me/essentials/api/ITeleport.java index ae93feddf..9475f83b3 100644 --- a/Essentials/src/com/earth2me/essentials/api/ITeleport.java +++ b/Essentials/src/com/earth2me/essentials/api/ITeleport.java @@ -1,130 +1,7 @@ package com.earth2me.essentials.api; -import com.earth2me.essentials.IUser; -import com.earth2me.essentials.Trade; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +public interface ITeleport extends net.ess3.api.ITeleport +{ -public interface ITeleport -{ - /** - * Used to skip teleportPlayer delay when teleporting someone to a location or player. - * - * @param loc - Where should the player end up - * @param cooldown - If cooldown should be enforced - * @param cause - The reported teleportPlayer cause - * @throws Exception - */ - void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception; - - /** - * Used to skip teleportPlayer delay when teleporting someone to a location or player. - * - * @param entity - Where should the player end up - * @param cooldown - If cooldown should be enforced - * @param cause - The reported teleportPlayer cause - * @throws Exception - */ - void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception; - - @Deprecated - void teleport(Location loc, Trade chargeFor) throws Exception; - - /** - * Teleport a player to a specific location - * - * @param loc - Where should the player end up - * @param chargeFor - What the user will be charged if teleportPlayer is successful - * @param cause - The reported teleportPlayer cause - * @throws Exception - */ - void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception; - - /** - * Teleport a player to a specific player - * - * @param entity - Where should the player end up - * @param chargeFor - What the user will be charged if teleportPlayer is successful - * @param cause - The reported teleportPlayer cause - * @throws Exception - */ - void teleport(Player entity, Trade chargeFor, TeleportCause cause) throws Exception; - - /** - * Teleport a player to a specific location - * - * @param otherUser - Which user will be teleported - * @param loc - Where should the player end up - * @param chargeFor - What the user will be charged if teleportPlayer is successful - * @param cause - The reported teleportPlayer cause - * @throws Exception - */ - void teleportPlayer(IUser otherUser, Location loc, Trade chargeFor, TeleportCause cause) throws Exception; - - /** - * Teleport a player to a specific player - * - * @param otherUser - Which user will be teleported - * @param entity - Where should the player end up - * @param chargeFor - What the user will be charged if teleportPlayer is successful - * @param cause - The reported teleportPlayer cause - * @throws Exception - */ - void teleportPlayer(IUser otherUser, Player entity, Trade chargeFor, TeleportCause cause) throws Exception; - - /** - * Teleport wrapper used to handle teleporting players to them, like /tphere - * - * @param otherUser - Which user will be teleported - * @param chargeFor - What the user will be charged if teleportPlayer is successful - * @param cause - The reported teleportPlayer cause - * @throws Exception - */ - public void teleportToMe(IUser otherUser, Trade chargeFor, TeleportCause cause) throws Exception; - - /** - * Teleport wrapper used to handle tp fallback on /jail and /home - * - * @param chargeFor - What the user will be charged if teleportPlayer is successful - * @param cause - The reported teleportPlayer cause - * @throws Exception - */ - public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception; - - /** - * Teleport wrapper used to handle /warp teleports - * - * @param otherUser - Which user will be teleported - * @param warp - The name of the warp the user will be teleported too. - * @param chargeFor - What the user will be charged if teleportPlayer is successful - * @param cause - The reported teleportPlayer cause - * @throws Exception - */ - public void warp(IUser otherUser, String warp, Trade chargeFor, TeleportCause cause) throws Exception; - - /** - * Teleport wrapper used to handle /back teleports - * - * @param chargeFor - What the user will be charged if teleportPlayer is successful - * @throws Exception - */ - public void back(Trade chargeFor) throws Exception; - - /** - * Teleport wrapper used to handle throwing user home after a jail sentence - * - * @throws Exception - */ - public void back() throws Exception; - - /** - * Teleport wrapper used to handle /home teleports - * - * @param loc - Location where player will be teleported too - * @param chargeFor - What the user will be charged if teleportPlayer is successful - * @throws Exception - */ - public void home(Location loc, Trade chargeFor) throws Exception; } diff --git a/Essentials/src/com/earth2me/essentials/api/IWarps.java b/Essentials/src/com/earth2me/essentials/api/IWarps.java index e1f7a85d0..ee60cc3ca 100644 --- a/Essentials/src/com/earth2me/essentials/api/IWarps.java +++ b/Essentials/src/com/earth2me/essentials/api/IWarps.java @@ -1,69 +1,8 @@ package com.earth2me.essentials.api; -import com.earth2me.essentials.IConf; -import java.io.File; -import java.util.Collection; - -import com.earth2me.essentials.commands.WarpNotFoundException; -import org.bukkit.Location; -public interface IWarps extends IConf +public interface IWarps extends net.ess3.api.IWarps { - /** - * Get a warp by name - * - * @param warp - Warp name - * @return - Location the warp is set to - * @throws WarpNotFoundException When the warp is not found - * @throws InvalidWorldException When the world the warp is in is not found - */ - Location getWarp(String warp) throws WarpNotFoundException, InvalidWorldException; - /** - * Gets a list of warps - * - * @return - A {@link Collection} of warps - */ - Collection getList(); - - /** - * Gets the number of warps - * - * @return the size of the list of warps - */ - int getCount(); - - /** - * Delete a warp from the warp DB - * - * @param name - Name of warp - * @throws Exception - */ - void removeWarp(String name) throws Exception; - - /** - * Set a warp - * - * @param name - Name of warp - * @param loc - Location of warp - * @throws Exception - */ - void setWarp(String name, Location loc) throws Exception; - - /** - * Check to see if the file is empty - * - * @return - */ - boolean isEmpty(); - - /** - * Get a warp file note: this is not yet implemented, as 3.x uses different storage methods - * - * @param name - name of file - * @return - an instance of the file - * @throws InvalidNameException - When the file is not found - */ - File getWarpFile(String name) throws InvalidNameException; } diff --git a/Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java b/Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java index f21bf98cc..234369f3d 100644 --- a/Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java +++ b/Essentials/src/com/earth2me/essentials/api/NoLoanPermittedException.java @@ -1,12 +1,7 @@ package com.earth2me.essentials.api; -import static com.earth2me.essentials.I18n._; - -public class NoLoanPermittedException extends Exception +public class NoLoanPermittedException extends net.ess3.api.NoLoanPermittedException { - public NoLoanPermittedException() - { - super(_("negativeBalanceError")); - } + } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java index 824ff6678..52bf26513 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import net.ess3.api.IUser; import com.earth2me.essentials.utils.StringUtil; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.*; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java index 6fc79092f..9e14fa7de 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java @@ -3,7 +3,7 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.StringUtil; -import com.earth2me.essentials.api.IWarps; +import net.ess3.api.IWarps; import com.earth2me.essentials.utils.NumberUtil; import org.bukkit.Location; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java index 6749aafd0..5b88fdb54 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwarp.java @@ -1,11 +1,11 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IUser; +import net.ess3.api.IUser; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.StringUtil; -import com.earth2me.essentials.api.IWarps; +import net.ess3.api.IWarps; import com.earth2me.essentials.utils.NumberUtil; import java.math.BigDecimal; import java.util.ArrayList; diff --git a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java index 51e761cc8..c0c5e4b88 100644 --- a/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import net.ess3.api.IEssentials; import com.earth2me.essentials.*; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.utils.FormatUtil; diff --git a/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java b/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java index 439c14d70..69deea3a0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java +++ b/Essentials/src/com/earth2me/essentials/commands/IEssentialsCommand.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.IEssentialsModule; import com.earth2me.essentials.User; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/metrics/MetricsListener.java b/Essentials/src/com/earth2me/essentials/metrics/MetricsListener.java index 695426529..93aadbdaf 100644 --- a/Essentials/src/com/earth2me/essentials/metrics/MetricsListener.java +++ b/Essentials/src/com/earth2me/essentials/metrics/MetricsListener.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.metrics; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.User; import java.util.logging.Level; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java b/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java index f3da96675..65be0dca9 100644 --- a/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java +++ b/Essentials/src/com/earth2me/essentials/metrics/MetricsStarter.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.metrics; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.metrics.Metrics.Graph; import com.earth2me.essentials.metrics.Metrics.Plotter; import com.earth2me.essentials.register.payment.Method; diff --git a/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java index 9396bd4ad..d77af5ce1 100644 --- a/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.perm; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; diff --git a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java index 08b0b9911..1cf2fa021 100644 --- a/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/Essentials/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.signs; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.*; import com.earth2me.essentials.utils.NumberUtil; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBalance.java b/Essentials/src/com/earth2me/essentials/signs/SignBalance.java index e47ff394d..98b258a14 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignBalance.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignBalance.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.signs; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.NumberUtil; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java index 345d4747f..e116a8fb5 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.signs; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBuy.java b/Essentials/src/com/earth2me/essentials/signs/SignBuy.java index 7f4b824ca..995ccbc48 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignBuy.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignBuy.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignDisposal.java b/Essentials/src/com/earth2me/essentials/signs/SignDisposal.java index 9cff65cf3..cde59ca3b 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignDisposal.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignDisposal.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.signs; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.User; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java b/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java index c0079fc63..c3ad54de7 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignEnchant.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.signs; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.*; import java.util.Locale; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java index fbbd1cd8c..ab8112f4a 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignEntityListener.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.signs; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.event.EventHandler; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignFree.java b/Essentials/src/com/earth2me/essentials/signs/SignFree.java index cb7b842ff..b1f16851b 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignFree.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignFree.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.signs; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.Material; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java b/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java index e709b3eb7..a775092f3 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignGameMode.java @@ -2,7 +2,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import java.util.Locale; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignHeal.java b/Essentials/src/com/earth2me/essentials/signs/SignHeal.java index 3005610b4..9305f2189 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignHeal.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignHeal.java @@ -2,7 +2,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java index b0fe380dd..7b844cb10 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignInfo.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignInfo.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.textreader.IText; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignKit.java b/Essentials/src/com/earth2me/essentials/signs/SignKit.java index e319a4838..b11125e5b 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignKit.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignKit.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.signs; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.*; import com.earth2me.essentials.commands.NoChargeException; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignMail.java b/Essentials/src/com/earth2me/essentials/signs/SignMail.java index b220fb2f5..af21ba382 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignMail.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignMail.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.signs; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.User; import java.util.List; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java index b447ed9dd..4a26f18f0 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignPlayerListener.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.signs; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import java.util.logging.Level; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java index 9ea3e6e12..13e85340c 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.signs; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.*; import com.earth2me.essentials.Trade.OverflowType; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignRepair.java b/Essentials/src/com/earth2me/essentials/signs/SignRepair.java index 63c2563dd..3ab7d6b0a 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignRepair.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignRepair.java @@ -2,7 +2,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import com.earth2me.essentials.commands.Commandrepair; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignSell.java b/Essentials/src/com/earth2me/essentials/signs/SignSell.java index ea2022f7f..fb490a90c 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignSell.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignSell.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.Trade.OverflowType; import com.earth2me.essentials.User; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java b/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java index 814ed9b29..9f2f47ca7 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignSpawnmob.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.signs; +import net.ess3.api.IEssentials; import com.earth2me.essentials.*; import java.util.List; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTime.java b/Essentials/src/com/earth2me/essentials/signs/SignTime.java index c618133c3..b82fc34ae 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTime.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTime.java @@ -2,7 +2,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index 4029be5b7..ed5c14d2a 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.signs; +import net.ess3.api.IEssentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade.TradeType; import com.earth2me.essentials.*; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java index 5f4be8f09..39f21a63c 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java @@ -2,7 +2,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignWeather.java b/Essentials/src/com/earth2me/essentials/signs/SignWeather.java index 527e9fcf8..95ad04542 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignWeather.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignWeather.java @@ -2,7 +2,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; diff --git a/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java index 2baa680c0..d52af366e 100644 --- a/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java +++ b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileReader.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.storage; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; diff --git a/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileWriter.java b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileWriter.java index 6a3ea836a..c8001a923 100644 --- a/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileWriter.java +++ b/Essentials/src/com/earth2me/essentials/storage/AbstractDelayedYamlFileWriter.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.storage; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; diff --git a/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java b/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java index 39ab28bd9..66cb60010 100644 --- a/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java +++ b/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java @@ -1,8 +1,8 @@ package com.earth2me.essentials.storage; import com.earth2me.essentials.IConf; -import com.earth2me.essentials.IEssentials; -import com.earth2me.essentials.api.IReload; +import net.ess3.api.IEssentials; +import net.ess3.api.IReload; import java.io.File; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.logging.Level; diff --git a/Essentials/src/com/earth2me/essentials/textreader/BookInput.java b/Essentials/src/com/earth2me/essentials/textreader/BookInput.java index 4a138ae16..f5a9333de 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/BookInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/BookInput.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.textreader; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import java.io.*; import java.lang.ref.SoftReference; import java.util.*; diff --git a/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java b/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java index b091e2135..268bb52e5 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.textreader; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.User; import java.io.IOException; import java.util.*; diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java index 60082e53f..cb2df7745 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java +++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.textreader; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.DescParseTickFormat; import com.earth2me.essentials.utils.NumberUtil; diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java index 71146e5eb..31e50421e 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.textreader; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.StringUtil; import java.io.*; diff --git a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java index effcf88ce..b598b8c86 100644 --- a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java @@ -1,6 +1,6 @@ package com.earth2me.essentials.utils; -import com.earth2me.essentials.IUser; +import net.ess3.api.IUser; import java.util.regex.Pattern; diff --git a/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java b/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java index 3c6332ea6..d02b0928b 100644 --- a/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/NumberUtil.java @@ -1,7 +1,7 @@ package com.earth2me.essentials.utils; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.IEssentials; +import net.ess3.api.IEssentials; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.DecimalFormat; diff --git a/Essentials/src/net/ess3/api/Economy.java b/Essentials/src/net/ess3/api/Economy.java new file mode 100644 index 000000000..73fe51e62 --- /dev/null +++ b/Essentials/src/net/ess3/api/Economy.java @@ -0,0 +1,441 @@ +package net.ess3.api; + +import com.earth2me.essentials.EssentialsConf; +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import com.earth2me.essentials.utils.StringUtil; +import com.earth2me.essentials.utils.NumberUtil; +import java.io.File; +import java.math.BigDecimal; +import java.math.MathContext; +import java.util.logging.Level; +import java.util.logging.Logger; + + +/** + * Instead of using this api directly, we recommend to use the register plugin: http://bit.ly/RegisterMethod + */ +public class Economy +{ + public 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."; + public static final MathContext MATH_CONTEXT = MathContext.DECIMAL128; + + /** + * @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, StringUtil.sanitizeFileName(name) + ".yml")); + npcConfig.load(); + npcConfig.setProperty("npc", true); + npcConfig.setProperty("money", ess.getSettings().getStartingBalance()); + npcConfig.forceSave(); + } + + private static void deleteNPC(String name) + { + File folder = new File(ess.getDataFolder(), "userdata"); + if (!folder.exists()) + { + folder.mkdirs(); + } + File config = new File(folder, StringUtil.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); + } + return ess.getUser(name); + } + + /** + * Returns the balance of a user + * + * @param name Name of the user + * @return balance + * @throws UserDoesNotExistException + */ + @Deprecated + public static double getMoney(String name) throws UserDoesNotExistException + { + return getMoneyExact(name).doubleValue(); + } + + public static BigDecimal getMoneyExact(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 + */ + @Deprecated + public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException + { + try + { + setMoney(name, BigDecimal.valueOf(balance)); + } + catch (ArithmeticException e) + { + logger.log(Level.WARNING, "Failed to set balance of " + name + " to " + balance + ": " + e.getMessage(), e); + } + } + + public static void setMoney(String name, BigDecimal balance) throws UserDoesNotExistException, NoLoanPermittedException + { + User user = getUserByName(name); + if (user == null) + { + throw new UserDoesNotExistException(name); + } + if (balance.compareTo(ess.getSettings().getMinMoney()) < 0) + { + throw new NoLoanPermittedException(); + } + if (balance.signum() < 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 + */ + @Deprecated + public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException + { + try + { + add(name, BigDecimal.valueOf(amount)); + } + catch (ArithmeticException e) + { + logger.log(Level.WARNING, "Failed to add " + amount + " to balance of " + name + ": " + e.getMessage(), e); + } + } + + public static void add(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException + { + BigDecimal result = getMoneyExact(name).add(amount, MATH_CONTEXT); + 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 + */ + @Deprecated + public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException + { + try + { + substract(name, BigDecimal.valueOf(amount)); + } + catch (ArithmeticException e) + { + logger.log(Level.WARNING, "Failed to substract " + amount + " of balance of " + name + ": " + e.getMessage(), e); + } + } + + public static void substract(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException + { + BigDecimal result = getMoneyExact(name).subtract(amount, MATH_CONTEXT); + 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 + */ + @Deprecated + public static void divide(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException + { + try + { + divide(name, BigDecimal.valueOf(amount)); + } + catch (ArithmeticException e) + { + logger.log(Level.WARNING, "Failed to divide balance of " + name + " by " + amount + ": " + e.getMessage(), e); + } + } + + public static void divide(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException + { + BigDecimal result = getMoneyExact(name).divide(amount, MATH_CONTEXT); + 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 + */ + @Deprecated + public static void multiply(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException + { + try + { + multiply(name, BigDecimal.valueOf(amount)); + } + catch (ArithmeticException e) + { + logger.log(Level.WARNING, "Failed to multiply balance of " + name + " by " + amount + ": " + e.getMessage(), e); + } + } + + public static void multiply(String name, BigDecimal amount) throws UserDoesNotExistException, NoLoanPermittedException, ArithmeticException + { + BigDecimal result = getMoneyExact(name).multiply(amount, MATH_CONTEXT); + 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 + */ + @Deprecated + public static boolean hasEnough(String name, double amount) throws UserDoesNotExistException + { + try + { + return hasEnough(name, BigDecimal.valueOf(amount)); + } + catch (ArithmeticException e) + { + logger.log(Level.WARNING, "Failed to compare balance of " + name + " with " + amount + ": " + e.getMessage(), e); + return false; + } + } + + public static boolean hasEnough(String name, BigDecimal amount) throws UserDoesNotExistException, ArithmeticException + { + return amount.compareTo(getMoneyExact(name)) <= 0; + } + + /** + * @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 + */ + @Deprecated + public static boolean hasMore(String name, double amount) throws UserDoesNotExistException + { + try + { + return hasMore(name, BigDecimal.valueOf(amount)); + } + catch (ArithmeticException e) + { + logger.log(Level.WARNING, "Failed to compare balance of " + name + " with " + amount + ": " + e.getMessage(), e); + return false; + } + } + + public static boolean hasMore(String name, BigDecimal amount) throws UserDoesNotExistException, ArithmeticException + { + return amount.compareTo(getMoneyExact(name)) < 0; + } + + /** + * @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 + */ + @Deprecated + public static boolean hasLess(String name, double amount) throws UserDoesNotExistException + { + try + { + return hasLess(name, BigDecimal.valueOf(amount)); + } + catch (ArithmeticException e) + { + logger.log(Level.WARNING, "Failed to compare balance of " + name + " with " + amount + ": " + e.getMessage(), e); + return false; + } + } + + public static boolean hasLess(String name, BigDecimal amount) throws UserDoesNotExistException, ArithmeticException + { + return amount.compareTo(getMoneyExact(name)) > 0; + } + + /** + * 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 getMoneyExact(name).signum() < 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 + */ + @Deprecated + public static String format(double amount) + { + try + { + return format(BigDecimal.valueOf(amount)); + } + catch (NumberFormatException e) + { + logger.log(Level.WARNING, "Failed to display " + amount + ": " + e.getMessage(), e); + return "NaN"; + } + } + + public static String format(BigDecimal amount) + { + if (ess == null) + { + throw new RuntimeException(noCallBeforeLoad); + } + return NumberUtil.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/net/ess3/api/IEssentials.java b/Essentials/src/net/ess3/api/IEssentials.java new file mode 100644 index 000000000..a79b0f6a1 --- /dev/null +++ b/Essentials/src/net/ess3/api/IEssentials.java @@ -0,0 +1,94 @@ +package net.ess3.api; + +import com.earth2me.essentials.AlternativeCommandsHandler; +import com.earth2me.essentials.Backup; +import com.earth2me.essentials.EssentialsTimer; +import com.earth2me.essentials.I18n; +import com.earth2me.essentials.IConf; +import com.earth2me.essentials.IEssentialsModule; +import com.earth2me.essentials.ItemDb; +import com.earth2me.essentials.TNTExplodeListener; +import com.earth2me.essentials.User; +import com.earth2me.essentials.UserMap; +import com.earth2me.essentials.Worth; +import net.ess3.api.IUser; +import net.ess3.api.IJails; +import net.ess3.api.IWarps; +import com.earth2me.essentials.metrics.Metrics; +import com.earth2me.essentials.perm.PermissionsHandler; +import com.earth2me.essentials.register.payment.Methods; +import java.util.List; +import org.bukkit.World; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + + +public interface IEssentials extends Plugin +{ + void addReloadListener(IConf listener); + + void reload(); + + boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath, String permissionPrefix, IEssentialsModule module); + + User getUser(Object base); + + I18n getI18n(); + + User getOfflineUser(String name); + + World getWorld(String name); + + int broadcastMessage(String message); + + int broadcastMessage(IUser sender, String message); + + int broadcastMessage(String permission, String message); + + ISettings getSettings(); + + BukkitScheduler getScheduler(); + + IJails getJails(); + + IWarps getWarps(); + + Worth getWorth(); + + Backup getBackup(); + + Methods getPaymentMethod(); + + BukkitTask runTaskAsynchronously(Runnable run); + + BukkitTask runTaskLaterAsynchronously(Runnable run, long delay); + + int scheduleSyncDelayedTask(Runnable run); + + int scheduleSyncDelayedTask(Runnable run, long delay); + + int scheduleSyncRepeatingTask(final Runnable run, long delay, long period); + + TNTExplodeListener getTNTListener(); + + PermissionsHandler getPermissionsHandler(); + + AlternativeCommandsHandler getAlternativeCommandsHandler(); + + void showError(final CommandSender sender, final Throwable exception, final String commandLabel); + + ItemDb getItemDb(); + + UserMap getUserMap(); + + Metrics getMetrics(); + + void setMetrics(Metrics metrics); + + EssentialsTimer getTimer(); + + List getVanishedPlayers(); +} diff --git a/Essentials/src/net/ess3/api/II18n.java b/Essentials/src/net/ess3/api/II18n.java new file mode 100644 index 000000000..9cefb32ee --- /dev/null +++ b/Essentials/src/net/ess3/api/II18n.java @@ -0,0 +1,13 @@ +package net.ess3.api; + +import java.util.Locale; + + +public interface II18n +{ + /** + * Gets the current locale setting + * @return the current locale, if not set it will return the default locale + */ + Locale getCurrentLocale(); +} diff --git a/Essentials/src/net/ess3/api/IItemDb.java b/Essentials/src/net/ess3/api/IItemDb.java new file mode 100644 index 000000000..70ddf0771 --- /dev/null +++ b/Essentials/src/net/ess3/api/IItemDb.java @@ -0,0 +1,11 @@ +package net.ess3.api; + +import org.bukkit.inventory.ItemStack; + + +public interface IItemDb +{ + ItemStack get(final String name, final int quantity) throws Exception; + + ItemStack get(final String name) throws Exception; +} diff --git a/Essentials/src/net/ess3/api/IJails.java b/Essentials/src/net/ess3/api/IJails.java new file mode 100644 index 000000000..8a11cdcf7 --- /dev/null +++ b/Essentials/src/net/ess3/api/IJails.java @@ -0,0 +1,52 @@ +package net.ess3.api; + +import java.util.Collection; +import org.bukkit.Location; + + +public interface IJails extends IReload +{ + /** + * Gets the location of the jail with the given name + * @param jailName The name of the jail + * @return the location of the jail + * @throws Exception if the jail does not exist + */ + Location getJail(String jailName) throws Exception; + + /** + * Gets a list of jails by names + * @return a list of jails, if there are none the list will be empty + * @throws Exception + */ + Collection getList() throws Exception; + + /** + * Gets the number of jails + * @return the size of the list of jails + */ + int getCount(); + + /** + * Remove the jail with the given name + * @param jail the jail to remove + * @throws Exception if the jail does not exist + */ + void removeJail(String jail) throws Exception; + + /** + * Attempts to send the given user to the given jail + * @param user the user to send to jail + * @param jail the jail to send the user to + * @throws Exception if the user is offline or jail does not exist + */ + void sendToJail(net.ess3.api.IUser user, String jail) throws Exception; + + /** + * Set a new jail with the given name and location + * @param jailName the name of the jail being set + * @param loc the location of the jail being set + * @throws Exception + */ + void setJail(String jailName, Location loc) throws Exception; +} diff --git a/Essentials/src/net/ess3/api/IReload.java b/Essentials/src/net/ess3/api/IReload.java new file mode 100644 index 000000000..964d88841 --- /dev/null +++ b/Essentials/src/net/ess3/api/IReload.java @@ -0,0 +1,7 @@ +package net.ess3.api; + + +public interface IReload +{ + void onReload(); +} diff --git a/Essentials/src/net/ess3/api/ISettings.java b/Essentials/src/net/ess3/api/ISettings.java new file mode 100644 index 000000000..d7ac3b570 --- /dev/null +++ b/Essentials/src/net/ess3/api/ISettings.java @@ -0,0 +1,201 @@ +package net.ess3.api; + +import com.earth2me.essentials.IConf; +import com.earth2me.essentials.User; +import com.earth2me.essentials.commands.IEssentialsCommand; +import com.earth2me.essentials.signs.EssentialsSign; +import com.earth2me.essentials.textreader.IText; +import java.math.BigDecimal; +import java.text.MessageFormat; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.bukkit.ChatColor; +import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.event.EventPriority; + + +public interface ISettings extends IConf +{ + boolean areSignsDisabled(); + + IText getAnnounceNewPlayerFormat(); + + boolean getAnnounceNewPlayers(); + + String getNewPlayerKit(); + + String getBackupCommand(); + + long getBackupInterval(); + + String getChatFormat(String group); + + int getChatRadius(); + + BigDecimal getCommandCost(IEssentialsCommand cmd); + + BigDecimal getCommandCost(String label); + + String getCurrencySymbol(); + + int getOversizedStackSize(); + + int getDefaultStackSize(); + + double getHealCooldown(); + + Set getSocialSpyCommands(); + + Map getKit(String name); + + ConfigurationSection getKits(); + + String getLocale(); + + String getNewbieSpawn(); + + String getNicknamePrefix(); + + ChatColor getOperatorColor() throws Exception; + + boolean getPerWarpPermission(); + + boolean getProtectBoolean(final String configName, boolean def); + + int getProtectCreeperMaxHeight(); + + List getProtectList(final String configName); + + boolean getProtectPreventSpawn(final String creatureName); + + String getProtectString(final String configName); + + boolean getRespawnAtHome(); + + Set getMultipleHomes(); + + int getHomeLimit(String set); + + int getHomeLimit(User user); + + int getSpawnMobLimit(); + + BigDecimal getStartingBalance(); + + double getTeleportCooldown(); + + double getTeleportDelay(); + + boolean hidePermissionlessHelp(); + + boolean isCommandDisabled(final IEssentialsCommand cmd); + + boolean isCommandDisabled(String label); + + boolean isCommandOverridden(String name); + + boolean isDebug(); + + boolean isEcoDisabled(); + + boolean isTradeInStacks(int id); + + List itemSpawnBlacklist(); + + List enabledSigns(); + + boolean permissionBasedItemSpawn(); + + boolean showNonEssCommandsInHelp(); + + boolean warnOnBuildDisallow(); + + boolean warnOnSmite(); + + BigDecimal getMaxMoney(); + + BigDecimal getMinMoney(); + + boolean isEcoLogEnabled(); + + boolean isEcoLogUpdateEnabled(); + + boolean removeGodOnDisconnect(); + + boolean changeDisplayName(); + + boolean changePlayerListName(); + + boolean isPlayerCommand(String string); + + boolean useBukkitPermissions(); + + boolean addPrefixSuffix(); + + boolean disablePrefix(); + + boolean disableSuffix(); + + long getAutoAfk(); + + long getAutoAfkKick(); + + boolean getFreezeAfkPlayers(); + + boolean cancelAfkOnMove(); + + boolean cancelAfkOnInteract(); + + boolean areDeathMessagesEnabled(); + + public void setDebug(boolean debug); + + Set getNoGodWorlds(); + + boolean getUpdateBedAtDaytime(); + + boolean allowUnsafeEnchantments(); + + boolean getRepairEnchanted(); + + boolean isWorldTeleportPermissions(); + + boolean isWorldHomePermissions(); + + boolean registerBackInListener(); + + boolean getDisableItemPickupWhileAfk(); + + EventPriority getRespawnPriority(); + + long getTpaAcceptCancellation(); + + boolean isMetricsEnabled(); + + void setMetricsEnabled(boolean metricsEnabled); + + long getTeleportInvulnerability(); + + boolean isTeleportInvulnerability(); + + long getLoginAttackDelay(); + + int getSignUsePerSecond(); + + double getMaxFlySpeed(); + + double getMaxWalkSpeed(); + + public int getMailsPerMinute(); + + public long getEconomyLagWarning(); + + public void setEssentialsChatActive(boolean b); + + long getMaxTempban(); + + public Map getListGroupConfig(); + + public int getMaxNickLength(); +} diff --git a/Essentials/src/net/ess3/api/ITeleport.java b/Essentials/src/net/ess3/api/ITeleport.java new file mode 100644 index 000000000..75c249ab2 --- /dev/null +++ b/Essentials/src/net/ess3/api/ITeleport.java @@ -0,0 +1,129 @@ +package net.ess3.api; + +import com.earth2me.essentials.Trade; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; + + +public interface ITeleport +{ + /** + * Used to skip teleportPlayer delay when teleporting someone to a location or player. + * + * @param loc - Where should the player end up + * @param cooldown - If cooldown should be enforced + * @param cause - The reported teleportPlayer cause + * @throws Exception + */ + void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception; + + /** + * Used to skip teleportPlayer delay when teleporting someone to a location or player. + * + * @param entity - Where should the player end up + * @param cooldown - If cooldown should be enforced + * @param cause - The reported teleportPlayer cause + * @throws Exception + */ + void now(Player entity, boolean cooldown, TeleportCause cause) throws Exception; + + @Deprecated + void teleport(Location loc, Trade chargeFor) throws Exception; + + /** + * Teleport a player to a specific location + * + * @param loc - Where should the player end up + * @param chargeFor - What the user will be charged if teleportPlayer is successful + * @param cause - The reported teleportPlayer cause + * @throws Exception + */ + void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception; + + /** + * Teleport a player to a specific player + * + * @param entity - Where should the player end up + * @param chargeFor - What the user will be charged if teleportPlayer is successful + * @param cause - The reported teleportPlayer cause + * @throws Exception + */ + void teleport(Player entity, Trade chargeFor, TeleportCause cause) throws Exception; + + /** + * Teleport a player to a specific location + * + * @param otherUser - Which user will be teleported + * @param loc - Where should the player end up + * @param chargeFor - What the user will be charged if teleportPlayer is successful + * @param cause - The reported teleportPlayer cause + * @throws Exception + */ + void teleportPlayer(IUser otherUser, Location loc, Trade chargeFor, TeleportCause cause) throws Exception; + + /** + * Teleport a player to a specific player + * + * @param otherUser - Which user will be teleported + * @param entity - Where should the player end up + * @param chargeFor - What the user will be charged if teleportPlayer is successful + * @param cause - The reported teleportPlayer cause + * @throws Exception + */ + void teleportPlayer(IUser otherUser, Player entity, Trade chargeFor, TeleportCause cause) throws Exception; + + /** + * Teleport wrapper used to handle teleporting players to them, like /tphere + * + * @param otherUser - Which user will be teleported + * @param chargeFor - What the user will be charged if teleportPlayer is successful + * @param cause - The reported teleportPlayer cause + * @throws Exception + */ + public void teleportToMe(IUser otherUser, Trade chargeFor, TeleportCause cause) throws Exception; + + /** + * Teleport wrapper used to handle tp fallback on /jail and /home + * + * @param chargeFor - What the user will be charged if teleportPlayer is successful + * @param cause - The reported teleportPlayer cause + * @throws Exception + */ + public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception; + + /** + * Teleport wrapper used to handle /warp teleports + * + * @param otherUser - Which user will be teleported + * @param warp - The name of the warp the user will be teleported too. + * @param chargeFor - What the user will be charged if teleportPlayer is successful + * @param cause - The reported teleportPlayer cause + * @throws Exception + */ + public void warp(IUser otherUser, String warp, Trade chargeFor, TeleportCause cause) throws Exception; + + /** + * Teleport wrapper used to handle /back teleports + * + * @param chargeFor - What the user will be charged if teleportPlayer is successful + * @throws Exception + */ + public void back(Trade chargeFor) throws Exception; + + /** + * Teleport wrapper used to handle throwing user home after a jail sentence + * + * @throws Exception + */ + public void back() throws Exception; + + /** + * Teleport wrapper used to handle /home teleports + * + * @param loc - Location where player will be teleported too + * @param chargeFor - What the user will be charged if teleportPlayer is successful + * @throws Exception + */ + public void home(Location loc, Trade chargeFor) throws Exception; +} diff --git a/Essentials/src/net/ess3/api/IUser.java b/Essentials/src/net/ess3/api/IUser.java new file mode 100644 index 000000000..bae00f212 --- /dev/null +++ b/Essentials/src/net/ess3/api/IUser.java @@ -0,0 +1,93 @@ +package net.ess3.api; + +import net.ess3.api.ITeleport; +import com.earth2me.essentials.commands.IEssentialsCommand; +import java.math.BigDecimal; +import java.util.Map; +import java.util.Set; +import org.bukkit.Location; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + + +public interface IUser +{ + long getLastTeleportTimestamp(); + + boolean isAuthorized(String node); + + boolean isAuthorized(IEssentialsCommand cmd); + + boolean isAuthorized(IEssentialsCommand cmd, String permissionPrefix); + + void setLastTeleportTimestamp(long time); + + Location getLastLocation(); + + Player getBase(); + + BigDecimal getMoney(); + + void takeMoney(BigDecimal value); + + void giveMoney(BigDecimal value); + + boolean canAfford(BigDecimal value); + + String getGroup(); + + void setLastLocation(); + + Location getHome(String name) throws Exception; + + Location getHome(Location loc) throws Exception; + + /** + * 'Hidden' Represents when a player is hidden from others. This status includes when the player is hidden via other + * supported plugins. Use isVanished() if you want to check if a user is vanished by Essentials. + * + * @return If the user is hidden or not + * @see isVanished + */ + boolean isHidden(); + + void setHidden(boolean vanish); + + /** + * 'Vanished' Represents when a player is hidden from others by Essentials. This status does NOT include when the + * player is hidden via other plugins. Use isHidden() if you want to check if a user is vanished by any supported + * plugin. + * + * @return If the user is vanished or not + * @see isHidden + */ + boolean isVanished(); + + void setVanished(boolean vanish); + + ITeleport getTeleport(); + + void setJail(String jail); + + boolean isIgnoreExempt(); + + boolean isAfk(); + + void setAfk(final boolean set); + + void setLogoutLocation(); + + Location getLogoutLocation(); + + void setConfigProperty(String node, Object object); + + Set getConfigKeys(); + + Map getConfigMap(); + + Map getConfigMap(String node); + + public void sendMessage(String message); + + public String getName(); +} diff --git a/Essentials/src/net/ess3/api/IWarps.java b/Essentials/src/net/ess3/api/IWarps.java new file mode 100644 index 000000000..65bcf9437 --- /dev/null +++ b/Essentials/src/net/ess3/api/IWarps.java @@ -0,0 +1,69 @@ +package net.ess3.api; + +import com.earth2me.essentials.IConf; +import java.io.File; +import java.util.Collection; + +import com.earth2me.essentials.commands.WarpNotFoundException; +import org.bukkit.Location; + + +public interface IWarps extends IConf +{ + /** + * Get a warp by name + * + * @param warp - Warp name + * @return - Location the warp is set to + * @throws WarpNotFoundException When the warp is not found + * @throws InvalidWorldException When the world the warp is in is not found + */ + Location getWarp(String warp) throws WarpNotFoundException, InvalidWorldException; + + /** + * Gets a list of warps + * + * @return - A {@link Collection} of warps + */ + Collection getList(); + + /** + * Gets the number of warps + * + * @return the size of the list of warps + */ + int getCount(); + + /** + * Delete a warp from the warp DB + * + * @param name - Name of warp + * @throws Exception + */ + void removeWarp(String name) throws Exception; + + /** + * Set a warp + * + * @param name - Name of warp + * @param loc - Location of warp + * @throws Exception + */ + void setWarp(String name, Location loc) throws Exception; + + /** + * Check to see if the file is empty + * + * @return + */ + boolean isEmpty(); + + /** + * Get a warp file note: this is not yet implemented, as 3.x uses different storage methods + * + * @param name - name of file + * @return - an instance of the file + * @throws InvalidNameException - When the file is not found + */ + File getWarpFile(String name) throws InvalidNameException; +} diff --git a/Essentials/src/net/ess3/api/InvalidNameException.java b/Essentials/src/net/ess3/api/InvalidNameException.java new file mode 100644 index 000000000..013ac7ef0 --- /dev/null +++ b/Essentials/src/net/ess3/api/InvalidNameException.java @@ -0,0 +1,16 @@ +package net.ess3.api; + + +public class InvalidNameException extends Exception +{ + /** + * NOTE: This is not implemented yet, just here for future 3.x api support + * Allow serialization of the InvalidNameException exception + */ + private static final long serialVersionUID = 1485321420293663139L; + + public InvalidNameException(Throwable thrwbl) + { + super(thrwbl); + } +} diff --git a/Essentials/src/net/ess3/api/InvalidWorldException.java b/Essentials/src/net/ess3/api/InvalidWorldException.java new file mode 100644 index 000000000..89f27bbdd --- /dev/null +++ b/Essentials/src/net/ess3/api/InvalidWorldException.java @@ -0,0 +1,20 @@ +package net.ess3.api; + +import static com.earth2me.essentials.I18n._; + + +public class InvalidWorldException extends Exception +{ + private final String world; + + public InvalidWorldException(final String world) + { + super(_("invalidWorld")); + this.world = world; + } + + public String getWorld() + { + return this.world; + } +} diff --git a/Essentials/src/net/ess3/api/NoLoanPermittedException.java b/Essentials/src/net/ess3/api/NoLoanPermittedException.java new file mode 100644 index 000000000..761a42da3 --- /dev/null +++ b/Essentials/src/net/ess3/api/NoLoanPermittedException.java @@ -0,0 +1,12 @@ +package net.ess3.api; + +import static com.earth2me.essentials.I18n._; + + +public class NoLoanPermittedException extends Exception +{ + public NoLoanPermittedException() + { + super(_("negativeBalanceError")); + } +} diff --git a/Essentials/src/net/ess3/api/UserDoesNotExistException.java b/Essentials/src/net/ess3/api/UserDoesNotExistException.java new file mode 100644 index 000000000..4423301b6 --- /dev/null +++ b/Essentials/src/net/ess3/api/UserDoesNotExistException.java @@ -0,0 +1,12 @@ +package net.ess3.api; + +import static com.earth2me.essentials.I18n._; + + +public class UserDoesNotExistException extends Exception +{ + public UserDoesNotExistException(String name) + { + super(_("userDoesNotExist", name)); + } +} diff --git a/Essentials/test/com/earth2me/essentials/EconomyTest.java b/Essentials/test/com/earth2me/essentials/EconomyTest.java index f2d1bfcc3..d1041a62c 100644 --- a/Essentials/test/com/earth2me/essentials/EconomyTest.java +++ b/Essentials/test/com/earth2me/essentials/EconomyTest.java @@ -1,8 +1,8 @@ package com.earth2me.essentials; -import com.earth2me.essentials.api.Economy; -import com.earth2me.essentials.api.NoLoanPermittedException; -import com.earth2me.essentials.api.UserDoesNotExistException; +import net.ess3.api.Economy; +import net.ess3.api.NoLoanPermittedException; +import net.ess3.api.UserDoesNotExistException; import java.io.IOException; import junit.framework.TestCase; import org.bukkit.World.Environment; diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index dc7ee9c5d..efb0305ae 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; +import net.ess3.api.IEssentials; import com.avaje.ebean.config.ServerConfig; import com.earth2me.essentials.craftbukkit.FakeWorld; import java.io.File;