Access to Torch Timers

  • Not directly, unfortunately the torch timer is handled clientside (by the player who dropped the torch), so there is no way to access it through the API... however, with the new API, you could override the item status (the status determines if the torch if on or off), this stops the torch timer (you can do that through the new setStatus() method on the world item - status 0 means the torch is off, status 1 means the torch is burning) ;) This way the torch would burn indefinitely (more precisely, you could then implement your own handling if you want, e.g. set the status back to 0 after some time to turn it off etc).


    If you want all dropped torches to burn indefinitely, you could use the PlayerDropItemEvent:

    Java
    @EventMethod
    public void onPlayerDropItem(PlayerDropItemEvent evt) {
    WorldItem item = evt.getWorldItem();
    //Check if item is not null and is a light item (torch, flashlight etc)
    if(item != null && item.getDefinition().type == Items.Type.Light) {
    //Set status to 1 (light on)
    item.setStatus(1);
    }
    }

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!