1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 23:13:48 +01:00

Fixed issue when used permissions option and contains "." char, will changes the config, so it not works

This commit is contained in:
montlikadani 2020-02-06 18:35:27 +01:00
parent a4c75ac575
commit 118b6d8459
3 changed files with 13 additions and 10 deletions

View File

@ -79,7 +79,9 @@ public class ConfigManager {
"and job2 gives 5 income and experience for killing a player. When the user kills a player",
"they will get 15 income and job1 will gain 10 experience and job2 will gain 5 experience."));
cfg.set("Jobs", cfg.getC().get("Jobs"));
if (!cfg.contains("Jobs")) {
cfg.set("Jobs", cfg.getC().get("Jobs"));
}
String pt = "Jobs.exampleJob";
cfg.addComment(pt, "Must be one word",
@ -822,12 +824,12 @@ public class ConfigManager {
if (permissionsSection != null) {
for (String permissionKey : permissionsSection.getKeys(false)) {
ConfigurationSection permissionSection = permissionsSection.getConfigurationSection(permissionKey);
String node = permissionKey.toLowerCase();
if (permissionSection == null) {
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid permission key " + permissionKey + "!");
continue;
}
String node = permissionKey.toLowerCase().replace('_', '.');
boolean value = permissionSection.getBoolean("value", true);
int levelRequirement = permissionSection.getInt("level", 0);
jobPermissions.add(new JobPermission(node, value, levelRequirement));

View File

@ -548,15 +548,13 @@ public class JobsListener implements Listener {
if (JPlayer == null)
return;
List<JobProgression> prog = JPlayer.getJobProgression();
String name = null;
List<String> lore = new ArrayList<>();
Map<Enchantment, Integer> enchants = new HashMap<>(iih.getEnchantments());
if (enchants.isEmpty())
return;
String name = null;
List<String> lore = new ArrayList<>();
if (iih.hasItemMeta()) {
ItemMeta meta = iih.getItemMeta();
if (meta.hasDisplayName())
@ -566,6 +564,7 @@ public class JobsListener implements Listener {
}
String meinOk = null;
List<JobProgression> prog = JPlayer.getJobProgression();
mein: for (JobProgression one : prog) {
for (Entry<String, JobLimitedItems> oneItem : one.getJob().getLimitedItems().entrySet()) {

View File

@ -481,12 +481,14 @@ Jobs:
# permissions granted for joining class
permissions:
# example node
aaaaaatest.node:
# NOTE: You should use "_" instead of "." dot, because the file will be saved on
# plugin load, so it will changes the configuration.
aaaaaatest_node:
# true to give, false to revoke
value: true
# minimum level needed to grant permission. Use 0 for all levels
level: 0
aaaaaatest.node2:
aaaaaatest_node2:
value: true
# Permission granted when reaching level 10
level: 10