From ce3226ee18887e5415b1c886bbd5ec30a157ef60 Mon Sep 17 00:00:00 2001 From: carm Date: Sat, 22 Jan 2022 18:45:19 +0800 Subject: [PATCH] =?UTF-8?q?[v1.1.0]=20=E4=BF=AE=E5=A4=8D=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 38 +++++++++++++++++++ pom.xml | 2 +- .../configuration/PluginConfig.java | 4 +- .../moeteleport/manager/UserManager.java | 15 ++++---- 4 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2b943ca --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release Version + +on: + release: + types: + - published # 创建release的时候触发 + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: "Set up JDK" + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + cache: maven + server-id: github + server-username: MAVEN_USERNAME + server-password: MAVEN_TOKEN + - name: "Package" + run: mvn -B package --file pom.xml -Dmaven.javadoc.skip=true -DskipTests + env: + MAVEN_USERNAME: ${{ github.repository_owner }} + MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: "Upload Release Asset" + id: upload-release-asset + uses: shogo82148/actions-upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: asset/*.jar + asset_content_type: application/java-archive \ No newline at end of file diff --git a/pom.xml b/pom.xml index 8b3ca50..81b9928 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ cc.carm.plugin moeteleport - 1.0.5 + 1.1.0 MoeTeleport 喵喵传送,简单的传送、设置家的插件。 diff --git a/src/main/java/cc/carm/plugin/moeteleport/configuration/PluginConfig.java b/src/main/java/cc/carm/plugin/moeteleport/configuration/PluginConfig.java index 5f152ad..0c3f6fd 100644 --- a/src/main/java/cc/carm/plugin/moeteleport/configuration/PluginConfig.java +++ b/src/main/java/cc/carm/plugin/moeteleport/configuration/PluginConfig.java @@ -6,8 +6,8 @@ public class PluginConfig { - public static final ConfigValueMap PERMISSIONS = new ConfigValueMap<>( - "permissions", s -> s, Integer.class + public static final ConfigValueMap PERMISSIONS = new ConfigValueMap<>( + "permissions", Integer::parseInt, String.class ); public static final ConfigValueList DANGEROUS_TYPES = new ConfigValueList<>( diff --git a/src/main/java/cc/carm/plugin/moeteleport/manager/UserManager.java b/src/main/java/cc/carm/plugin/moeteleport/manager/UserManager.java index b87f035..a74b614 100644 --- a/src/main/java/cc/carm/plugin/moeteleport/manager/UserManager.java +++ b/src/main/java/cc/carm/plugin/moeteleport/manager/UserManager.java @@ -41,16 +41,17 @@ public UserData getData(Player player) { } public int getMaxHome(Player player) { - Map permissions = PluginConfig.PERMISSIONS.get(); - int value = PluginConfig.DEFAULT_HOME.get(); - for (Map.Entry entry : permissions.entrySet()) { - if (entry.getValue() > value && player.hasPermission( - Main.getInstance().getName() + "." + entry.getKey() + Map permissions = PluginConfig.PERMISSIONS.get(); + int current = PluginConfig.DEFAULT_HOME.get(); + + for (Map.Entry entry : permissions.entrySet()) { + if (entry.getKey() > current && player.hasPermission( + Main.getInstance().getName() + "." + entry.getValue() )) { - value = entry.getValue(); + current = entry.getKey(); } } - return value; + return current; } public HashMap getUserDataMap() {