Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
AlphaDog

getName method for interactables

5 posts in this topic

I would love a getName method that returns an empty string if the definition is null.

    //For example, the RSItem class    public String getName() {        final RSItemDefinition itemDef = getDefinition();        return itemDef == null ? "" : itemDef.getName();    }

So things like

        public boolean accept(RSItem rsItem) {            RSItemDefinition itemDef = rsItem.getDefinition();            return itemDef != null && itemDef.getName().contains("ore");        }

can be shortened to

        public boolean accept(RSItem rsItem) {            return rsItem.getName().contains("ore");        }

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   You have pasted content with formatting.   Remove formatting

×   Your link has been automatically embedded.   Display as a link instead

Loading...
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.