kangarko / Foundation

Foundation™ helps you create highly customized Minecraft plugins (based on Spigot/Paper API) that support multiple MC versions.

Home Page:https://mineacademy.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.8: Extend class `YamlConfig`

StarozytnySky opened this issue · comments

When i use class extend YamlConfig and load the file via

      private Ender() {
          this.loadConfiguration(NO_DEFAULT, "Map/Ender.yml");
          this.save();
      }

it creates a folder for me but empty (doesn't copy file content from resource) and i know if i set on NO_DEFAULT and i didn't give default values then will be empty but when i set

      private Ender() {
          this.loadConfiguration("Map/Ender.yml");
          this.save();
      }

then it creates folder with contents but then i can't change value inside this file in game via this code. If its given NO_DEFAULT then i can change.

	public void addEnderchest(Location paramLocation) {
		List<String> list = getStringList("Locations");
		list.add(paramLocation.getWorld().getName() + "," + paramLocation.getBlockX() + "," + paramLocation.getBlockY() + "," + paramLocation.getBlockZ());
		this.set("Locations", list);

		this.save();

	}

My class file with extend YamlConfig
https://hastebin.com/bewapagufo.kotlin

To create file i use Ender.getInstance(); inside onPluginStart()

This is a problem inside the library that you can't change the values during the game if you don't give NO_DEFALT?

Override saveComents and set it to false then you can specify internal resource path and save things

@Override protected boolean saveComments() { return false; }

Override saveComents and set it to false then you can specify internal resource path and save things

@Override protected boolean saveComments() { return false; }

Now comments is not save however this is not very important for now.

Thanks for help!