Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Tutorial Notice to all authors regarding spectre

Author of MaxiBots
Joined
Dec 3, 2013
Messages
6,774
Hey guys,

Some of you may or may not have already heard that spectre comes with some api changes that will break your bots. While most of them can't really be handled by you guys pre-emptively, there is one that you can be ready for now, and that is the removal of the Filter(s) class. It was initially introduced because we weren't forcing the use of Java 8 which comes with the Predicate class, which has the same functionality as Filters (Probably more).

The documentation for predicates can be found here: Predicate (Java Platform SE 8 )

Here's an example:
Code:
final Filter<ItemDefinition> itemFilter = new Filter<ItemDefinition>() {

        @Override
        public boolean accepts(ItemDefinition def) {
            if (def != null) {
                final String name = def.getName();
                return name != null && !name.isEmpty() && name.contains("Add to bonfire");
            }
            return false;
        }

    };

is equivalent to:
Code:
final Predicate<ItemDefinition> itemFilter = def -> {
        if (def != null) {
            final String name = def.getName(); 
            return name != null && !name.isEmpty() && name.contains("Add to bonfire");
        }
        return false;
    };
Finally, any of the methods from the Filters class can be found in the Predicate class. With the example above i could do itemFilter.negate() instead of Filters.invert(itemFilter)

Hope this was helpful!

Note: I'll post the other changes that can't be compiled with the current version of runemate soon.

FileWeb -> SerializableWeb
ActionSlot -> ActionBar.Slot
 
Last edited:
Author of MaxiBots
Joined
Dec 3, 2013
Messages
6,774
I'll post a full list of changes after i finish this assignment, however if you choose to implement them now you won't be able to compile your bots without spectre.
 
Top