BurnPlugin help

Discussion in 'Plugin Development' started by smilemaster7, Feb 1, 2019.

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

    smilemaster7

    Hey! So I'm trying to make a plugin that has 2 commands. 1: makes you burn for a random amount of time between 1-40 seconds. 2: make yourself burn for 5 seconds. At the moment the burn works but it's only for 1 tick. This is all the code I have and I do not know how to make the burn last longer/make it random. Anyone able to help?

    Code:
    public class Turtles extends JavaPlugin implements Listener
    {
        Logger myPluginLogger = Bukkit.getLogger();
        @Override
        public void onEnable()
        {
        }
        @Override
        public void onDisable()
        {
        }
        public boolean onCommand(CommandSender theSender, Command cmd, String commandLabel, String[] args)
        {
            Player player = (Player) theSender;
          
            if(commandLabel.equalsIgnoreCase("rburn"))
            {
                if(args.length == 0)
                {
                    int randomFireNumber = (int) (Math.random() * 40);
                    player.setFireTicks(randomFireNumber);
                    player.sendMessage(ChatColor.GOLD + "You have been set on " + ChatColor.RED + " fire " + ChatColor.GOLD + " for " + ChatColor.AQUA + randomFireNumber + ChatColor.GOLD + " seconds!");
                }
              
                else {
                    player.sendMessage(ChatColor.RED + "Invalid arguments, try /rburn");
                }
            }
                  
          
            else if(commandLabel.equalsIgnoreCase("burn"))
            {
                if(args.length == 0)
                {
                    player.setFireTicks(20);
                    player.sendMessage(ChatColor.GOLD + "You have been set on " + ChatColor.RED + " fire!");
                }
                else {
                player.sendMessage(ChatColor.RED + "Invalid arguments!");
                }
            }
            else {
                player.sendMessage("Unknown command, try /burn");
                }
            return true;
        }
      
    }
     
  2. Offline

    MightyOne

    1 second = 20 ticks
    Burning for 1 to 40 ticks = 0.05 to 2 seconds
    Maybe that's going wrong?
     
  3. Offline

    smilemaster7

    Ohh Ima check that out tomorrow, thx!
     
Thread Status:
Not open for further replies.

Share This Page