summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDabo Ross <daboross@daboross.net>2013-10-24 04:40:58 -0700
committerKHobbits <rob@khobbits.co.uk>2014-03-09 17:31:36 +0000
commitaba7ea5b025bf5aaa179525274834579b5f12bd8 (patch)
treee4a35aa841de992ef03dcc67acb60e23ebd9eaae
parentddbe1030df18657c0f61b4b798fa81b4eb89c478 (diff)
downloadEssentials-aba7ea5b025bf5aaa179525274834579b5f12bd8.tar
Essentials-aba7ea5b025bf5aaa179525274834579b5f12bd8.tar.gz
Essentials-aba7ea5b025bf5aaa179525274834579b5f12bd8.tar.lz
Essentials-aba7ea5b025bf5aaa179525274834579b5f12bd8.tar.xz
Essentials-aba7ea5b025bf5aaa179525274834579b5f12bd8.zip
Add IEssentialsSpawn class for API for Essentials Spawn with two methods, getSpawn(String) and setSpawn(String, Location).
Implement IEssentialsSpawn in EssentialsSpawn.
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java23
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/IEssentialsSpawn.java27
2 files changed, 49 insertions, 1 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
index 4e61bdac9..a22615550 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java
@@ -5,6 +5,7 @@ import net.ess3.api.IEssentials;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
+import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Event;
@@ -17,7 +18,7 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
-public class EssentialsSpawn extends JavaPlugin
+public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn
{
private static final Logger LOGGER = Bukkit.getLogger();
private transient IEssentials ess;
@@ -70,4 +71,24 @@ public class EssentialsSpawn extends JavaPlugin
{
return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.", spawns);
}
+
+ @Override
+ public void setSpawn(Location loc, String group)
+ {
+ if (group == null)
+ {
+ throw new IllegalArgumentException("Null group");
+ }
+ spawns.setSpawn(loc, group);
+ }
+
+ @Override
+ public Location getSpawn(String group)
+ {
+ if (group == null)
+ {
+ throw new IllegalArgumentException("Null group");
+ }
+ return spawns.getSpawn(group);
+ }
}
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/IEssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/IEssentialsSpawn.java
new file mode 100644
index 000000000..a7c43bcb0
--- /dev/null
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/IEssentialsSpawn.java
@@ -0,0 +1,27 @@
+package com.earth2me.essentials.spawn;
+
+import org.bukkit.Location;
+import org.bukkit.plugin.Plugin;
+
+
+public interface IEssentialsSpawn extends Plugin
+{
+
+ /**
+ * Sets the spawn for a given group to a given location.
+ *
+ * @param loc The location to set the spawn to
+ * @param group The group to set the spawn of, or 'default' for the default spawn
+ * @throws IllegalArgumentException If group is null
+ */
+ public void setSpawn(Location loc, String group);
+
+ /**
+ * Gets the spawn location for a given group.
+ *
+ * @param group The group to get the spawn of, or 'default' for the default spawn
+ * @return The spawn location set for the given group
+ * @throws IllegalArgumentException If group is null
+ */
+ public Location getSpawn(String group);
+}