Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

entity type

Featured Replies

was looking through api and couldn't find anything .. either it's not there or i'm just blind but how am i supposed to determine if entity is object/npc/player ?

Entity is an interface...so you could easily check what object you're dealing with:

entity instanceof Player
entity instanceof RS2Object

But why are you getting entities in the first place? Why not use the Players, Objects classes to get the entities you want instead?

Edited by Reveance

  • Author

I need it for my custom interaction method to choose the correct menu option,

    public boolean interactWithEntity(Entity entity, String option) {

So for objects it's getUID(), npc getIndex() etc but entity doesn't even give me such methods to check

22 minutes ago, Ayylmao420 said:

I need it for my custom interaction method to choose the correct menu option,

    public boolean interactWithEntity(Entity entity, String option) {

So for objects it's getUID(), npc getIndex() etc but entity doesn't even give me such methods to check

Thats the whole point of having super classes, that they have their own custom methods. What you can do is overload the methods to have diff params depending on the entities super class.

Edited by Vilius

9 minutes ago, Vilius said:

Thats the whole point of having super classes, that they have their own custom methods. What you can do is overload the methods to have diff params depending on the entities super class.

Correct, however overloading his method won't work in this case since he'll first need to cast to whatever more specific object it is first, before calling the method, in order for that to work.

I think the easiest solution, especially as you only have like 3 or 4 instances to check, would be to use instanceof. I doubt you'd want something fancier in this case...

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.