Skip to content

Commit 2ee590d

Browse files
daborosskhobbits
authored andcommitted
Add IEssentialsSpawn class for API for Essentials Spawn with two methods, getSpawn(String) and setSpawn(String, Location).
Implement IEssentialsSpawn in EssentialsSpawn.
1 parent b469439 commit 2ee590d

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.logging.Level;
66
import java.util.logging.Logger;
77
import org.bukkit.Bukkit;
8+
import org.bukkit.Location;
89
import org.bukkit.command.Command;
910
import org.bukkit.command.CommandSender;
1011
import org.bukkit.event.Event;
@@ -17,7 +18,7 @@
1718
import org.bukkit.plugin.java.JavaPlugin;
1819

1920

20-
public class EssentialsSpawn extends JavaPlugin
21+
public class EssentialsSpawn extends JavaPlugin implements IEssentialsSpawn
2122
{
2223
private static final Logger LOGGER = Bukkit.getLogger();
2324
private transient IEssentials ess;
@@ -70,4 +71,24 @@ public boolean onCommand(final CommandSender sender, final Command command, fina
7071
{
7172
return ess.onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command", "essentials.", spawns);
7273
}
74+
75+
@Override
76+
public void setSpawn(Location loc, String group)
77+
{
78+
if (group == null)
79+
{
80+
throw new IllegalArgumentException("Null group");
81+
}
82+
spawns.setSpawn(loc, group);
83+
}
84+
85+
@Override
86+
public Location getSpawn(String group)
87+
{
88+
if (group == null)
89+
{
90+
throw new IllegalArgumentException("Null group");
91+
}
92+
return spawns.getSpawn(group);
93+
}
7394
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.earth2me.essentials.spawn;
2+
3+
import org.bukkit.Location;
4+
import org.bukkit.plugin.Plugin;
5+
6+
7+
public interface IEssentialsSpawn extends Plugin
8+
{
9+
10+
/**
11+
* Sets the spawn for a given group to a given location.
12+
*
13+
* @param loc The location to set the spawn to
14+
* @param group The group to set the spawn of, or 'default' for the default spawn
15+
* @throws IllegalArgumentException If group is null
16+
*/
17+
public void setSpawn(Location loc, String group);
18+
19+
/**
20+
* Gets the spawn location for a given group.
21+
*
22+
* @param group The group to get the spawn of, or 'default' for the default spawn
23+
* @return The spawn location set for the given group
24+
* @throws IllegalArgumentException If group is null
25+
*/
26+
public Location getSpawn(String group);
27+
}

0 commit comments

Comments
 (0)