Search in sources :

Example 31 with Configuration

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();
}
Also used : Configuration(net.md_5.bungee.config.Configuration) TypeToken(com.google.gson.reflect.TypeToken)

Example 32 with Configuration

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;
}
Also used : YamlConfiguration(net.md_5.bungee.config.YamlConfiguration) Configuration(net.md_5.bungee.config.Configuration) PermissionGroup(de.dytanic.cloudnet.lib.player.permission.PermissionGroup) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Example 33 with Configuration

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;
    }
}
Also used : YamlConfiguration(net.md_5.bungee.config.YamlConfiguration) Configuration(net.md_5.bungee.config.Configuration) InputStream(java.io.InputStream) IOException(java.io.IOException) YamlConfiguration(net.md_5.bungee.config.YamlConfiguration)

Aggregations

YamlConfiguration (net.md_5.bungee.config.YamlConfiguration)32 Configuration (net.md_5.bungee.config.Configuration)30 File (java.io.File)16 IOException (java.io.IOException)12 TextComponent (net.md_5.bungee.api.chat.TextComponent)6 InputStream (java.io.InputStream)5 ArrayList (java.util.ArrayList)5 ProxiedPlayer (net.md_5.bungee.api.connection.ProxiedPlayer)5 Path (java.nio.file.Path)4 ConnectableAddress (de.dytanic.cloudnet.lib.ConnectableAddress)3 ServerInfo (de.dytanic.cloudnet.lib.server.info.ServerInfo)2 ServerInstallablePlugin (de.dytanic.cloudnet.lib.service.plugin.ServerInstallablePlugin)2 SimpledUser (de.dytanic.cloudnet.lib.user.SimpledUser)2 Document (de.dytanic.cloudnet.lib.utility.document.Document)2 FileOutputStream (java.io.FileOutputStream)2 OutputStream (java.io.OutputStream)2 OutputStreamWriter (java.io.OutputStreamWriter)2 URLConnection (java.net.URLConnection)2 Enumeration (java.util.Enumeration)2 Properties (java.util.Properties)2