diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..941d18c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*] +charset = utf-8 +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{kt,kts}] +ktlint_code_style = intellij_idea + +[*{.yml,yaml}] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/build-workflow.yml b/.github/workflows/build-workflow.yml new file mode 100644 index 0000000..4a2c855 --- /dev/null +++ b/.github/workflows/build-workflow.yml @@ -0,0 +1,37 @@ +name: Build +on: + workflow_call: + outputs: + version: + description: Built version + value: ${{ jobs.build.outputs.version }} + +jobs: + build: + name: Gradle Build + runs-on: ubuntu-24.04 + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Gradle Build + run: ./gradlew build shadowJar + - name: Get Version + id: version + run: echo "version=$(./gradlew --console plain --quiet currentVersion -Prelease.quiet)" >> $GITHUB_OUTPUT + - name: Upload build + uses: actions/upload-artifact@v4 + with: + name: build + path: build/libs/*.jar + retention-days: 7 + if-no-files-found: error diff --git a/.github/workflows/create-version.yml b/.github/workflows/create-version.yml new file mode 100644 index 0000000..5697840 --- /dev/null +++ b/.github/workflows/create-version.yml @@ -0,0 +1,42 @@ +name: Create Version + +on: + workflow_dispatch: + inputs: + versionIncrementer: + type: choice + description: Override the default version incrementer according to https://axion-release-plugin.readthedocs.io/en/latest/configuration/version/#incrementing + default: default + options: + - default + - incrementPatch + - incrementMinor + - incrementMajor + - incrementPrerelease + +jobs: + release: + name: Gradle Release + runs-on: ubuntu-24.04 + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v4 + with: + ssh-key: "${{ secrets.COMMIT_KEY }}" + fetch-depth: 0 + - uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.COMMIT_KEY }} + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + - uses: gradle/actions/setup-gradle@v4 + - name: Gradle Release + if: ${{ inputs.versionIncrementer == 'default' }} + run: ./gradlew release + - name: Gradle Release w/ Increment Override + if: ${{ inputs.versionIncrementer != 'default' }} + run: ./gradlew release -Prelease.versionIncrementer=${{ inputs.versionIncrementer }} diff --git a/.github/workflows/pr-workflow.yml b/.github/workflows/pr-workflow.yml index 6661a7c..28d2147 100644 --- a/.github/workflows/pr-workflow.yml +++ b/.github/workflows/pr-workflow.yml @@ -3,23 +3,4 @@ on: pull_request jobs: build: - name: Gradle Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-java@v1 - with: - java-version: 11 - - uses: actions/cache@v1 - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - uses: actions/cache@v1 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle-caches- - - uses: eskatos/gradle-command-action@v1 - with: - arguments: build + uses: ./.github/workflows/build-workflow.yml diff --git a/.github/workflows/publish-workflow.yml b/.github/workflows/publish-workflow.yml new file mode 100644 index 0000000..2af66dc --- /dev/null +++ b/.github/workflows/publish-workflow.yml @@ -0,0 +1,32 @@ +name: Publish +on: + push: + branches: ['master', 'main'] + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + build: + uses: ./.github/workflows/build-workflow.yml + release: + needs: build + name: Create Release + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - name: Download build + uses: actions/download-artifact@v4 + with: + name: build + path: build + - name: Release + uses: docker://antonyurchenko/git-release:v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_NAME: ${{ needs.build.outputs.version }} + PRE_RELEASE: ${{ github.ref_type == 'branch' }} + UNRELEASED: ${{ github.ref_type == 'branch' && 'update' || '' }} + UNRELEASED_TAG: latest-snapshot + ALLOW_EMPTY_CHANGELOG: ${{ github.ref_type == 'branch' && 'true' || 'false' }} + with: + args: build/*.jar diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml deleted file mode 100644 index 05d8f9e..0000000 --- a/.github/workflows/release-workflow.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release -on: - push: - tags: - - 'release-*' - -jobs: - release: - name: Create Release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Gradle Build - uses: eskatos/gradle-command-action@v1 - with: - arguments: build - - name: Extract version - uses: frabert/replace-string-action@master - id: format-version - with: - pattern: 'refs/tags/release-([0-9]+.[0-9]+.[0-9]+)' - string: ${{ github.ref }} - replace-with: '$1' - - name: Release - uses: docker://antonyurchenko/git-release:v3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DRAFT_RELEASE: "true" - ALLOW_TAG_PREFIX: "true" - with: - args: | - build/libs/simpleannounce-${{ steps.format-version.outputs.replaced }}.jar - build/libs/simpleannounce-${{ steps.format-version.outputs.replaced }}-nokt.jar diff --git a/.gitignore b/.gitignore index a16a5c2..327cf6d 100755 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,53 @@ -# Created by https://www.gitignore.io/api/intellij,java,gradle - -### Intellij ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android -Studio and Webstorm - -*.iml - -## Directory-based project format: -.idea/ -# if you remove the above rule, at least ignore the following: - -# User-specific stuff: -# .idea/workspace.xml -# .idea/tasks.xml -# .idea/dictionaries -# .idea/shelf - -# Sensitive or high-churn files: -# .idea/dataSources.ids -# .idea/dataSources.xml -# .idea/sqlDataSources.xml -# .idea/dynamic.xml -# .idea/uiDesigner.xml - -# Gradle: -# .idea/gradle.xml -# .idea/libraries - -# Mongo Explorer plugin: -# .idea/mongoSettings.xml - -## File-based project format: -*.ipr +# Created by https://www.gitignore.io/api/gradle,intellij+all +# Edit at https://www.gitignore.io/?templates=gradle,intellij+all + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format *.iws -## Plugin-specific files: - # IntelliJ -/out/ +out/ # mpeltonen/sbt-idea plugin .idea_modules/ @@ -46,31 +55,37 @@ Studio and Webstorm # JIRA plugin atlassian-ide-plugin.xml +# Cursive Clojure plugin +.idea/replstate.xml + # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties +# Editor-based Rest Client +.idea/httpRequests -### Java ### -*.class +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser -# Mobile Tools for Java (J2ME) -.mtj.tmp/ +### Intellij+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 -# Package Files # -*.jar -*.war -*.ear +.idea/ -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 +*.iml +modules.xml +.idea/misc.xml +*.ipr ### Gradle ### .gradle -build/ +/build/ # Ignore Gradle GUI config gradle-app.setting @@ -80,3 +95,11 @@ gradle-app.setting # Cache of project .gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +### Gradle Patch ### +**/build/ + +# End of https://www.gitignore.io/api/gradle,intellij+all diff --git a/CHANGELOG.md b/CHANGELOG.md index bf4c458..2164a92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Changelog ## [Unreleased] +### Added +- MIT license + +### Changed +- MC 1.21, Java 21, Kotlin 2.1 + +### Fixed +- Config Auto-reload is now a repeating task as intended +- Config actually created on first run +- Copy updated default header when config is updated ## [1.0.0] - 2020-02-10 ### Added @@ -16,4 +26,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). [Unreleased]: https://github.com/SimpleMC/SimpleAnnounce/compare/release-1.0.0...HEAD -[1.0.0]: https://github.com/SimpleMC/SimpleAnnounce/releases/tag/release-1.0.0 \ No newline at end of file +[1.0.0]: https://github.com/SimpleMC/SimpleAnnounce/releases/tag/release-1.0.0 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b8f94e9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 SimpleMC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index ef3dba7..64e3c79 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,82 @@ -SimpleAnnounce -============== +# SimpleAnnounce SimpleAnnounce is a simple and easy to use, yet powerful automated announcement plugin for the Bukkit Minecraft API. + +Messages can be sent server-wide or controlled by permissions after a delay and optionally repeated after an interval. + +## Features + +- Timed server-wide announcements/news messages +- Easily configurable +- Configure one-time or repeating messages +- Extensive Permissions support - configure messages to only send to users including or excluding certain permission nodes +- Optional debug mode to track down who is/isn't receiving messages and why +- Automatic config reloading to get new messages +- `/simpleannouncereload` or `/sar` to reload on command! + - Permissions: `simpleannounce.reload` + +## Configuration + +Format: +```yaml +config-version(int): **DO NOT EDIT**, used to migrate configurations as the format changes +auto-reloadconfig(int):