Attackstyles: Add @VisibleForTesting annotations and lombokify

This commit is contained in:
Lucwousin
2019-11-21 10:00:04 +01:00
parent 2004dc230f
commit 0322923895

View File

@@ -70,8 +70,11 @@ public class AttackStylesPlugin extends Plugin
private int attackStyleVarbit = -1; private int attackStyleVarbit = -1;
private int equippedWeaponTypeVarbit = -1; private int equippedWeaponTypeVarbit = -1;
private int castingModeVarbit = -1; private int castingModeVarbit = -1;
@Getter
@Nullable
private AttackStyle attackStyle; private AttackStyle attackStyle;
private final Set<Skill> warnedSkills = new HashSet<>(); private final Set<Skill> warnedSkills = new HashSet<>();
@Getter(AccessLevel.PACKAGE)
private boolean warnedSkillSelected = false; private boolean warnedSkillSelected = false;
private final Table<WeaponType, WidgetInfo, Boolean> widgetsToHide = HashBasedTable.create(); private final Table<WeaponType, WidgetInfo, Boolean> widgetsToHide = HashBasedTable.create();
@@ -108,6 +111,7 @@ public class AttackStylesPlugin extends Plugin
private boolean warnForRanged; private boolean warnForRanged;
private boolean warnForMagic; private boolean warnForMagic;
private boolean hideAutoRetaliate; private boolean hideAutoRetaliate;
@VisibleForTesting
boolean removeWarnedStyles; boolean removeWarnedStyles;
@Override @Override
@@ -159,17 +163,7 @@ public class AttackStylesPlugin extends Plugin
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged); eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
} }
@Nullable @VisibleForTesting
public AttackStyle getAttackStyle()
{
return attackStyle;
}
boolean isWarnedSkillSelected()
{
return warnedSkillSelected;
}
void onWidgetHiddenChanged(WidgetHiddenChanged event) void onWidgetHiddenChanged(WidgetHiddenChanged event)
{ {
if (event.getWidget().isSelfHidden() || TO_GROUP(event.getWidget().getId()) != COMBAT_GROUP_ID) if (event.getWidget().isSelfHidden() || TO_GROUP(event.getWidget().getId()) != COMBAT_GROUP_ID)
@@ -215,6 +209,7 @@ public class AttackStylesPlugin extends Plugin
} }
} }
@VisibleForTesting
void onVarbitChanged(VarbitChanged event) void onVarbitChanged(VarbitChanged event)
{ {
int currentAttackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE); int currentAttackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE);
@@ -240,6 +235,7 @@ public class AttackStylesPlugin extends Plugin
} }
} }
@VisibleForTesting
void onConfigChanged(ConfigChanged event) void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("attackIndicator")) if (event.getGroup().equals("attackIndicator"))