spontaneous combustion?

Discussion in 'Plugin Development' started by Btomhat, Aug 28, 2013.

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

    Btomhat

    i need help with coding a command to choose a random player and then lighting him on fire. any ideas?
     
  2. Offline

    Gopaintman

    Btomhat Here I would try this.
    Code:
    public boolean onCommand(CommandSender sender, Command cmd,String commandLabel, String[] args) {
            if (cmd.getName().equalsIgnoreCase("randFire")) {
                Random rand = new Random();
                Player[] players = Bukkit.getOnlinePlayers();
                int randPlayer = rand.nextInt(players.length)-1;
                int fireTicks = rand.nextInt(100);
                players[randPlayer].setFireTicks(fireTicks);
             
             
             
            }
         
         
         
            return false;
        }
     
  3. Offline

    xTrollxDudex

    Btomhat
    Go to the plugin tutorial and scroll to the bottom
     
  4. Offline

    Btomhat

    thnx guys
     
  5. Offline

    Gopaintman

    Btomhat Make sure to add this above your "public class x{"
    Code:java
    1. import java.util.random
     
Thread Status:
Not open for further replies.

Share This Page