Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- name: Compile Tests
run: ./gradlew compileTestJava

- name: Lint & Formatting
run: ./gradlew checkstyleMain checkstyleTest

- name: Run Tests
run: ./gradlew test

Expand Down
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
id 'java'
id 'checkstyle'
}

checkstyle {
toolVersion = "10.26.1"
}

repositories {
Expand Down
39 changes: 39 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="fileExtensions" value="java, properties, xml"/>
<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/filefilters/index.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<module name="FileTabCharacter"/>

<module name="TreeWalker">
<module name="ArrayTrailingComma"/>
<module name="AvoidNestedBlocks"/>
<module name="AvoidStarImport"/>
<module name="ConstantName"/>
<module name="DefaultComesLast"/>
<module name="EmptyBlock"/>
<module name="FallThrough"/>
<module name="ImportOrder">
<property name="option" value="top"/>
<property name="ordered" value="true"/>
<property name="separated" value="false"/>
<property name="separatedStaticGroups" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>
<module name="InnerTypeLast"/>
<module name="LeftCurly">
<property name="option" value="nl"/>
<property name="tokens" value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF, INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF, OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/>
</module>
<module name="OneTopLevelClass"/>
<module name="OuterTypeFilename"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
</module>
</module>
14 changes: 7 additions & 7 deletions src/main/java/com/attacktimer/AnimationData.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ public enum AnimationData
HIGH_ALCH(713, AttackStyle.NON_ATTACK);

private static final Map<Integer, AnimationData> DATA;
private static final Map<Spellbook, Set<AnimationData>> spellBookAnimations;
private static final Map<Integer, AnimationData> notAttacks;
private static final Map<Spellbook, Set<AnimationData>> SPELL_BOOK_ANIMATIONS;
private static final Map<Integer, AnimationData> NOT_ATTACKS;

public final int animationId;
public final boolean isSpecial;
Expand Down Expand Up @@ -339,8 +339,8 @@ public enum AnimationData
}

DATA = builder.build();
notAttacks = notAttacksBuilder.build();
spellBookAnimations = spellBookBuilder;
NOT_ATTACKS = notAttacksBuilder.build();
SPELL_BOOK_ANIMATIONS = spellBookBuilder;
}

public static AnimationData fromId(int animationId)
Expand All @@ -350,7 +350,7 @@ public static AnimationData fromId(int animationId)

public static Set<AnimationData> getAnimationsForSpellbook(Spellbook s)
{
return spellBookAnimations.get(s);
return SPELL_BOOK_ANIMATIONS.get(s);
}

public static boolean isManualCasting(AnimationData animationData)
Expand All @@ -360,14 +360,14 @@ public static boolean isManualCasting(AnimationData animationData)
{
// We tell a manual cast by the animation data:
return animationData.attackStyle == AttackStyle.MAGIC &&
spellBookAnimations.get(animationData.spellbook).contains(animationData);
SPELL_BOOK_ANIMATIONS.get(animationData.spellbook).contains(animationData);
}
return false;
}

public static boolean isBlockListAnimation(int animationId)
{
return notAttacks.containsKey(animationId);
return NOT_ATTACKS.containsKey(animationId);
}

@Override
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/com/attacktimer/AttackBarStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
@AllArgsConstructor
public enum AttackBarStyle
{
AUTO("Auto"),
STANDARD("Standard"),
HIGH_DETAIL("High Detail");
AUTO("Auto"),
STANDARD("Standard"),
HIGH_DETAIL("High Detail");

private final String name;
private final String name;

@Override
public String toString()
{
return name;
}
@Override
public String toString()
{
return name;
}
}
3 changes: 2 additions & 1 deletion src/main/java/com/attacktimer/AttackProcedure.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

public enum AttackProcedure {
public enum AttackProcedure
{
POWERED_STAVE,
MANUAL_AUTO_CAST,
MELEE_OR_RANGE
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/attacktimer/AttackTimerBarOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Expand All @@ -40,8 +40,8 @@
import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.SpriteID;
import net.runelite.api.coords.LocalPoint;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
Expand All @@ -65,8 +65,7 @@ class AttackTimerBarOverlay extends Overlay
private boolean shouldShowBar = false;

@Inject
private AttackTimerBarOverlay(final Client client, final AttackTimerMetronomeConfig config,
final AttackTimerMetronomePlugin plugin)
private AttackTimerBarOverlay(final Client client, final AttackTimerMetronomeConfig config, final AttackTimerMetronomePlugin plugin)
{
this.client = client;
this.config = config;
Expand Down Expand Up @@ -97,7 +96,8 @@ public Dimension render(Graphics2D graphics)
{
return null;
}
final Point canvasPoint = Perspective.localToCanvas(client, localLocation, client.getTopLevelWorldView().getPlane(), height);
final Point canvasPoint = Perspective.localToCanvas(client, localLocation,
client.getTopLevelWorldView().getPlane(), height);
if (canvasPoint == null)
{
return null;
Expand Down
Loading
Loading