mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-12 09:35:26 +02:00
[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
This commit is contained in:
@@ -498,9 +498,24 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
|||||||
|
|
||||||
public Location getHome() throws Exception
|
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);
|
World world = getServer() == null ? null : getServer().getWorlds().get(0);
|
||||||
if (vals.size() > 5 && getServer() != null)
|
if (vals.size() > 5 && getServer() != null)
|
||||||
{
|
{
|
||||||
@@ -521,7 +536,16 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
|||||||
|
|
||||||
try
|
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");
|
List<Object> vals = (List<Object>)gdata.get("home");
|
||||||
World world = getServer().getWorlds().get(0);
|
World world = getServer().getWorlds().get(0);
|
||||||
if (vals.size() > 5)
|
if (vals.size() > 5)
|
||||||
@@ -546,14 +570,25 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void teleportToHome(final String chargeFor)
|
public void teleportToHome(final String chargeFor)
|
||||||
|
{
|
||||||
|
teleportToHome(chargeFor, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void teleportToHome(final String chargeFor, String otherPlayer)
|
||||||
{
|
{
|
||||||
final long delay = Essentials.getSettings().getTeleportDelay();
|
final long delay = Essentials.getSettings().getTeleportDelay();
|
||||||
|
|
||||||
Location loc = null;
|
Location loc = null;
|
||||||
try
|
try
|
||||||
{
|
{// check this first in case user hasn't set a home yet
|
||||||
// check this first in case user hasn't set a home yet
|
if (otherPlayer == null)
|
||||||
loc = getHome();
|
{
|
||||||
|
loc = getHome();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loc = getHome(otherPlayer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
@@ -787,7 +822,9 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
|||||||
if (command == null || command.trim().isEmpty())
|
if (command == null || command.trim().isEmpty())
|
||||||
{
|
{
|
||||||
tools.remove(Integer.valueOf(stack.getTypeId()));
|
tools.remove(Integer.valueOf(stack.getTypeId()));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
tools.put(Integer.valueOf(stack.getTypeId()), command.trim());
|
tools.put(Integer.valueOf(stack.getTypeId()), command.trim());
|
||||||
}
|
}
|
||||||
data.put("powertools", tools);
|
data.put("powertools", tools);
|
||||||
|
@@ -18,7 +18,7 @@ public class Commandhome extends EssentialsCommand
|
|||||||
user.teleportCooldown();
|
user.teleportCooldown();
|
||||||
if(args.length > 0 && user.isAuthorized("essentials.home.others"))
|
if(args.length > 0 && user.isAuthorized("essentials.home.others"))
|
||||||
{
|
{
|
||||||
user.teleportToHome(args[0]);
|
user.teleportToHome(this.getName(), args[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
user.teleportToHome(this.getName());
|
user.teleportToHome(this.getName());
|
||||||
|
Reference in New Issue
Block a user