plugin-hub icon indicating copy to clipboard operation
plugin-hub copied to clipboard

Create nex-droprate-calculator

Open Worley03 opened this issue 1 year ago • 4 comments

This plugin monitors the players contribution to Nex fights and continuously calculates the roll for a unique drop.

Worley03 avatar Oct 21 '24 08:10 Worley03

New plugin nex-droprate-calculator: https://github.com/Worley03/nex-droprate-calculator/tree/eeed6eff6cd667465c00bd7931c4df60186bf160

NexDroprateCalculatorPanel is really annoying to review, you should use variables instead of casting repeatedly:

-    runPanel.add(new JLabel(labelTitle("- Current Kill -")));
-    ((JLabel) runPanel.getComponent(0)).setFont(font);
+    JLabel currentKillHeader = new JLabel("- Current Kill -");
+    currentKillHeader.setFont(font);
+    runPanel.add(currentKillHeader);

LlemonDuck avatar Oct 23 '24 08:10 LlemonDuck

No more repeat casting. Sorry I should of revised that section!

Worley03 avatar Oct 23 '24 18:10 Worley03

  • onConfigChanged is fired to all plugins for all other plugins' config changes as well. Check for the config group to match your own as the first thing in this method https://github.com/Worley03/nex-droprate-calculator/blob/284f36eb6fdbf64bf9ad02b4f1d7547421247cc8/src/main/java/com/nexdropratecalculator/NexDroprateCalculatorPlugin.java#L74
  • add the config once at plugin startup rather than on every game tick https://github.com/Worley03/nex-droprate-calculator/blob/284f36eb6fdbf64bf9ad02b4f1d7547421247cc8/src/main/java/com/nexdropratecalculator/NexDroprateCalculatorPlugin.java#L86-L89
  • You can use onNpcSpawned to detect Nex, then

LlemonDuck avatar Oct 25 '24 10:10 LlemonDuck

Merging, but you should consider replacing all your getComponent calls with just persisting the components in fields.

LlemonDuck avatar Oct 27 '24 07:10 LlemonDuck