From 8ab5bad988f7ad9c8a1fafd504cf108f3ec84cc3 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 5 Feb 2012 17:19:32 +0100 Subject: Modified BetterLocation, and new Permission-System --- .../src/com/earth2me/essentials/spawn/Commandspawn.java | 3 ++- .../src/com/earth2me/essentials/spawn/SpawnStorage.java | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'EssentialsSpawn') 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 implements IE { if (getData().getSpawns() == null) { - getData().setSpawns(new HashMap()); + getData().setSpawns(new HashMap()); } - 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 implements IE { return getWorldSpawn(); } - final Map spawnMap = getData().getSpawns(); + final Map spawnMap = getData().getSpawns(); String groupName = group.toLowerCase(Locale.ENGLISH); if (!spawnMap.containsKey(groupName)) { @@ -69,7 +70,14 @@ public class SpawnStorage extends AsyncStorageObjectHolder implements IE { return getWorldSpawn(); } - return spawnMap.get(groupName); + try + { + return spawnMap.get(groupName).getBukkitLocation(); + } + catch (WorldNotLoadedException ex) + { + return getWorldSpawn(); + } } finally { -- cgit v1.2.3