Thanks, yeah I ended up writing something similar but in java instead. I’ll put my code below since I don’t see much java in these forums.
Here is the setter. I return a new Vector() but I don’t actually need any return value.
public class SetKeyValuePair extends XLTStrings {
    @Override
    public Vector xlateStrings(CloverEnv cloverEnv, Xpm xpm, Vector vector) throws CloverleafException {
        PropertyTree userData = xpm.metadata.getUserdata();
        if(vector.size() == 2 ) {
            userData.put((String)vector.elementAt(0), (String) vector.elementAt(1));
            xpm.metadata.setUserdata(userData);
        }
        return new Vector();
    }
}
This is the getter.
public class GetKeyValuePair extends XLTString {
    @Override
    public Object xlateString(CloverEnv cloverEnv, Xpm xpm, String inVal) throws CloverleafException {
        PropertyTree userData = xpm.metadata.getUserdata();
        return userData.getString(inVal);
    }
}