summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-28 22:52:08 +0000
committerementalo <ementalo@e251c2fe-e539-e718-e476-b85c1f46cddb>2011-04-28 22:52:08 +0000
commit2b915e72fa95008b7cca1d8cac55973585fea699 (patch)
treed51312d4ef1dbe76c882c24454955df19443a5a1
parentdb191e3115392a885b3f1e2e5794b25bb03a5dec (diff)
downloadEssentials-2b915e72fa95008b7cca1d8cac55973585fea699.tar
Essentials-2b915e72fa95008b7cca1d8cac55973585fea699.tar.gz
Essentials-2b915e72fa95008b7cca1d8cac55973585fea699.tar.lz
Essentials-2b915e72fa95008b7cca1d8cac55973585fea699.tar.xz
Essentials-2b915e72fa95008b7cca1d8cac55973585fea699.zip
[trunk] fix /home playername. Look out for any case sesitive weirdness
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1288 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r--Essentials/src/com/earth2me/essentials/User.java51
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhome.java2
2 files changed, 45 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java
index ad04d6ce5..ea4803b32 100644
--- a/Essentials/src/com/earth2me/essentials/User.java
+++ b/Essentials/src/com/earth2me/essentials/User.java
@@ -498,9 +498,24 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
public Location getHome() throws Exception
{
- if (data.containsKey("home"))
+ return getHome(null);
+ }
+
+ public Location getHome(String playerName) throws Exception
+ {
+ Map<String, Object> userData = new HashMap<String, Object>();
+ if (playerName == null)
{
- List<Object> vals = (List<Object>)data.get("home");
+ userData = data;
+ }
+ else
+ {
+ userData = Essentials.getData(playerName);
+ }
+
+ if (userData.containsKey("home"))
+ {
+ List<Object> vals = (List<Object>)userData.get("home");
World world = getServer() == null ? null : getServer().getWorlds().get(0);
if (vals.size() > 5 && getServer() != null)
{
@@ -521,7 +536,16 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
try
{
- Map<String, Object> gdata = Essentials.getData(this);
+ Map<String, Object> gdata = null;
+ if (playerName != null)
+ {
+ gdata = Essentials.getData(playerName);
+ }
+ else
+ {
+ gdata = Essentials.getData(this);
+ }
+
List<Object> vals = (List<Object>)gdata.get("home");
World world = getServer().getWorlds().get(0);
if (vals.size() > 5)
@@ -547,13 +571,24 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
public void teleportToHome(final String chargeFor)
{
+ teleportToHome(chargeFor, null);
+ }
+
+ public void teleportToHome(final String chargeFor, String otherPlayer)
+ {
final long delay = Essentials.getSettings().getTeleportDelay();
Location loc = null;
try
- {
- // check this first in case user hasn't set a home yet
- loc = getHome();
+ {// check this first in case user hasn't set a home yet
+ if (otherPlayer == null)
+ {
+ loc = getHome();
+ }
+ else
+ {
+ loc = getHome(otherPlayer);
+ }
}
catch (Throwable ex)
{
@@ -787,7 +822,9 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
if (command == null || command.trim().isEmpty())
{
tools.remove(Integer.valueOf(stack.getTypeId()));
- } else {
+ }
+ else
+ {
tools.put(Integer.valueOf(stack.getTypeId()), command.trim());
}
data.put("powertools", tools);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
index 9eaa9727a..41647ef50 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
@@ -18,7 +18,7 @@ public class Commandhome extends EssentialsCommand
user.teleportCooldown();
if(args.length > 0 && user.isAuthorized("essentials.home.others"))
{
- user.teleportToHome(args[0]);
+ user.teleportToHome(this.getName(), args[0]);
return;
}
user.teleportToHome(this.getName());