Plugin Help Config / cannot be resolved or is not a field

Discussion in 'Plugin Help/Development/Requests' started by Forscom, Dec 25, 2016.

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

    Forscom

    Having an issue while trying to make the prefix of the broadcast be customizable through the config, and i keep getting errors.
    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
      {
        Player player = (Player)sender;
        if (label.equalsIgnoreCase("alert")) {
          if (args.length == 0)
          {
            sender.sendMessage(ChatColor.RED + " You must type a message!");
          }
          else if (args.length > 0)
          {
            StringBuilder builder = new StringBuilder();
            String[] arrayOfString;
            int j = (arrayOfString = args).length;
            for (int i = 0; i < j; i++)
            {
              String s = arrayOfString[I];
             
              builder.append(s + " ");
            }
            String prefix = "&6[BROADCAST] &f" + builder.toString();
            Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', this.main.getConfig().getString("prefix"));
            String value = ChatColor.translateAlternateColorCodes('&', this.main.getConfig().getString("prefix"));
            }
          }
        }
        return false;
      }
    }[code]]I'm aware I have two of the same code lines as well.
     
    Last edited by a moderator: Dec 25, 2016
Thread Status:
Not open for further replies.

Share This Page