Skip to content

Commit

Permalink
[v1.1.0] 修复权限判断异常的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmJos committed Jan 22, 2022
1 parent 5461063 commit ce3226e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>cc.carm.plugin</groupId>
<artifactId>moeteleport</artifactId>
<version>1.0.5</version>
<version>1.1.0</version>

<name>MoeTeleport</name>
<description>喵喵传送,简单的传送、设置家的插件。</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

public class PluginConfig {

public static final ConfigValueMap<String, Integer> PERMISSIONS = new ConfigValueMap<>(
"permissions", s -> s, Integer.class
public static final ConfigValueMap<Integer, String> PERMISSIONS = new ConfigValueMap<>(
"permissions", Integer::parseInt, String.class
);

public static final ConfigValueList<String> DANGEROUS_TYPES = new ConfigValueList<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,17 @@ public UserData getData(Player player) {
}

public int getMaxHome(Player player) {
Map<String, Integer> permissions = PluginConfig.PERMISSIONS.get();
int value = PluginConfig.DEFAULT_HOME.get();
for (Map.Entry<String, Integer> entry : permissions.entrySet()) {
if (entry.getValue() > value && player.hasPermission(
Main.getInstance().getName() + "." + entry.getKey()
Map<Integer, String> permissions = PluginConfig.PERMISSIONS.get();
int current = PluginConfig.DEFAULT_HOME.get();

for (Map.Entry<Integer, String> 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<UUID, UserData> getUserDataMap() {
Expand Down

0 comments on commit ce3226e

Please sign in to comment.