⭐
StarAPI Documentation
  • ⭐API Information
    • ❔About Our API's
    • ⬇️Installing Our API
  • 🌟StarAPI (Spigot/Paper)
    • 📂Abilities
      • ⏳Transmition
      • 🤯Implosion
      • 🏹MultiShot
    • 📂Builders
      • 👕Armor Builder
      • 📊Bossbar Builder
      • ☄️Command Builder
      • ⚔️Item Builder
      • 🧟‍♂️Mob Builder
      • 💯Scoreboard Builder
      • 🔗Webhook Builder
      • 🔨Message Builder
      • 🏗️Actionbar Builder
    • 📂Files
      • 📃Create Files
      • 📁Create Folders
      • 📖Read Files
      • 🖊️Write Files
    • 📂Inventory Utilities
      • 💎Animated Items
      • 📖Book Content
      • 📔Book GUI
      • 🎞️Filler
      • 🪁Inventory Items
      • 📝Inventory Name
      • 💀Inventory Skulls
    • 📂Message Utilities
      • 🤖Auto Responses
      • 🎨Message Colors
    • 📂Recipes
      • ⚒️Crafting Recipes
      • 🧑‍🍳Furnace Recipes
    • 📂Timers
      • 🕙Active Timers
      • ❌Cancel Timers
      • 🕙Delayed Timers
      • 🕐Create Timers
    • 📂Misc
      • 💀Give Skulls
      • 📈Progress Bars
      • ⬛Block Placer
Powered by GitBook
On this page
  • Overview
  • Methods
  • Example
  1. StarAPI (Spigot/Paper)
  2. Timers

Delayed Timers

Delay a task from being ran

Overview

The DelayedTimer class provides a utility for scheduling delayed tasks in Bukkit.

Methods

scheduleDelayedTask

public static BukkitTask scheduleDelayedTask(Plugin plugin, long delay, Runnable task)

Schedules a delayed task to run after a specified delay.

Parameters

  • plugin: The plugin instance that is scheduling the task.

  • delay: The delay in server ticks before the task should be executed.

  • task: The task to be executed after the delay.

Returns

  • Returns the BukkitTask representing the scheduled task.

Usage

  1. Call the scheduleDelayedTask method and pass the plugin instance, delay in ticks, and the task to be executed as parameters.

Example

Plugin plugin = // your plugin instance
long delay = 20; // 20 ticks (1 second)
Runnable task = () -> {
    // Your task logic here
};
BukkitTask scheduledTask = DelayedTimer.scheduleDelayedTask(plugin, delay, task);

In this example, we schedule a delayed task using the scheduleDelayedTask method. The task will run after a delay of 20 ticks (1 second).

PreviousCancel TimersNextCreate Timers

Last updated 1 year ago

🌟
📂
🕙