Skip to content

Commit ba81441

Browse files
committed
Merge branch 'dev'
# Conflicts: # src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java # src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java # src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java # src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java # src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java # src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java # src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java # src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/PostSetup.java
2 parents 80c157b + 00a0540 commit ba81441

719 files changed

Lines changed: 21603 additions & 12527 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.git-hooks/pre-commit

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
echo "[pre-commit check]"
4+
5+
if ! [ -x "$(command -v mvn)" ]; then
6+
echo -e 'Maven are not installed!'
7+
echo
8+
echo 'Please visit following site to download latest maven:'
9+
echo
10+
echo " https://maven.apache.org/download.cgi"
11+
echo
12+
echo 'If you are sure that you have installed maven,'
13+
echo 'Please check whether your environment variables is being set properly.'
14+
exit 1
15+
fi
16+
17+
spotless() {
18+
if [ ! -e "mvn" ]; then
19+
return 0
20+
fi
21+
22+
CHANGED_FILES="$(git --no-pager diff --name-status --no-color --cached | awk '$1 != "D" && $NF ~ /\.xml?$/ { print $NF }')"
23+
24+
if [ -z "$CHANGED_FILES" ]; then
25+
echo "No staged files."
26+
return 0
27+
fi
28+
29+
echo '[pre-commit] Executing Maven spotlessCheck before commit'
30+
31+
git stash --quiet --keep-index
32+
33+
mvn -B spotless:check
34+
35+
RESULT=$?
36+
37+
git stash pop -q
38+
39+
if [ "$RESULT" -ne "0" ]; then
40+
echo -e "spotlessCheck failed..."
41+
echo -e 'You can try "./mvn spotless:apply" to apply auto-fixes.'
42+
fi
43+
44+
return $RESULT
45+
}
46+
47+
if ! spotless; then
48+
exit 1
49+
fi
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will build a Java project with Maven
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33

4-
name: Slimefun Build Test
4+
name: Slimefun Builder
55

66
on:
77
push:
@@ -10,11 +10,6 @@ on:
1010
paths:
1111
- 'src/**'
1212
- 'pom.xml'
13-
pull_request:
14-
paths:
15-
- '.github/workflows/**'
16-
- 'src/**'
17-
- 'pom.xml'
1813
workflow_dispatch:
1914

