use of net.md_5.bungee.config.Configuration in project CloudNet by Dytanic.
the class PacketInUpdateWrapperProperties method handleInput.
@Override
public void handleInput(Document data, PacketSender packetSender) {
Configuration configuration = data.getObject("configuration", new TypeToken<Configuration>() {
}.getType());
CloudNetWrapper.getInstance().getWrapperConfig().getConfiguration().self.putAll(configuration.self);
CloudNetWrapper.getInstance().getWrapperConfig().save();
CloudNetWrapper.getInstance().getWrapperConfig().load();
}
use of net.md_5.bungee.config.Configuration in project CloudNet by Dytanic.
the class ConfigPermissions method read.
public Map<String, PermissionGroup> read(Configuration configuration) {
Map<String, PermissionGroup> maps = new LinkedHashMap<>();
Configuration section = configuration.getSection("groups");
for (String key : section.getKeys()) {
Configuration group = section.getSection(key);
HashMap<String, Boolean> permissions = new HashMap<>();
List<String> permissionSection = group.getStringList("permissions");
for (String entry : permissionSection) {
permissions.put(entry.replaceFirst("-", ""), (!entry.startsWith("-")));
}
HashMap<String, List<String>> permissionsGroups = new HashMap<>();
Configuration permissionSectionGroups = group.getSection("serverGroupPermissions");
for (String entry : permissionSectionGroups.getKeys()) {
permissionsGroups.put(entry, permissionSectionGroups.getStringList(entry));
}
PermissionGroup permissionGroup = new PermissionGroup(key, group.getString("prefix"), group.getString("suffix"), group.getString("display"), group.getInt("tagId"), group.getInt("joinPower"), group.getBoolean("defaultGroup"), permissions, permissionsGroups, group.getSection("options").self, group.getStringList("implements"));
maps.put(permissionGroup.getName(), permissionGroup);
}
return maps;
}
use of net.md_5.bungee.config.Configuration in project ProjectRails by Project-Rails.
the class RailConfig method reloadConfig.
public final Configuration reloadConfig() {
Configuration defaultConfig = null;
InputStream defaultConfigStream = getClass().getClassLoader().getResourceAsStream(configFile.getName());
if (defaultConfigStream != null) {
defaultConfig = ConfigurationProvider.getProvider(YamlConfiguration.class).load(defaultConfigStream);
}
if (!configFile.exists())
return (configuration = defaultConfig);
try {
return (configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile, defaultConfig));
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
Aggregations