Selecting at Random from a List in the Config

Discussion in 'Plugin Development' started by MineStein, Jul 14, 2014.

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

    MineStein

    I am creating a hub plugin for my server. I have yet to figure out how to do these two things.
    - Using BarAPI to select a random string from a list in the config and display them at intervals of 100 ticks.
    - Using the ServerListPingEvent to select a random string from a list in the config and display them as the MOTD.

    Thanks for any help,
    ~ MineStein
     
  2. Offline

    MCMastery

    Well here is an example of how to select a random string from a stringlist in the config:
    Code:
    Random random = new Random();
    int index = random.nextInt(); // or nextInteger(), i forget
    String string = getConfig().getStringList("your-string-list").get(index);
    
     
  3. Offline

    MineStein

Thread Status:
Not open for further replies.

Share This Page