Skip to content

Commit

Permalink
Merge remote-tracking branch 'hannibal/beta' into dungeon-floor-as-enum
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt
  • Loading branch information
martimavocado committed Jun 15, 2024
2 parents 345834b + 8c91a9b commit 16dd528
Show file tree
Hide file tree
Showing 494 changed files with 9,181 additions and 5,266 deletions.
42 changes: 35 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,46 @@ ij_any_block_comment_add_space = true
ij_any_line_comment_add_space = true

# Max line length
max_line_length = 120
max_line_length = 140

# Java Files
[*.java]
# Java files should not use wildcard imports
ij_java_names_count_to_use_import_on_demand = 999
ij_java_class_count_to_use_import_on_demand = 999
ij_java_packages_to_use_import_on_demand = 999
ij_java_names_count_to_use_import_on_demand = 2147483647
ij_java_class_count_to_use_import_on_demand = 2147483647
ij_java_packages_to_use_import_on_demand = 2147483647

[*.kt]
ktlint_code_style = intellij_idea

# Kotlin files should not use wildcard imports
ij_kotlin_name_count_to_use_star_import = 999
ij_kotlin_name_count_to_use_star_import_for_members = 999
ij_kotlin_packages_to_use_import_on_demand = 999
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
ij_kotlin_enum_constants_wrap = split_into_lines
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_allow_trailing_comma = true
ij_kotlin_packages_to_use_import_on_demand = unset
ktlint_standard_chain-wrapping = always

ktlint_standard_multiline-if-else = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_no-single-line-block-comment = disabled
ktlint_standard_no-blank-line-before-rbrace = disabled
ktlint_standard_no-consecutive-blank-lines = disabled
ktlint_standard_no-empty-first-line-in-method-block = disabled
ktlint_standard_comment-spacing = disabled
ktlint_standard_string-template = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_context-receiver-wrapping = disabled
ktlint_standard_multiline-expression-wrapping = false
ktlint_standard_string-template-indent = disabled
ktlint_standard_no-trailing-spaces = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_wrapping = disabled
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_final-newline = disabled

ktlint_standard_no-wildcard-imports = enabled
ktlint_standard_function-expression-body = disabled
16 changes: 16 additions & 0 deletions .github/workflows/check-style.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: check-style
on:
- pull_request
jobs:
ktlint:
name: Check Style
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
name: Checkout code
- name: ktlint
uses: ScaCap/action-ktlint@master
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.idea/*
# Use **/*.* since if a directory is ignored, children of that directory *cannot* be unignored using ! again.
.idea/**/*.*
!.idea/icon.svg
!.idea/dictionaries/default_user.xml
!.idea/scopes/Mixins.xml
.vscode/
run/
build/
Expand Down
27 changes: 27 additions & 0 deletions .idea/dictionaries/default_user.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/scopes/Mixins.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions .live-plugins/event/plugin.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import com.intellij.codeInspection.LocalQuickFix
import com.intellij.codeInspection.ProblemDescriptor
import com.intellij.codeInspection.ProblemHighlightType
import com.intellij.codeInspection.ProblemsHolder
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElementVisitor
import liveplugin.registerInspection
import org.jetbrains.kotlin.idea.base.utils.fqname.fqName
import org.jetbrains.kotlin.idea.codeinsight.api.classic.inspections.AbstractKotlinInspection
import org.jetbrains.kotlin.idea.util.AnnotationModificationHelper
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.nj2k.postProcessing.type
import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.psi.KtVisitorVoid
import org.jetbrains.kotlin.psi.psiUtil.isPublic
import org.jetbrains.kotlin.types.typeUtil.supertypes

// depends-on-plugin org.jetbrains.kotlin

val skyhanniEvent = "at.hannibal2.skyhanni.api.event.SkyHanniEvent"
val handleEvent = "HandleEvent"

registerInspection(HandleEventInspectionKotlin())

class HandleEventInspectionKotlin : AbstractKotlinInspection() {
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {

val visitor = object : KtVisitorVoid() {
override fun visitNamedFunction(function: KtNamedFunction) {
val hasEventAnnotation = function.annotationEntries.any { it.shortName!!.asString() == handleEvent }
val isEvent = function.valueParameters.firstOrNull()?.type()?.supertypes()
?.any { it.fqName?.asString() == skyhanniEvent } ?: false

if (isEvent && !hasEventAnnotation && function.valueParameters.size == 1 && function.isPublic) {
holder.registerProblem(
function,
"Event handler function should be annotated with @HandleEvent",
HandleEventQuickFix()
)
} else if (!isEvent && hasEventAnnotation) {
holder.registerProblem(
function,
"Function should not be annotated with @HandleEvent if it does not take a SkyHanniEvent",
ProblemHighlightType.GENERIC_ERROR
)
}
}
}

return visitor
}

override fun getDisplayName() = "Event handler function should be annotated with @HandleEvent"
override fun getShortName() = "HandleEventInspection"
override fun getGroupDisplayName() = "SkyHanni"
override fun isEnabledByDefault() = true
}

