Skip to content

Commit 19ec30b

Browse files
committed
API 3.0.0
1 parent 94567d0 commit 19ec30b

39 files changed

Lines changed: 237 additions & 160 deletions

.github/workflows/build.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build and Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
8+
branches:
9+
- '**'
10+
pull_request:
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
build-maven:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup Java
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: 'temurin'
28+
java-version: '21'
29+
30+
- name: Build with Maven
31+
run: mvn -B package -DskipTests=false -Darguments="-Dmaven.javadoc.skip=true"
32+
33+
- name: Read project metadata
34+
id: project
35+
shell: bash
36+
run: |
37+
ARTIFACT_ID=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)
38+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
39+
FINAL_NAME=$(mvn help:evaluate -Dexpression=project.build.finalName -q -DforceStdout)
40+
41+
echo "artifact_id=$ARTIFACT_ID" >> "$GITHUB_OUTPUT"
42+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
43+
echo "final_name=$FINAL_NAME" >> "$GITHUB_OUTPUT"
44+
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
45+
echo "jar_path=target/$FINAL_NAME.jar" >> "$GITHUB_OUTPUT"
46+
47+
- name: Verify artifact
48+
shell: bash
49+
run: |
50+
if [ ! -f "${{ steps.project.outputs.jar_path }}" ]; then
51+
echo "${{ steps.project.outputs.jar_path }} was not created"
52+
exit 1
53+
fi
54+
55+
- name: Upload artifacts
56+
uses: actions/upload-artifact@v4
57+
if: success()
58+
with:
59+
name: ${{ steps.project.outputs.artifact_id }}
60+
path: ${{ steps.project.outputs.jar_path }}
61+
62+
- name: Create GitHub release
63+
if: github.event_name == 'push' && (github.ref_type == 'tag' || github.ref_name == github.event.repository.default_branch)
64+
env:
65+
GH_TOKEN: ${{ github.token }}
66+
run: |
67+
if [ "${{ github.ref_type }}" = "tag" ]; then
68+
RELEASE_TAG="${{ github.ref_name }}"
69+
else
70+
RELEASE_TAG="${{ steps.project.outputs.tag }}"
71+
fi
72+
73+
if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
74+
gh release upload "$RELEASE_TAG" "${{ steps.project.outputs.jar_path }}" --clobber
75+
else
76+
gh release create "$RELEASE_TAG" "${{ steps.project.outputs.jar_path }}" --target "${{ github.sha }}" --title "$RELEASE_TAG" --notes "Automated release for $RELEASE_TAG"
77+
fi

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>sergeydertan.sregionprotector</groupId>
88
<artifactId>SRegionProtector</artifactId>
9-
<version>30.0</version>
9+
<version>30.1</version>
1010
<name>SRegionProtector</name>
1111
<description>Flexible region protection plugin for PowerNukkitX</description>
1212
<url>https://github.com/SergeyDertan/SRegionProtector</url>
@@ -65,7 +65,7 @@
6565
<dependency>
6666
<groupId>org.powernukkitx</groupId>
6767
<artifactId>server</artifactId>
68-
<version>2.0.0-SNAPSHOT</version>
68+
<version>b-migration-SNAPSHOT</version>
6969
<scope>provided</scope>
7070
</dependency>
7171
<dependency>
@@ -126,6 +126,7 @@
126126
</repository>
127127
</distributionManagement>
128128
<build>
129+
<finalName>SRegionProtector</finalName>
129130
<defaultGoal>install</defaultGoal>
130131
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
131132
<plugins>

