#custom config file resets on restart

1 messages · Page 1 of 1 (latest)

delicate kraken
#

https://paste.md-5.net/osodosogol.java

trying to make a plugin with a custom configuration file where when a player joins the server, it logs their uuid along with a trample value of true. the plugin should append a uuid when another player joins as well. though when i restart my plugin and rejoin on the first account, all other entries are gone. how do i prevent this?

delicate kraken
#

i thought i had this in the code already?

#

or is this the wrong part

#

i apologize in advance if i become frustrating to deal with as i'm still noobie to this

#

so should it be like this?

customConfig = new YamlConfiguration();
customConfig = YamlConfiguration.loadConfiguration(customConfigFile);
#

or am i still not getting it

#

ah

#

this worked, thank you so much

#

and i don't think the bot works in here haha

#

just ping me in development

#

with that

#

so by saving asynchronously you mean just saving over time correct

#

i see i see

#

i'll continue reading up on it

#

thank you so much again

delicate kraken
#

@radiant radish sorry to ping but i ran into another issue

when i restart the server it seems like the server doesn't remember the values i put in there

#
@EventHandler
    public void onPlayerTrample(PlayerInteractEvent event){

        //checks if the action was a physical action (jumping on soil) and returns if it was not
        if (event.getAction() != Action.PHYSICAL) {
            return;
        }

        //get player
        Player player = event.getPlayer();
        //get block that was jumped on
        Block block = event.getClickedBlock();
        //checks if block jumped on is null or not a farm block
        if (block == null || block.getType() != Material.FARMLAND) {
            return;
        }
        //if players trampling value is set to no, it stops the crop from breaking
        if (config.getString("players." + player.getUniqueId().toString() + ".trampling") == "no"){
            event.setCancelled(true);
            player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
        }
    }

i have this function to detect whether or not someone is able to jump on a crop

#

theres a command i created for players to set whether or not they want to trample crops

#

which sets their trampling: value to either 'yes' or 'no' in the yml file

#

when i restart the server the values still are there

#

but the function doesn't act like their value is set to 'no'

#

that fixed it