mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-17 12:36:53 +01:00
Check if config values aren't null before attempting to set them.
This commit is contained in:
parent
9377129554
commit
f367abbdfa
@ -20,11 +20,6 @@
|
||||
*/
|
||||
package me.clip.placeholderapi.expansion;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.PlaceholderHook;
|
||||
@ -34,6 +29,12 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public final class ExpansionManager {
|
||||
private PlaceholderAPIPlugin plugin;
|
||||
|
||||
@ -65,6 +66,7 @@ public final class ExpansionManager {
|
||||
String pre = "expansions." + expansion.getIdentifier() + ".";
|
||||
FileConfiguration cfg = plugin.getConfig();
|
||||
boolean save = false;
|
||||
if (defaults != null) {
|
||||
for (Entry<String, Object> entries : defaults.entrySet()) {
|
||||
if (entries.getKey() == null || entries.getKey().isEmpty()) {
|
||||
continue;
|
||||
@ -81,6 +83,7 @@ public final class ExpansionManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (save) {
|
||||
plugin.saveConfig();
|
||||
plugin.reloadConfig();
|
||||
|
Loading…
Reference in New Issue
Block a user