How to remove a players name from a config list?

Discussion in 'Plugin Development' started by bkleinman1, Sep 7, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    bkleinman1

    exactly as the title says, how would i remove a players name from this list:
    Code:
    warnings:
        1:
        - <player_name>
    I know that if you set it equal to null, it will remove it, but im guessing that, that would just remove the whole of the list, not just the player name.
     
  2. Offline

    KingNyuels

    Code:java
    1. List<String> warnedPlayer = getConfig().getStringList("warnings.1");
    2. warnedPlayer.remove("PlayerName");
    3. getConfig().set("warnings.1", Arrays.asList(warnedPlayer);
    4. saveConfig();
     
  3. Offline

    bkleinman1

Thread Status:
Not open for further replies.

Share This Page