diff --git a/.github/workflows/close_invalid_prs.yml b/.github/workflows/close_invalid_prs.yml new file mode 100644 index 0000000..9064b67 --- /dev/null +++ b/.github/workflows/close_invalid_prs.yml @@ -0,0 +1,18 @@ +# Thanks paper: https://github.com/papermc/paper/blob/master/.github/workflows/close_invalid_prs.yml +name: Close invalid PRs + +on: + pull_request_target: + types: [ opened ] + +jobs: + run: + if: ${{ github.repository != github.event.pull_request.head.repo.full_name && github.head_ref == 'master' }} + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + id: "master_branch" + if: github.head_ref == 'master' + with: + comment: | + Hi there! :wave: This PR is targeting the `master` branch, which is not allowed. Please target the `develop` branch instead. Thanks! \ No newline at end of file diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml new file mode 100644 index 0000000..f682d7c --- /dev/null +++ b/.github/workflows/test-pr.yml @@ -0,0 +1,24 @@ +name: Test PR +on: [pull_request] +jobs: + build_pr: + if: github.repository_owner == 'theEvilReaper' + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v3 + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + - name: Build with ${{ matrix.os }} + run: | + git config --global user.email "no-reply@github.com" + git config --global user.name "Github Actions" + ./gradlew test diff --git a/README.md b/README.md index 8ec0a9e..27e4f11 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,24 @@ # Canis -Canis is a project which includes several implementations of BlockHandlers for Minestom. +[![license](https://img.shields.io/github/license/theEvilReaper/Canis?style=for-the-badge&color=b22234c)](../LICENSE) + +The fundamental objective of this project is to develop multiple implementations of `BlockHandler` for the Microtus +project, which is built on the Minestom framework. The specific functionalities provided by the pre-implemented handlers +are contingent upon the requirements of the application. For instance, one implementation may permit only read access to +block data, while another may allow for both reading and modifying this data. It is important to note that this project +does not aim to replicate the vanilla mechanics of Minecraft; rather, it serves as a utility to facilitate basic data +reading from blocks, particularly in the context of mini-games. + +> [!IMPORTANT] +> Due to other projects taking priority, this project may look like it not being maintained. +> However every pull request is welcome to enhance the functionality of this project. ## Usage -You can use this project as Gradle dependency: + +The project is currently available over the **Jitpack** repository. +Currently, there is not really versioning, so the required version is `master-SNAPSHOT`. + +If you are using `Gradle` as your preferred build system, you can add the following lines to your `build.gradle` file. ```gradle repositories { @@ -13,4 +28,7 @@ repositories { dependencies { implementation("com.github.theEvilReaper:Canis:master-SNAPSHOT") } -``` \ No newline at end of file +``` + +> [!NOTE] +> In the future it's planned to release the project via the central maven repository. \ No newline at end of file diff --git a/gradlew.bat b/gradlew.bat index 9b42019..9d21a21 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,94 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/renovate.json b/renovate.json index 81b5ec8..bd6dc2d 100644 --- a/renovate.json +++ b/renovate.json @@ -3,5 +3,35 @@ "extends": [ "config:base" ], - "baseBranches": ["dev"] + "baseBranches": [ + "dev" + ], + "packageRules": [ + { + "matchUpdateTypes": [ + "patch" + ], + "automerge": true, + "automergeType": "branch", + "groupName": "patch", + "schedule": [ + "after 10pm and before 6:00am every day" + ] + }, + { + "matchUpdateTypes": [ + "minor" + ], + "automerge": false, + "schedule": [ + "before 6:00am every friday" + ] + } + ], + "vulnerabilityAlerts": { + "labels": [ + "Component::security" + ], + "automerge": true + } }