class HandleEventQuickFix : LocalQuickFix {
override fun applyFix(project: Project, descriptor: ProblemDescriptor) {
val function = descriptor.psiElement as KtNamedFunction
AnnotationModificationHelper.addAnnotation(
function,
FqName("at.hannibal2.skyhanni.api.event.HandleEvent"),
null,
null,
{ null },
" ",
null
)
}

override fun getName() = "Annotate with @HandleEvent"

override fun getFamilyName() = name
}
2 changes: 0 additions & 2 deletions .live-plugins/module/plugin.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.intellij.codeInspection.ProblemsHolder
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElementVisitor
import liveplugin.registerInspection
import liveplugin.show
import org.jetbrains.kotlin.idea.base.utils.fqname.fqName
import org.jetbrains.kotlin.idea.codeinsight.api.classic.inspections.AbstractKotlinInspection
import org.jetbrains.kotlin.idea.util.AnnotationModificationHelper
Expand Down Expand Up @@ -91,7 +90,6 @@ class ModuleQuickFix : LocalQuickFix {
" ",
null
)
show("Annotation applied, make sure SkyHanniMod isn't still loading this module")
}

override fun getName() = "Annotate with @SkyHanniModule"
Expand Down
18 changes: 7 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ follow [their guide](https://github.com/NotEnoughUpdates/NotEnoughUpdates/blob/m

If you are not very familiar with git, you might want to try this out: https://learngitbranching.js.org/.

_An explanation how to use intellij and branches will follow here soon.
_An explanation how to use intellij and branches will follow here soon._

Please use a prefix for the name of the PR (E.g. Feature, Fix, Backend, Change).
Please use a prefix for the name of the PR (E.g. Feature, Improvement, Fix, Backend, ...).

You can write in the description of the pr the wording for the changelog as well (optional).
When writing the description of the PR, ensure you fill out the template with the necessary information, including the "WHAT" section, and the changelog entries.

If your PR relies on another PR, please include this information at the beginning of the description. Consider using a
format like "- #821" to illustrate the dependency.
Expand Down Expand Up @@ -81,8 +81,8 @@ format like "- #821" to illustrate the dependency.
- Replace it with `?:` (if null return this).
- This will most likely not be possible to avoid when working with objects from java.
- Don't forget to add `@FeatureToggle` to new standalone features (not options to that feature) in the config.
- Do not use `e.printStackTrace()`, use `CopyErrorCommand.logError(e, "explanation for users")` instead.
- Do not use `MinecraftForge.EVENT_BUS.post(event)`, use `event.postAndCatch()` instead.
- Do not use `e.printStackTrace()`, use `ErrorManager.logErrorWithData(error, "explanation for users", ...extraOptionalData)` instead.
- Do not use `MinecraftForge.EVENT_BUS.post(event)`, use `event.post()` instead.
- Do not use `toRegex()` or `toPattern()`, use `RepoPattern` instead.
- See [RepoPattern.kt](https://github.com/hannibal002/SkyHanni/blob/beta/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt)
for more information and usages.
Expand All @@ -106,20 +106,16 @@ This start script will automatically download all required libraries.

### NotEnoughUpdates

SkyHanni requires NEU.
SkyHanni requires **[NotEnoughUpdates](https://github.com/NotEnoughUpdates/NotEnoughUpdates/)**.
We use NEU to get auction house and bazaar price data for items and to read
the [NEU Item Repo](https://github.com/NotEnoughUpdates/NotEnoughUpdates-REPO) for item internal names, display names
and recipes.

For more information, see https://github.com/NotEnoughUpdates/NotEnoughUpdates

### Config

SkyHanni stores the config (settings and user data) as a json object in a single text file.
For rendering the /sh config (categories, toggles, search, etc.),
SkyHanni uses **MoulConfig**, the same config system as NotEnoughUpdates.

For more information, see https://github.com/NotEnoughUpdates/MoulConfig
SkyHanni uses **[MoulConfig](https://github.com/NotEnoughUpdates/MoulConfig)**, the same config system as NotEnoughUpdates.

### Elite Farmers API

Expand Down
Loading

0 comments on commit 16dd528

Please sign in to comment.