Plugin Help randomizing settings/words(without config)

Discussion in 'Plugin Help/Development/Requests' started by Scorpionvssub, Jul 11, 2015.

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

    Scorpionvssub

    Im working on a plugin and i wanted to attempt a string of words. example

    blue, red, green, white(etc.)
    Then have it pick 1 at random just 1 and put that in.

    this is for a fw part of the plugin im working on but i been searching high and low but all tuts are about getting players which to me seems a way diff method then getting a list of words not from the config(dont want to add 1)
     
  2. Offline

    BizarrePlatinum

    @Scorpionvssub Make the list, make a RNG, get the string from the index of the random number.
     
  3. Offline

    Scorpionvssub

    @BizarrePlatinum hmm i never worked with "rng" :confused: cant find any good tutorials or a how to either..


    Is there a way to (if this part even works) to shorten it?

    Code:
            String message = getConfig().getString("Settings.message").replaceAll("<player>", killername);
            String messages = message.replaceAll("<victim>", victimname);
            String broadcast = messages.replaceAll("<item>",name);
    
            event.setDeathMessage(prefix + " " + broadcast);
     
    Last edited: Jul 12, 2015
  4. Offline

    BizarrePlatinum

    @Scorpionvssub an rng is a random number generator. If you know how to use randoms, then you know all you need. If not, I'm sure there are tutorials on randoms somewhere.
     
Thread Status:
Not open for further replies.

Share This Page