Solved Adding a path

Discussion in 'Spigot Plugin Development' started by MrWallah, Jun 4, 2017.

  1. Why isn't this working?

    Code (Text):
    @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (cmd.getName().equalsIgnoreCase("maps")){
                Player p = (Player) sender;
                if (p.hasPermission("geg.setmaps")){
                    if (args.length == 1) {
                    Data.cfg.set("Maps.Anzahl", args[0]);
                    p.sendMessage(Data.Prefix + "┬žaNeue Anzahl an Maps erfolgreich gesetzt!");
                    } else {
                        p.sendMessage(Data.Prefix + "┬žcNutzung: /maps <anzahl>");
                    }
                   
                } else {
                    p.sendMessage(Data.NoPerm);
                }
            }
            return false;
        }
    All is working except this : Data.cfg.set("Maps.Anzahl", args[0]);
    It even isn't creating the path
     
  2. you need save the config
     
  3. Looks like this is very unnorginized, you didn't do a check if the sender is a player and why did you set the sender after they sent a command? Makes no sense. Also we can't help unless you show us the Data class because that's where the problem is originating.