Hi, so i'm trying to make a really cool plugin, but i'm having trouble with some of the config and yml settings, can someone teamviewer me, or skype to me help... pleaseeee
Wait... YOU need help for configuration? I just wanted to PM you cause of a config question. Anyway, I ask it here now: You made a plugin not long ago, I just can't remember which one, where you had a config like this: Code: foo: a: blub b: maunz And my question is: How do you access a and b from foo?
That's kinda what i want to know :') i want it to happen so when a player types a command, it adds their entry into the .yml i have setup and then adds several entries under that one like your one you just gave me like: Code: NeoSilky: somerandom: true random: maunz I want to know how to do it :')
So... we're trying to figure out the same things at the same time? Creepy... But I want to know how to (easily) read such a configuration, too.
Code: CONFIG.setProperty("player.damaged", true); Would result in: Code: player: damage: true Here's the tutorial: http://wiki.bukkit.org/HUGE_Plugin_Tutorial#Setting_configuration_variables
@Kanlaki101[/COLOR]: Okay, but what do I get if I read out the configuration node "player" (in your example)? Because I need this more dynamic but can't test for myself right now.
Code: playerIsDamaged = CONFIG.getBoolean("player.damaged", true); if (playerIsDamaged) { // if player.damaged is true // do something } else { // do something if false } Should work. Just typed it real fast.
Didn't answer my question (what CONFIG.getString("player") would return) but anyway, I got the dynamic I needed with some getKeys() magic
What i want to know is how do you make a new Code: player: somerandom: true random: maunz where 'player' is the name of the player that did something?
@V10lator This should work for that situation: Code:java Player player = example.getPlayer();exampleBoolean = config.getBoolean(player.getName() + ".somerandom", true);exampleString = config.getString(player.getName() + ".random", null); EDIT: Setting the values would be very similar: Code:java Player player = example.getPlayer();config.setProperty(player.getName() + ".somerandom", exampleBooleanValueHere);config.setProperty(player.getName() + ".random", exampleStringHere);
@Ahniolator: True and exactly what my code does right now (well, not with player names...) just had a little error in it.
I probably would've set the player name as a string instead of calling the getName method twice too, but hey, it's an example Offtopic edit: Our names sound eerily similar