diff options
Diffstat (limited to 'EssentialsSpawn')
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandspawn.java | 3 | ||||
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/SpawnStorage.java | 16 |
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 { |