Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • I want to use dependencies used in the client but there are conflicts. Suggestions?


    boomslap

    Recommended Posts

    I would like to use the StringUtils class from the apache.commons.lang3 package on my script. I have added it as a dependency on my maven pom file but since the same package exists inside the client.jar, it gets priority during runtime and I get a 'NoSuchMethodError' when executing for instance the StringUtils.capitalize(String) method because that method doesn't exist in the version included in the client.jar.

    Is there a workaround this to give priority to my dependency over the package included in the client.jar?

    Could you possibly include the entire library inside the client.jar?

    Thanks!

     

    Link to comment
    Share on other sites

    5 hours ago, boomslap said:

    I would like to use the StringUtils class from the apache.commons.lang3 package on my script. I have added it as a dependency on my maven pom file but since the same package exists inside the client.jar, it gets priority during runtime and I get a 'NoSuchMethodError' when executing for instance the StringUtils.capitalize(String) method because that method doesn't exist in the version included in the client.jar.

    Is there a workaround this to give priority to my dependency over the package included in the client.jar?

    Could you possibly include the entire library inside the client.jar?

    Thanks!

     

    Not too sure on the overall answer with dependancy priority when it comes to naming conflicts, but when it comes to StringUtils.capitalize heres my GUI failsafe you can use:
     

    private static String itemNameFormatting(String itemName)
    {
        StringBuilder formatted = new StringBuilder();
        String lower = itemName.toLowerCase();
        boolean upperCase = true;
        for(int i = 0; i < lower.length(); i++)
        {
            char letter = lower.charAt(i);
            if(upperCase)
            {
                String upper = "" + letter;
                formatted.append(upper.toUpperCase());
                upperCase = false;
            }
            else
                formatted.append(letter);
        }
        MethodProvider.log("Formatted itemName: " + itemName + " to: " + formatted);
        return formatted.toString();
    }
    Link to comment
    Share on other sites

    4 hours ago, Axolotl said:

    Not too sure on the overall answer with dependancy priority when it comes to naming conflicts, but when it comes to StringUtils.capitalize heres my GUI failsafe you can use:
     

    private static String itemNameFormatting(String itemName)
    {
        StringBuilder formatted = new StringBuilder();
        String lower = itemName.toLowerCase();
        boolean upperCase = true;
        for(int i = 0; i < lower.length(); i++)
        {
            char letter = lower.charAt(i);
            if(upperCase)
            {
                String upper = "" + letter;
                formatted.append(upper.toUpperCase());
                upperCase = false;
            }
            else
                formatted.append(letter);
        }
        MethodProvider.log("Formatted itemName: " + itemName + " to: " + formatted);
        return formatted.toString();
    }

    Thanks a lot for the suggestion and the code! Recreating the functions I need is something I thought of doing but I would want to avoid it if possible since this is an issue where similar conflicts can happen with other dependencies and they are quite annoying to find and fix.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.