Remove some from a config

Discussion in 'Plugin Development' started by theEvilReaper, Feb 15, 2014.

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

    theEvilReaper

    Hey Guys,

    Code:
    @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
        {
            if(sender instanceof Player)
            {
              Player p = (Player)sender;
               
                if(cmd.getName().equalsIgnoreCase("players"))
                    if(p.hasPermission("players.use"))
                        {
                          if(args.length == 0)
                          {
     
                              p.sendMessage("§6Bitte mache §c/players off");
                              p.sendMessage("§6Bitte mache §c/players on");
                          }
                       
                        } else if(args.length == 1 && args[0].equalsIgnoreCase("on"))
                        {
                            for(Player player : Bukkit.getOnlinePlayers())
                            {
                                p.hidePlayer(player);
                                p.sendMessage("§cDu siehst nun keine Spieler!");
                                List<String> hidden = new ArrayList<String>();
                                hidden.add(p.getName());
                                cfg.set("players", hidden);
                                try {
                                    cfg.save(this.file);
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }
                            }
                        }
                        else if(args.length == 1 && args[0].equalsIgnoreCase("off"))
                        {
                            for(Player p1 : Bukkit.getOnlinePlayers())
                            {
                                p.showPlayer(p1);
                        {
                            p.sendMessage(TeamCubeTest.error);
                        }
                return true;
            }
                        }
            else
            {
                sender.sendMessage("§4Du must ein Spieler sein!");
            }
            return false;
            }
            return false;
        }
    }
    So i have done a command who you can hide a player buth how i can do remove the name of the player from the config??

    Lg
     
  2. Offline

    spoony_loony

    Use set(path, null)
     
  3. Offline

    theEvilReaper


    What do you mean with the path?
     
  4. Offline

    Theodossis

    Code:
    List<String> hidden = cfg.getStringList("players");
     
    hidden.remove(playervariablehere);
     
    cfg.set("players", hidden);
    
     
Thread Status:
Not open for further replies.

Share This Page