Activate/Deactivate thinks via Config

Discussion in 'BungeeCord Plugin Development' started by Script360, May 29, 2016.

  1. Hello
    I would like to create an auto broadcaster, though I would love to add config whether it is active or inactive. How can I do that?
    My Code:
    Code (Text):
    public void run()
      {
        List messages = Main.config4.getStringList("Announcements");

        int next = 0;
        if (this.mode == BroadCastMode.RANDOM) {
          int length = messages.size();
          Random rand = new Random();

          next = rand.nextInt(length);
        } else if (this.mode == BroadCastMode.SEQUENCE) {
          next = this.index;
          this.index += 1;
          if (this.index > messages.size() - 1) {
            this.index = 0;
          }
        }
        String item = ChatColor.translateAlternateColorCodes('&', (String)messages.get(next));
        for (ProxiedPlayer p : ProxyServer.getInstance().getPlayers()) {
             if ((p.getServer() == null) || (p.getServer().getInfo() == null) ||
                     (this.servers.contains(p.getServer().getInfo().getName()))) continue;
            p.sendMessage(new TextComponent(ChatColor.DARK_GRAY + "" + ChatColor.STRIKETHROUGH + "----------------------------------------------------" + ChatColor.RED + "\n "));
            p.sendMessage(new TextComponent(item));
            p.sendMessage(new TextComponent(ChatColor.RED + "\n" + ChatColor.DARK_GRAY + ChatColor.STRIKETHROUGH + "----------------------------------------------------"));
      }
    }
     
  2. This isn't a resource so please change the thread title to not include that.

    What's your error? What all have you tried?