Skip to content

Commit

Permalink
[F] 修复无法读取权限的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmJos committed Dec 17, 2021
1 parent c7b0bf8 commit 5461063
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
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.4</version>
<version>1.0.5</version>

<name>MoeTeleport</name>
<description>喵喵传送,简单的传送、设置家的插件。</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -50,13 +49,13 @@ public Map<K, V> get() {
if (valueCache != null) return valueCache;
ConfigurationSection section = getConfiguration().getConfigurationSection(this.configSection);
if (section == null) return new LinkedHashMap<>();
Set<String> keys = getConfiguration().getKeys(false);
Set<String> keys = section.getKeys(false);
if (keys.isEmpty()) return new LinkedHashMap<>();
else {
LinkedHashMap<K, V> result = new LinkedHashMap<>();
for (String key : keys) {
K finalKey = keyCast.apply(key);
Object val = getConfiguration().get(this.configSection);
Object val = section.get(key);
V finalValue = this.valueClazz.isInstance(val) ? this.valueClazz.cast(val) : null;
if (finalKey != null && finalValue != null) {
result.put(finalKey, finalValue);
Expand All @@ -67,7 +66,8 @@ public Map<K, V> get() {
}
}

public void set(HashMap<K, V> valuesMap) {
public void set(LinkedHashMap<K, V> valuesMap) {
this.valueCache = valuesMap;
getConfiguration().createSection(this.configSection, valuesMap);
this.save();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defaultHome: 1
permissions:
# 以下命令全部为 MoeTeleport 的子节点
# 如 "home.vip" 的权限全拼就是 "MoeTeleport.home.vip"
"home.vip": 10 # 最多可以设置10个家
10: "home.vip" # 最多可以设置10个家

# 传送请求过期时间
expireTime: 30
Expand Down

0 comments on commit 5461063

Please sign in to comment.