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
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true
ij_continuation_indent_size = 4
[*.java]
ij_java_class_count_to_use_import_on_demand = 1024
ij_java_names_count_to_use_import_on_demand = 1024
[*.yml]
indent_size = 2
[*.json]
indent_size = 2
[*.md]
trim_trailing_whitespace=false
[*.sk]
indent_style = tab
12 changes: 12 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("java")
id("maven-publish")
id("checkstyle")
}
group = "com.github.SkriptDev"
version = "1.0.6"
Expand Down Expand Up @@ -56,6 +57,17 @@ tasks {
java {
withSourcesJar()
}
checkstyle {
// Specify the version of the Checkstyle tool to use
toolVersion = "10.21.0" // Use a recent version of Checkstyle

isIgnoreFailures = false

// Point to your custom Checkstyle configuration file
// The default location is config/checkstyle/checkstyleMain.xml
configFile = file("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
}

publishing {
publications {
create<MavenPublication>("maven") {
Expand Down
62 changes: 62 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">



<module name="Checker">
<module name="LineLength">
<property name="max" value="300"/>
</module>
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<property name="fileExtensions" value="java, properties, xml"/>

<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<module name="TreeWalker">
<module name="RegexpSinglelineJava">
<property name="format" value="\t"/>
<property name="message" value="Tab characters are not allowed in code."/>
<property name="ignoreComments" value="true"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="OK TO COMMENT"/>
<property name="checkFormat" value=".*"/>
</module>
<module name="AnnotationLocation">
<property name="id" value="AnnotationLocationMostCases"/>
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
</module>

<module name="LeftCurly"/>
<module name="RightCurly"/>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
</module>

<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-z0-9]*)*$"/>
</module>
<module name="TypeName"/>
<module name="MemberName"/>
<module name="ParameterName"/>
<module name="LocalVariableName"/>

<module name="AvoidStarImport"/>
<module name="UnusedImports"/>
<module name="RedundantImport"/>

<module name="EmptyStatement"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<property name="tabWidth" value="4"/>
</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public Optional<? extends Statement> walk(TriggerContext ctx) {
? ((SelfReferencing) val).getActualNext()
: val.getNext());

// Because otherwise SelfReferencing sections will first reference to themselves
// Because otherwise SelfReferencing sections will getFirst reference to themselves
if (current.filter(val -> val instanceof Finishing).isEmpty())
am--;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ public class EffExit extends Effect {
"(exit|stop) %*integer% (0:section|1:loop|2:condition[al])[s]",
"(exit|stop) (every|all [[of] the]) (0:section|1:loop|2:condition[al])[s]")
.name("Exit")
.description("Exits the entire trigger, preventing all upcoming statements to not get triggered. There's also a possibility to only exit certain sections. If more sections are exited than the total amount of nested sections, the trigger will stop. Note that stopping loops also stops while-loops.")
.description("Exits the entire trigger, preventing all upcoming statements to not get triggered",
"There's also a possibility to only exit certain sections.",
"If more sections are exited than the total amount of nested sections, the trigger will stop.",
"Note that stopping loops also stops while-loops.")
.since("1.0.0")
.register();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public Optional<? extends Statement> walk(TriggerContext ctx) {
});
if (isInFunction) {
FunctionContext functionContext = (FunctionContext) ctx;
Function<?> function = functionContext.getOwningFunction();
Function<?> function = functionContext.owningFunction();
function.setReturnValue(returned.getValues(ctx));
return Optional.empty(); // stop the trigger
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

public class CondExprChance extends ConditionalExpression {

private static final ThreadLocalRandom RANDOM = ThreadLocalRandom.current();

static {
Parser.getMainRegistration().newExpression(CondExprChance.class, Boolean.class,
true, "chance of %number%[1:\\%]")
Expand All @@ -22,8 +24,6 @@ public class CondExprChance extends ConditionalExpression {
.register();
}

private static final ThreadLocalRandom RANDOM = ThreadLocalRandom.current();

private Expression<Number> chance;
private boolean percent;

Expand Down
Loading
Loading