File tree Expand file tree Collapse file tree
src/main/java/com/nextplugins/tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import lombok .RequiredArgsConstructor ;
88import me .saiintbrisson .minecraft .command .annotation .Command ;
99import me .saiintbrisson .minecraft .command .command .Context ;
10+ import me .saiintbrisson .minecraft .command .target .CommandTarget ;
1011import org .bukkit .entity .Player ;
1112
1213@ RequiredArgsConstructor
@@ -19,6 +20,7 @@ public final class TaskCommand {
1920 aliases = {"tarefas" },
2021 permission = "nexttasks.command.tasks" ,
2122 description = "Liste todas as tarefas agendadas." ,
23+ target = CommandTarget .PLAYER ,
2224 async = true
2325 )
2426 public void taskCommand (Context <Player > context ) {
Original file line number Diff line number Diff line change @@ -16,18 +16,18 @@ public class JobExecutor implements Job {
1616
1717 @ Override
1818 public void execute (JobExecutionContext context ) {
19-
20- Task task = taskManager .getTasks ().get (context .getMergedJobDataMap ().getString ("task" ));
21-
22- for (String command : task .getJob ().getCommandList ()) {
23- Bukkit .dispatchCommand (Bukkit .getConsoleSender (), command );
24- }
25-
26- Bukkit .getPluginManager ().callEvent (new TaskExecuteEvent (
27- task ,
28- new Date ()
29- ));
30-
19+ Bukkit . getScheduler (). runTask ( NextTasks . getInstance (), () -> {
20+ Task task = taskManager .getTasks ().get (context .getMergedJobDataMap ().getString ("task" ));
21+
22+ for (String command : task .getJob ().getCommandList ()) {
23+ Bukkit .dispatchCommand (Bukkit .getConsoleSender (), command );
24+ }
25+
26+ Bukkit .getPluginManager ().callEvent (new TaskExecuteEvent (
27+ task ,
28+ new Date ()
29+ ));
30+ });
3131 }
3232
3333}
You can’t perform that action at this time.
0 commit comments