Instead of the config set {}

Discussion in 'BungeeCord Plugin Development' started by Lmperatoreq, Aug 12, 2018.

  1. Hello, I make the necessary information in the config and save it, when I open it I see that there is no information which I wanted to receive, there {}, I ask help

    Sorry for bad translate.

    Set config line and save void:

    upload_2018-8-12_20-25-57.png
     
  2. Please help me again
     
  3. Hello, as I understand your plugin bug when you want to put the password? Your "if" before works?
     
  4. Yes, but my checks do not work because I can not put the required information in the config, instead I put {}
     
  5. there is 'isString' method in fileconfiguration,
    can you show us your methods? save, setconfigtofile and field configuration
     
  6. https://hastebin.com/sogatexova.java
     
  7. Code (Text):

    public class ProtectorBungee extends Plugin {

      private Configuration configuration;

      @Override
      public void onEnable() {
        this.saveDefaultConfig();
      }

      public Configuration getConfig() {
        return configuration;
      }

      private void saveDefaultConfig() {
        boolean created = this.getDataFolder().mkdirs();

        final File file = new File(getDataFolder(), "config.yml");

        if (!file.exists()) {
          try (InputStream in = getResourceAsStream("config.yml")) {
            Files.copy(in, file.toPath());
          } catch (IOException e) {
            e.printStackTrace();
          }
        }

        try {
          this.configuration = ConfigurationProvider
              .getProvider(YamlConfiguration.class).load(new File(getDataFolder(), "config.yml"));
        } catch (IOException e) {
          e.printStackTrace();
        }
      }


    }

     
     
    • Agree Agree x 1
  8. java.lang.NullPointerException
    upload_2018-8-15_15-58-24.png