Mrnice98 / BossingInfo

My Kills Per Hour Plugin
BSD 2-Clause "Simplified" License
4 stars 3 forks source link

Bandaid fixes to solve issues with sidepanel disabled. #19

Closed umer-rs closed 6 months ago

umer-rs commented 7 months ago

Symptom

  1. Overlay displays the wrong number of kills with the side panel disabled.
  2. The overlay always displays 2 kills upon the first kill with the side panel disabled.

Problem

  1. KphPlugin::totalSessionTimer() crashes due to a NullPointerError on calling panel.setSessionTimeLabel().
  2. KphPanel::setBossMetrics() crashes due to the graphics not existing on FontMetrics fontMetrics = getGraphics().getFontMetrics(FontManager.getRunescapeBoldFont()).

Solution

  1. Instead of only creating the panel when the config option is enabled, create the panel regardless and hide it if the option is disabled.
  2. Remove call to graphics to get font metrics, because it is a hardcoded font.