tabComplete = CommandBase.getListOfStringsMatchingLastWord(new String[] { args.peek() }, parseSpawnArgs);
return;
}
String loc = args.remove().toLowerCase();
WorldPoint point = null;
boolean isBed = false;
switch (loc)
{
case "here":
point = new WorldPoint(senderPlayer);
break;
case "bed":
isBed = true;
break;
case "clear":
break;
default:
if (args.size() < 3)
throw new CommandException("Too few arguments!");
try
{
int x = CommandBase.parseInt(sender, loc);
int y = CommandBase.parseInt(sender, args.remove());
int z = CommandBase.parseInt(sender, args.remove());
int dimension = CommandBase.parseInt(sender, args.remove());
point = new WorldPoint(dimension, x, y, z);
}
catch (NumberFormatException e)
{
error("Invalid location argument");
return;
}
break;
}
if (isBed)
{
zone.setPlayerPermissionProperty(ident, FEPermissions.SPAWN, "bed");
info(String.format("Set spawn for user %s to be bed-location in zone %s", ident.getUsernameOrUUID(), zone.getName()));
}
else if (point == null)
{
zone.clearPlayerPermission(ident, FEPermissions.SPAWN);
info(String.format("Cleared spawn-rule for user %s in zone %s", ident.getUsernameOrUUID(), zone.getName()));
}
else
{
zone.setPlayerPermissionProperty(ident, FEPermissions.SPAWN, point.toString());
info(String.format("Set spawn for user %s to %s in zone %s", ident.getUsernameOrUUID(), point.toString(), zone.getName()));
}
}