Delete the player who send command

Discussion in 'Plugin Development' started by DavidGamer5, Jan 13, 2021.

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

    DavidGamer5

    Hello. I have a problem. I want to remove that player who send command. But if someone send this command: "/udvozlo torol" then remove all users and and it remains:
    Code:
    udvozlo:  []
    Config:
    Code:
    udvozlo: 
      davidkormos2003:   
        szoveg: §ahelloooo
      DavidGamer5:
        szoveg: §ahi everyone

    Code:
    Code:
                    if (args[0].equalsIgnoreCase("torol")) {
                        List<String> udvtorol = getConfig().getStringList("udvozlo");
                        udvtorol.remove(args[0]);
                        getConfig().set("udvozlo", udvtorol);
                        saveConfig();
                        p.sendMessage(ChatColor.GOLD + "Sikeres üdvözlő üzenet törlés!");
                    }
     
  2. Online

    timtower Administrator Administrator Moderator

    @DavidGamer5 It is not a string list, it is a ConfigurationSection.
    getConfig().set("udvozlo"+<playername>, null)
    does what you need
     
    DavidGamer5 likes this.
  3. Offline

    DavidGamer5

    It is work. Thanks! :D
     
  4. Offline

    marcelo.mb

    @DavidGamer5 As this issue is solved, please mark the thread also as solved.:)
     
  5. Offline

    DavidGamer5

    How?
     
  6. Offline

    marcelo.mb

    @DavidGamer5 Thread Tools >> Edit Title >> Click at (No prefix) >> Choose "SOLVED"
     
Thread Status:
Not open for further replies.

Share This Page