|
11 | 11 | import ce.ajneb97.model.actions.*; |
12 | 12 | import ce.ajneb97.utils.ActionUtils; |
13 | 13 | import ce.ajneb97.utils.VariablesUtils; |
| 14 | +import ce.ajneb97.libs.FoliaAPI; |
14 | 15 | import org.bukkit.Bukkit; |
15 | 16 | import org.bukkit.entity.Entity; |
16 | 17 | import org.bukkit.entity.LivingEntity; |
17 | 18 | import org.bukkit.entity.Player; |
18 | 19 | import org.bukkit.event.Event; |
19 | | -import org.bukkit.scheduler.BukkitRunnable; |
20 | 20 |
|
21 | 21 | import java.util.ArrayList; |
22 | 22 | import java.util.List; |
@@ -99,18 +99,10 @@ public void executeActions(){ |
99 | 99 | //Check cancel event or prevent join, always first to prevent issues with async events. |
100 | 100 | executeCancelActions(); |
101 | 101 |
|
102 | | - if(!Bukkit.isPrimaryThread()){ |
103 | | - new BukkitRunnable(){ |
104 | | - @Override |
105 | | - public void run() { |
106 | | - plugin.getServer().getPluginManager().callEvent(ceEvent); |
107 | | - executeActionsFinal(); |
108 | | - } |
109 | | - }.runTask(plugin); |
110 | | - }else{ |
| 102 | + FoliaAPI.runTask(plugin, () -> { |
111 | 103 | plugin.getServer().getPluginManager().callEvent(ceEvent); |
112 | 104 | executeActionsFinal(); |
113 | | - } |
| 105 | + }); |
114 | 106 | } |
115 | 107 |
|
116 | 108 | public void executeCancelActions(){ |
@@ -395,6 +387,8 @@ private void executeAction(LivingEntity livingEntity,ActionType type,String apiT |
395 | 387 | // return; |
396 | 388 | case TAB_COMPLETE: |
397 | 389 | ActionUtils.tabComplete(actionLine,minecraftEvent); |
| 390 | + default: |
| 391 | + break; |
398 | 392 | } |
399 | 393 | } |
400 | 394 |
|
@@ -438,6 +432,8 @@ private void executeAction(LivingEntity livingEntity,ActionType type,String apiT |
438 | 432 | // return; |
439 | 433 | case TAB_COMPLETE: |
440 | 434 | ActionUtils.tabComplete(actionLine,minecraftEvent); |
| 435 | + default: |
| 436 | + break; |
441 | 437 | } |
442 | 438 |
|
443 | 439 | } |
|
0 commit comments