Not sure what you are trying to do with this code, but you are trying to draw the display on top of your player
This draws the outline of a model
Same works for Npc,'s or whatever you are trying to draw.
public void onPaint(Graphics2D g){
RS2Object object = ....
if(object != null && object.isVisible()){
g.draw(object.getModel().getArea(object.getGridX(), object.getGridY(), object.getZ()));
}
}
Retrieving a object in the onPaint method isn't a great example though, because this will result in FPS drops. The more things you load in the onPaint the harder your FPS drops
the best thing is to set the object inside the onLoop
RS2Object object;
public int onLoop(){
object = ...;
}
public void onPaint(Graphics2D g){
if(object != null && object.isVisible()){
g.draw(object.getModel().getArea(object.getGridX(), object.getGridY(), object.getZ()));
}
}