Jump to content

Botre

Members
  • Posts

    5883
  • Joined

  • Last visited

  • Days Won

    18
  • Feedback

    100%

Everything posted by Botre

  1. The Robot class / key listeners are perfectly safe. As long as incoming and outgoing connections are checked, we don't really have to worry about the rest :p
  2. Updated to use BooleanSupplier instead of Predicate<T> https://docs.oracle.com/javase/8/docs/api/java/util/function/BooleanSupplier.html
  3. Checks if all overridable methods from a class are indeed overriden. Useful for writing decorator classes / wrappers. Example: public class InteractableObjectDecorator extends InteractableObject { static { ReflectionUtil.checkOverrides(InteractableObjectDecorator.class, InteractableObject.class); } public InteractableObjectDecorator(XInteractableObject instance) { super(instance); } } java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public java.lang.String org.osbot.rs07.api.model.InteractableObject.getName() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public java.lang.String[] org.osbot.rs07.api.model.InteractableObject.getActions() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getId() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getType() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.def.EntityDefinition org.osbot.rs07.api.model.InteractableObject.getDefinition() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.def.ObjectDefinition org.osbot.rs07.api.model.InteractableObject.getDefinition() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.exists() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getLocalY() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getGridY() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getOrientation() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isOnScreen() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getZ() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int[] org.osbot.rs07.api.model.InteractableObject.getModelIds() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.map.Area org.osbot.rs07.api.model.InteractableObject.getArea(int) from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getUID() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getLocalX() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getGridX() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.hasAction(java.lang.String[]) from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.map.Position org.osbot.rs07.api.model.InteractableObject.getPosition() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isPlayer() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isNPC() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.model.Animable org.osbot.rs07.api.model.InteractableObject.getAnimable() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getY() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getSizeY() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isVisible() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.interact(java.lang.String[]) from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getX() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.hover() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getSizeX() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.InteractableObject.getConfig() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.isGameObject() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.InteractableObject.examine() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public void org.osbot.rs07.api.model.Modeled.setPrioritized(boolean) from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.rs07.api.model.Modeled.isPrioritized() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public void org.osbot.rs07.api.model.Modeled.updateModel(org.osbot.rs07.api.model.Model) from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.model.Model org.osbot.rs07.api.model.Modeled.getModel() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public int org.osbot.rs07.api.model.Modeled.getHeight() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.script.MethodProvider org.osbot.rs07.api.RS07Wrapper.getMethods() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.api.Client org.osbot.rs07.api.RS07Wrapper.getClient() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.core.AbstractBot org.osbot.rs07.api.RS07Wrapper.getBot() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public org.osbot.rs07.Bot org.osbot.rs07.api.RS07Wrapper.getBot() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public boolean org.osbot.core.api.Wrapper.equals(java.lang.Object) from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public java.lang.String java.lang.Object.toString() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) java.lang.NoSuchMethodException: class test.InteractableObjectDecorator does not override public native int java.lang.Object.hashCode() from class org.osbot.rs07.api.model.InteractableObject at reflection.ReflectionUtil.checkOverrides(ReflectionUtil.java:71) at test.InteractableObjectDecorator.<clinit>(InteractableObjectDecorator.java:11) Snippet public static void checkOverrides(Class<?> subClass, Class<?> superClass) { for (Method superMethod : superClass.getMethods()) { if(Modifier.isStatic(superMethod.getModifiers())) continue; if(Modifier.isFinal(superMethod.getModifiers())) continue; try { Method subMethod = subClass.getMethod(superMethod.getName(), superMethod.getParameterTypes()); if(subMethod.getDeclaringClass().equals(superMethod.getDeclaringClass())) { throw new NoSuchMethodException(subClass + " does not override " + superMethod + " from " + superClass); } } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } } }
  4. RS2Object object = .... object .getOrientation();
  5. Botre

    bye osbot

    Ok so now that Kevin's gone.... Jeez what an asshole right? Can't say I'm sad to see him go :p Shit scripter aswell x)
  6. No need to pay, free beta should be available soonTM.
  7. Some dank setup you got there man
  8. Sounds like a button to me! https://docs.oracle.com/javase/tutorial/uiswing/components/button.html
  9. Happy birthday my friend!
  10. http://osbot.org/forum/topic/87731-explvs-dank-gui-tutorial/ Is a good beginner's tutorial on GUIs for scripters
  11. You'll be the first person I'll contact once the script enters the BETA stage!
  12. Some nice progress my friend! Good luck & have fun
  13. Botre Pest Control Features: Implemented: Auto-detect best settings. Advanced settings customization options. Smart target prioritization. All boats. Classic potions. Powerups. Classic praying. Special attacks. Autocasting. Gate management. In development: Combat prayer flicking. Banking. Blowpipe recharging. Ammo management. Barricade repairing.
  14. Botre NMZ Features: Implemented: Auto-detect best settings. Advanced settings customization options. Overload potions. Absorption potions. Classic potions. Powerups. Classic praying. Rapid health prayer flicking. Dwarven rock cake. Special attacks. Extensive customization options for Rumble mode. In development: Combat prayer flicking. Banking. Dream coffer management. Dream re-entry. Point spending. Blowpipe recharging. Ammo management.
  15. holy fuckerino this thread though
  16. Example: // Event will break after 10 seconds. execute(EventDecorator.withTimeout(new WalkingEvent(leArea), 10)); // Event will break when player is animating (a bit random but ok..) execute(EventDecorator.withBreakCondition(new InteractionEvent(goblin, "Attack"), () -> myPlayer().isAnimating())); Code: package org.botre.osbot.event; import java.util.function.BooleanSupplier; import org.dreamstream.moka.main.time.FetchingTimer; import org.dreamstream.moka.main.time.Timer; import org.osbot.rs07.event.Event; public final class EventDecorator { private EventDecorator() { } public static final Event withBreakCondition(Event event, BooleanSupplier breakCondition) { return new Event() { @Override public void onStart() { try { super.onStart(); } catch (InterruptedException e) { e.printStackTrace(); } event.setAsync(); execute(event); } @Override public int execute() throws InterruptedException { boolean failed = breakCondition.getAsBoolean(); if(failed) { event.setFailed(); setFailed(); } return 100; } @Override public boolean hasFailed() { boolean failed = breakCondition.getAsBoolean(); if(failed) { event.setFailed(); setFailed(); } return failed || event.hasFailed(); } @Override public boolean hasFinished() { return event.hasFinished(); } }; } public static final Event withTimeout(Event event, int timeoutSeconds) throws IllegalArgumentException { if(timeoutSeconds < 0) throw new IllegalArgumentException(); Timer timer = FetchingTimer.milliseconds(); return withBreakCondition(event, () -> { return timer.getElapsedSeconds() > timeoutSeconds; }); } }
×
×
  • Create New...