2015
jobs:
@@ -28,21 +23,24 @@ jobs:
2823
java-version: 17
2924
java-package: jdk
3025
architecture: x64
31-
- run: mvn -B test --file pom.xml --errors
26+
- name: Codestyle Check
27+
run: mvn -B spotless:check -s $GITHUB_WORKSPACE/settings.xml --file pom.xml --errors
28+
- name: Build Slimefun
29+
run: mvn -B package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml --errors
3230
- uses: actions/cache@v2
33-
if: github.event_name != 'pull_request'
31+
name: Cache dependencies
3432
with:
3533
path: ~/.m2
3634
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3735
restore-keys: ${{ runner.os }}-m2
3836
- uses: actions/upload-artifact@v2
39-
if: github.event_name != 'pull_request'
37+
name: Upload Beta artifact
4038
with:
41-
name: Slimefun.jar
39+
name: Slimefun Beta Build
4240
path: staging
4341
- name: Automatic Releases
4442
uses: marvinpinto/action-automatic-releases@v1.2.1
45-
if: github.event_name != 'pull_request' && github.ref_name == 'master'
43+
if: github.ref_name == 'master'
4644
with:
4745
repo_token: "${{ secrets.GITHUB_TOKEN }}"
4846
automatic_release_tag: "exp"
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
1-
# This workflow will build a Java project with Maven
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3-
4-
name: Slimefun DEV
5-
6-
on:
7-
push:
8-
branches:
9-
- dev
10-
paths:
11-
- 'src/**'
12-
- 'pom.xml'
13-
workflow_dispatch:
14-
15-
jobs:
16-
build:
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@v3
20-
- uses: actions/setup-java@v3
21-
with:
22-
distribution: 'zulu'
23-
java-version: 17
24-
java-package: jdk
25-
architecture: x64
26-
cache: maven
27-
server-id: github
28-
settings-path: ${{ github.workspace }}
29-
- name: Build Slimefun
30-
if: github.event_name != 'pull_request'
31-
run: mvn -B package --file pom.xml --errors
32-
- name: Publish Slimefun
33-
if: github.event_name != 'pull_request'
34-
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml --file pom-github-package.xml --errors
35-
env:
36-
GITHUB_TOKEN: ${{ github.token }}
37-
- name: Mask Output
38-
if: github.event_name != 'pull_request'
39-
run: |
40-
echo "::add-mask::$CF_API_TOKEN"
41-
env:
42-
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
43-
- name: Find build artifact filename
44-
if: github.event_name != 'pull_request'
45-
run: |
46-
cd target && FILENAME=$(find . -maxdepth 1 -mindepth 1 -name "Slimefun-*" | cut -d'/' -f 2)
47-
echo "slimefun-artifact-name=$FILENAME" >> "$GITHUB_ENV"
48-
cd ..
49-
- name: Upload Build
50-
if: github.event_name != 'pull_request'
51-
uses: cloudflare/wrangler-action@2.0.0
52-
with:
53-
apiToken: ${{ secrets.CF_API_TOKEN }}
54-
command: "r2 object put slimefun-dev/${{ env.slimefun-artifact-name }} --file=./target/${{ env.slimefun-artifact-name }} --content-type=application/java-archive"
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: Slimefun DEV
5+
6+
on:
7+
push:
8+
branches:
9+
- dev
10+
paths:
11+
- 'src/**'
12+
- 'pom.xml'
13+
workflow_dispatch:
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: actions/setup-java@v3
24+
with:
25+
distribution: 'zulu'
26+
java-version: 17
27+
java-package: jdk
28+
architecture: x64
29+
cache: maven
30+
- name: Codestyle check
31+
run: mvn -B spotless:check --file pom.xml --errors
32+
- name: Build Slimefun
33+
run: mvn -B package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml --errors
34+
env:
35+
GITHUB_TOKEN: ${{ github.token }}
36+
- name: Publish Slimefun
37+
run: mvn -B deploy --file pom.xml --errors
38+
env:
39+
GITHUB_TOKEN: ${{ github.token }}
40+
- name: Mask Output
41+
run: |
42+
echo "::add-mask::$CF_API_TOKEN"
43+
env:
44+
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
45+
- name: Get build artifact filename
46+
run: |
47+
cd target && FILENAME=$(find . -maxdepth 1 -mindepth 1 -name "slimefun-*" | cut -d'/' -f 2)
48+
echo "slimefun-artifact-name=$FILENAME" >> "$GITHUB_ENV"
49+
cd ..
50+
- name: Upload Build to R2
51+
uses: cloudflare/wrangler-action@2.0.0
52+
with:
53+
apiToken: ${{ secrets.CF_API_TOKEN }}
54+
command: "r2 object put slimefun-dev/${{ env.slimefun-artifact-name }} --file=./target/${{ env.slimefun-artifact-name }} --content-type=application/java-archive"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Package Maintainer
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 17 * * *'
7+
8+
jobs:
9+
delete-package-versions:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/delete-package-versions@v4
13+
with:
14+
package-name: 'com.github.slimefun.slimefun'
15+
package-type: 'maven'
16+
min-versions-to-keep: 5

.github/workflows/pr-checker.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: Pull Request Checker
5+
6+
on:
7+
pull_request:
8+
paths:
9+
- '.github/workflows/**'
10+
- 'src/**'
11+
- 'pom.xml'
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-java@v2
19+
with:
20+
distribution: 'zulu'
21+
java-version: 17
22+
java-package: jdk
23+
architecture: x64
24+
- name: Codestyle Check
25+
run: mvn -B spotless:check build -s $GITHUB_WORKSPACE/settings.xml --file pom.xml --errors

CONTRIBUTING.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
>
1313
> 例如一个添加了新功能的提交应为 feat(item): add new item to Slimefun
1414
15-
此外, 推荐你使用 [gitmoji](https://gitmoji.dev/) 规范,但并不强制你使用。
16-
1715
如果你提交的代码中解决或处理了 Issue 中的问题,请你在主提交消息外显式声明。
1816

1917
> 如 resolves #114514, fix #114514
@@ -24,13 +22,16 @@
2422

2523
# 代码规范
2624

27-
**!! 本项目使用空格缩进 !!**
25+
**!! 本项目使用 4 空格缩进 !!**
2826

2927
请不要过度缩减代码长度, 空格少了 Slimefun 也不会因此跑得更快.
3028

29+
我们使用了 Spotless 作为代码格式化工具,你可以直接使用 `mvn spotless:check spotless:apply` 来自动格式化你的代码。
30+
3131
如果你希望你的代码被合并至官方, 请遵守 Slimefun 主仓库的 [提交规范](https://github.com/Slimefun/Slimefun4/blob/master/CONTRIBUTING.md)
3232

3333
# 提交代码类型
34+
3435
你提交的代码可以是修复、新增内容和 API。
3536

36-
下游代码现在支持提交 API 相关代码,开发者们可以通过 jitpack 依赖汉化版的 Slimefun。
37+
下游代码现在支持提交 API 相关代码,开发者们可以通过 jitpack/GitHub Package 依赖汉化版的 Slimefun。

0 commit comments

Comments
 (0)