Solved Getting a Location from String

Discussion in 'Plugin Development' started by NetherResident, Feb 9, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    NetherResident

    I am attempting to make a simple method for my plugin that runs my server. This method is to take a string of three coordinates, and turn that into a Location.

    This is the method I am attempting to make.

    Code:
         
            public static Location decryptLocation(World world, String s){
             
                String args[] = s.split(",");
             
                Location loc = new Location(world, Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));
             
                return loc;
             
            }
    Here is an example of me trying to use the said method.

    Code:
    Location loc = decryptLocation(world, "17,73,-98");
    The problem is that the loc variable is always null, I would appreciate any help with this that I can get.

    Extra Notes:
    The world variable passed into decryptLocation() is not null.
     
  2. Offline

    stirante

Thread Status:
Not open for further replies.

Share This Page