mirror of
https://github.com/CarmJos/MoeTeleport.git
synced 2026-06-04 07:48:16 +08:00
[v1.1.0] 修复权限判断异常的问题
This commit is contained in:
@@ -6,8 +6,8 @@ import cc.carm.plugin.moeteleport.configuration.values.ConfigValueMap;
|
||||
|
||||
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<>(
|
||||
|
||||
@@ -41,16 +41,17 @@ public class UserManager {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user