Tutorial Notice to all authors regarding spectre

Discussion in 'Tutorials & Resources' started by Aidden, Mar 10, 2016.

  1. 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 (Text):
    2. final Filter<ItemDefinition> itemFilter = new Filter<ItemDefinition>() {
    4.         @Override
    5.         public boolean accepts(ItemDefinition def) {
    6.             if (def != null) {
    7.                 final String name = def.getName();
    8.                 return name != null && !name.isEmpty() && name.contains("Add to bonfire");
    9.             }
    10.             return false;
    11.         }
    13.     };
    is equivalent to:
    Code (Text):
    2. final Predicate<ItemDefinition> itemFilter = def -> {
    3.         if (def != null) {
    4.             final String name = def.getName();
    5.             return name != null && !name.isEmpty() && name.contains("Add to bonfire");
    6.         }
    7.         return false;
    8.     };
    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
    #1 Aidden, Mar 10, 2016
    Last edited: Mar 12, 2016
    smitty260 likes this.
  2. Aidden laying it Down!
  3. 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.
    LucasSousa likes this.
  4. Thanks for this :)

Share This Page