summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIaccidentally <coryhuckaby@gmail.com>2013-04-30 12:25:25 -0400
committerIaccidentally <coryhuckaby@gmail.com>2013-04-30 12:25:25 -0400
commit1ab2a51550daba07148cbd6f1a902966d16e144a (patch)
treee0adef26032c907612be8dabf43a017fc47bade7
parent42dc6a2e0756d34a4e4812662cf084a3259cbc56 (diff)
downloadEssentials-1ab2a51550daba07148cbd6f1a902966d16e144a.tar
Essentials-1ab2a51550daba07148cbd6f1a902966d16e144a.tar.gz
Essentials-1ab2a51550daba07148cbd6f1a902966d16e144a.tar.lz
Essentials-1ab2a51550daba07148cbd6f1a902966d16e144a.tar.xz
Essentials-1ab2a51550daba07148cbd6f1a902966d16e144a.zip
API & misc cleanup
-rw-r--r--Essentials/src/com/earth2me/essentials/ItemDb.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/Teleport.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/api/II18n.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IItemDb.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/api/IJails.java32
-rw-r--r--Essentials/src/com/earth2me/essentials/api/ITeleport.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java10
7 files changed, 57 insertions, 7 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java
index a79685bb5..784230afa 100644
--- a/Essentials/src/com/earth2me/essentials/ItemDb.java
+++ b/Essentials/src/com/earth2me/essentials/ItemDb.java
@@ -74,6 +74,7 @@ public class ItemDb implements IConf, IItemDb
}
}
+ @Override
public ItemStack get(final String id, final int quantity) throws Exception
{
final ItemStack retval = get(id.toLowerCase(Locale.ENGLISH));
@@ -81,12 +82,13 @@ public class ItemDb implements IConf, IItemDb
return retval;
}
+ @Override
public ItemStack get(final String id) throws Exception
{
int itemid = 0;
String itemname = null;
short metaData = 0;
- String[] parts = splitPattern.split(id);;
+ String[] parts = splitPattern.split(id);
if (id.matches("^\\d+[:+',;.]\\d+$"))
{
itemid = Integer.parseInt(parts[0]);
@@ -137,7 +139,7 @@ public class ItemDb implements IConf, IItemDb
retval.setDurability(metaData);
return retval;
}
-
+
public String names(ItemStack item)
{
ItemData itemData = new ItemData(item.getTypeId(), item.getDurability());
diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java
index f295aef1a..a08e65683 100644
--- a/Essentials/src/com/earth2me/essentials/Teleport.java
+++ b/Essentials/src/com/earth2me/essentials/Teleport.java
@@ -231,6 +231,7 @@ public class Teleport implements Runnable, ITeleport
}
//The now function is used when you want to skip tp delay when teleporting someone to a location or player.
+ @Override
public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception
{
if (cooldown)
@@ -387,7 +388,7 @@ public class Teleport implements Runnable, ITeleport
teleport(new Target(loc), chargeFor, cause);
}
- //The back function is a wrapper used to teleport a player /back to their previous location.
+ //The back function is a wrapper used to teleport a player /back to their previous location.
public void back(Trade chargeFor) throws Exception
{
teleport(new Target(user.getLastLocation()), chargeFor, TeleportCause.COMMAND);
diff --git a/Essentials/src/com/earth2me/essentials/api/II18n.java b/Essentials/src/com/earth2me/essentials/api/II18n.java
index 567d4e59e..6845ba8d1 100644
--- a/Essentials/src/com/earth2me/essentials/api/II18n.java
+++ b/Essentials/src/com/earth2me/essentials/api/II18n.java
@@ -5,5 +5,9 @@ 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/com/earth2me/essentials/api/IItemDb.java b/Essentials/src/com/earth2me/essentials/api/IItemDb.java
index ee4819215..d8fcfde0b 100644
--- a/Essentials/src/com/earth2me/essentials/api/IItemDb.java
+++ b/Essentials/src/com/earth2me/essentials/api/IItemDb.java
@@ -6,6 +6,6 @@ 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/com/earth2me/essentials/api/IJails.java b/Essentials/src/com/earth2me/essentials/api/IJails.java
index e19b76837..8316813d2 100644
--- a/Essentials/src/com/earth2me/essentials/api/IJails.java
+++ b/Essentials/src/com/earth2me/essentials/api/IJails.java
@@ -6,15 +6,47 @@ 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<String> 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/ITeleport.java b/Essentials/src/com/earth2me/essentials/api/ITeleport.java
index 5b9a19757..8fb1778ac 100644
--- a/Essentials/src/com/earth2me/essentials/api/ITeleport.java
+++ b/Essentials/src/com/earth2me/essentials/api/ITeleport.java
@@ -6,5 +6,12 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public interface ITeleport
{
+ /**
+ * Used to skip teleport delay when teleporting someone to a location or player.
+ * @param loc
+ * @param cooldown
+ * @param cause
+ * @throws Exception
+ */
void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception;
}
diff --git a/Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java b/Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java
index dba6f4be6..03fe986d4 100644
--- a/Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java
+++ b/Essentials/src/com/earth2me/essentials/api/InvalidWorldException.java
@@ -2,15 +2,19 @@ package com.earth2me.essentials.api;
import static com.earth2me.essentials.I18n._;
-public class InvalidWorldException extends Exception {
+
+public class InvalidWorldException extends Exception
+{
private final String world;
- public InvalidWorldException(final String world) {
+ public InvalidWorldException(final String world)
+ {
super(_("invalidWorld"));
this.world = world;
}
- public String getWorld() {
+ public String getWorld()
+ {
return this.world;
}
}