src/main/java/Sergey_Dertan/SRegionProtector/BlockEntity/BlockEntityHealer.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ public CompoundTag getSpawnCompound() {
7878

7979
@Override
8080
public void saveNBT() {
81-
this.namedTag.putString(ID_TAG, BLOCK_ENTITY_HEALER);
82-
this.namedTag.putString(REGION_TAG, this.region);
83-
this.namedTag.putInt(X_TAG, this.getFloorX());
84-
this.namedTag.putInt(Y_TAG, this.getFloorY());
85-
this.namedTag.putInt(Z_TAG, this.getFloorZ());
86-
this.namedTag.putBoolean(IS_MOVABLE_TAG, false);
81+
this.nbt.putString(ID_TAG, BLOCK_ENTITY_HEALER);
82+
this.nbt.putString(REGION_TAG, this.region);
83+
this.nbt.putInt(X_TAG, this.getFloorX());
84+
this.nbt.putInt(Y_TAG, this.getFloorY());
85+
this.nbt.putInt(Z_TAG, this.getFloorZ());
86+
this.nbt.putBoolean(IS_MOVABLE_TAG, false);
8787
}
8888

8989
@Override

src/main/java/Sergey_Dertan/SRegionProtector/Command/Creation/CreateRegionCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Sergey_Dertan.SRegionProtector.Settings.RegionSettings;
1010
import cn.nukkit.Player;
1111
import cn.nukkit.command.CommandSender;
12-
import cn.nukkit.command.data.CommandParamType;
12+
import org.cloudburstmc.protocol.bedrock.data.command.CommandParamType;
1313
import cn.nukkit.command.data.CommandParameter;
1414
import cn.nukkit.level.Position;
1515
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
@@ -33,7 +33,7 @@ public CreateRegionCommand(RegionSelector selector, RegionManager regionManager,
3333
this.pricePerBlock = pricePerBlock;
3434

3535
Map<String, CommandParameter[]> parameters = new Object2ObjectArrayMap<>();
36-
parameters.put("rgname", new CommandParameter[]{CommandParameter.newType("region", CommandParamType.STRING)});
36+
parameters.put("rgname", new CommandParameter[]{CommandParameter.newType("region", CommandParamType.ID)});
3737
this.setCommandParameters(parameters);
3838
}
3939

src/main/java/Sergey_Dertan/SRegionProtector/Command/Creation/Pos1Command.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import Sergey_Dertan.SRegionProtector.Region.Selector.RegionSelector;
55
import cn.nukkit.Player;
66
import cn.nukkit.command.CommandSender;
7-
import cn.nukkit.command.data.CommandParamType;
7+
import org.cloudburstmc.protocol.bedrock.data.command.CommandParamType;
88
import cn.nukkit.command.data.CommandParameter;
99
import cn.nukkit.level.Position;
1010
import cn.nukkit.math.Vector3;

src/main/java/Sergey_Dertan/SRegionProtector/Command/Creation/Pos2Command.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import Sergey_Dertan.SRegionProtector.Region.Selector.RegionSelector;
55
import cn.nukkit.Player;
66
import cn.nukkit.command.CommandSender;
7-
import cn.nukkit.command.data.CommandParamType;
7+
import org.cloudburstmc.protocol.bedrock.data.command.CommandParamType;
88
import cn.nukkit.command.data.CommandParameter;
99
import cn.nukkit.level.Position;
1010
import cn.nukkit.math.Vector3;

src/main/java/Sergey_Dertan/SRegionProtector/Command/Creation/RegionExpandCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Sergey_Dertan.SRegionProtector.Region.Selector.SelectorSession;
66
import cn.nukkit.Player;
77
import cn.nukkit.command.CommandSender;
8-
import cn.nukkit.command.data.CommandParamType;
8+
import org.cloudburstmc.protocol.bedrock.data.command.CommandParamType;
99
import cn.nukkit.command.data.CommandParameter;
1010
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
1111

src/main/java/Sergey_Dertan/SRegionProtector/Command/Manage/CopyFlagsCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Sergey_Dertan.SRegionProtector.Region.Region;
66
import Sergey_Dertan.SRegionProtector.Region.RegionManager;
77
import cn.nukkit.command.CommandSender;
8-
import cn.nukkit.command.data.CommandParamType;
8+
import org.cloudburstmc.protocol.bedrock.data.command.CommandParamType;
99
import cn.nukkit.command.data.CommandParameter;
1010
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
1111

@@ -22,8 +22,8 @@ public CopyFlagsCommand(RegionManager regionManager) {
2222
Map<String, CommandParameter[]> parameters = new Object2ObjectArrayMap<>();
2323
parameters.put("copyflags", new CommandParameter[]
2424
{
25-
CommandParameter.newType("source", CommandParamType.STRING),
26-
CommandParameter.newType("target", CommandParamType.STRING)
25+
CommandParameter.newType("source", CommandParamType.ID),
26+
CommandParameter.newType("target", CommandParamType.ID)
2727
}
2828
);
2929
this.setCommandParameters(parameters);

src/main/java/Sergey_Dertan/SRegionProtector/Command/Manage/Group/AddMemberCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Sergey_Dertan.SRegionProtector.Region.RegionManager;
66
import cn.nukkit.Player;
77
import cn.nukkit.command.CommandSender;
8-
import cn.nukkit.command.data.CommandParamType;
8+
import org.cloudburstmc.protocol.bedrock.data.command.CommandParamType;
99
import cn.nukkit.command.data.CommandParameter;
1010
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
1111

@@ -22,8 +22,8 @@ public AddMemberCommand(RegionManager regionManager) {
2222
Map<String, CommandParameter[]> parameters = new Object2ObjectArrayMap<>();
2323
parameters.put("addmember", new CommandParameter[]
2424
{
25-
CommandParameter.newType("region", CommandParamType.STRING),
26-
CommandParameter.newType("player", CommandParamType.TARGET)
25+
CommandParameter.newType("region", CommandParamType.ID),
26+
CommandParameter.newType("player", CommandParamType.SELECTION)
2727
}
2828
);
2929
this.setCommandParameters(parameters);

src/main/java/Sergey_Dertan/SRegionProtector/Command/Manage/Group/AddOwnerCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Sergey_Dertan.SRegionProtector.Region.RegionManager;
66
import cn.nukkit.Player;
77
import cn.nukkit.command.CommandSender;
8-
import cn.nukkit.command.data.CommandParamType;
8+
import org.cloudburstmc.protocol.bedrock.data.command.CommandParamType;
99
import cn.nukkit.command.data.CommandParameter;
1010
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
1111

@@ -22,8 +22,8 @@ public AddOwnerCommand(RegionManager regionManager) {
2222
Map<String, CommandParameter[]> parameters = new Object2ObjectArrayMap<>();
2323
parameters.put("addowner", new CommandParameter[]
2424
{
25-
CommandParameter.newType("region", CommandParamType.STRING),
26-
CommandParameter.newType("player", CommandParamType.TARGET)
25+
CommandParameter.newType("region", CommandParamType.ID),
26+
CommandParameter.newType("player", CommandParamType.SELECTION)
2727
}
2828
);
2929
this.setCommandParameters(parameters);

0 commit comments

Comments
 (0)