@@ -26,6 +26,10 @@ public void executeOrScheduleSync(Plugin plugin, Runnable task) {
2626 }
2727
2828 public void executeOrScheduleSync (Plugin plugin , Runnable task , Entity entity ) {
29+ if (entity == null ) {
30+ executeOrScheduleSync (plugin , task );
31+ return ;
32+ }
2933 getFoliaLib ().getImpl ().runAtEntity (entity , run -> {
3034 task .run ();
3135 });
@@ -44,6 +48,10 @@ public void runTask(Plugin plugin, Runnable task) {
4448 }
4549
4650 public void runTask (Plugin plugin , Runnable task , Entity entity ) {
51+ if (entity == null ) {
52+ runTask (plugin , task );
53+ return ;
54+ }
4755 getFoliaLib ().getImpl ().runAtEntity (entity , run -> {
4856 task .run ();
4957 });
@@ -68,6 +76,10 @@ public void runTaskLater(Plugin plugin, Runnable task, long delay) {
6876 }
6977
7078 public void runTaskLater (Plugin plugin , Runnable task , long delay , Entity entity ) {
79+ if (entity == null ) {
80+ runTaskLater (plugin , task , delay );
81+ return ;
82+ }
7183 getFoliaLib ().getImpl ().runAtEntityLater (entity , run -> {
7284 task .run ();
7385 }, delay , TimeUnit .SECONDS );
@@ -98,6 +110,10 @@ public void runTaskTimer(Plugin plugin, Runnable task, long delay, long period)
98110 }
99111
100112 public void runTaskTimer (Plugin plugin , Runnable task , long delay , long period , Entity entity ) {
113+ if (entity == null ) {
114+ runTaskTimer (plugin , task , delay , period );
115+ return ;
116+ }
101117 getFoliaLib ().getImpl ().runTimer (run -> {
102118 task .run ();
103119 }, delay , period , TimeUnit .SECONDS );
0 commit comments