Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Stop Task uses Index instead of Integer object #14

Closed
CubBossa opened this issue Jun 25, 2021 · 2 comments
Closed

Stop Task uses Index instead of Integer object #14

CubBossa opened this issue Jun 25, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@CubBossa
Copy link
Contributor

Hey there. I just called the stopTask(taskId) Method in the Taskmanager. It removes the taskId from the running tasks arraylist but as its an int it will be interpreted as index and not as the id. I think casting it to Integer will fix the problem. Whats the idea of the running tasks arraylist? If its not important I would just call getScheduler().cancelTask(id) for now.

    public void stopTask(int taskId) {
        if (this.runningTasks.contains(taskId)) {
            Bukkit.getScheduler().cancelTask(taskId);
            this.runningTasks.remove(taskId);
        }
    }```
@ByteZ1337
Copy link
Owner

The only purpose of the runningTasks ArrayLists is to prevent TaskManager#stopTask from being used to stop BukkitTasks that weren't started by ParticleLib. But you're right, it's pretty useless. I'll remove the list in the next update.

@ByteZ1337 ByteZ1337 added the bug Something isn't working label Jun 25, 2021
@ByteZ1337
Copy link
Owner

The new version with a bugfix is now released.
Thanks for reporting this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants