summaryrefslogtreecommitdiffstats
path: root/EssentialsSpawn
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2012-02-05 17:19:32 +0100
committersnowleo <schneeleo@gmail.com>2012-02-05 17:19:32 +0100
commit8ab5bad988f7ad9c8a1fafd504cf108f3ec84cc3 (patch)
tree2a33da8fbb378cedbb7210ee80edd1f1891efb87 /EssentialsSpawn
parent8080abacd6fc379acba4136d0b854d780f262f4e (diff)
downloadEssentials-8ab5bad988f7ad9c8a1fafd504cf108f3ec84cc3.tar
Essentials-8ab5bad988f7ad9c8a1fafd504cf108f3ec84cc3.tar.gz
Essentials-8ab5bad988f7ad9c8a1fafd504cf108f3ec84cc3.tar.lz
Essentials-8ab5bad988f7ad9c8a1fafd504cf108f3ec84cc3.tar.xz
Essentials-8ab5bad988f7ad9c8a1fafd504cf108f3ec84cc3.zip
Modified BetterLocation, and new Permission-System
Diffstat (limited to 'EssentialsSpawn')
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java3
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java16
2 files changed, 14 insertions, 5 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
index 07532653c..357b03a2c 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java
@@ -5,6 +5,7 @@ import com.earth2me.essentials.Trade;
import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
+import com.earth2me.essentials.perm.Permissions;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@@ -17,7 +18,7 @@ public class Commandspawn extends EssentialsCommand
{
final Trade charge = new Trade(commandName, ess);
charge.isAffordableFor(user);
- if (args.length > 0 && user.isAuthorized("essentials.spawn.others"))
+ if (args.length > 0 && Permissions.SPAWN_OTHERS.isAuthorized(user))
{
final IUser otherUser = getPlayer(args, 0);
respawn(otherUser, null);
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java
index 067950e96..98545eaf0 100644
--- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java
+++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java
@@ -5,6 +5,7 @@ import com.earth2me.essentials.api.IEssentialsModule;
import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.settings.Spawns;
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
+import com.earth2me.essentials.storage.Location.WorldNotLoadedException;
import java.io.File;
import java.util.HashMap;
import java.util.Locale;
@@ -35,9 +36,9 @@ public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IE
{
if (getData().getSpawns() == null)
{
- getData().setSpawns(new HashMap<String, Location>());
+ getData().setSpawns(new HashMap<String, com.earth2me.essentials.storage.Location>());
}
- getData().getSpawns().put(group.toLowerCase(Locale.ENGLISH), loc);
+ getData().getSpawns().put(group.toLowerCase(Locale.ENGLISH), new com.earth2me.essentials.storage.Location(loc));
}
finally
{
@@ -59,7 +60,7 @@ public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IE
{
return getWorldSpawn();
}
- final Map<String, Location> spawnMap = getData().getSpawns();
+ final Map<String, com.earth2me.essentials.storage.Location> spawnMap = getData().getSpawns();
String groupName = group.toLowerCase(Locale.ENGLISH);
if (!spawnMap.containsKey(groupName))
{
@@ -69,7 +70,14 @@ public class SpawnStorage extends AsyncStorageObjectHolder<Spawns> implements IE
{
return getWorldSpawn();
}
- return spawnMap.get(groupName);
+ try
+ {
+ return spawnMap.get(groupName).getBukkitLocation();
+ }
+ catch (WorldNotLoadedException ex)
+ {
+ return getWorldSpawn();
+ }
}
finally
{