Skip to content

Commit 33f7c2e

Browse files
committedFeb 2, 2025
fix: Dispatch commands synchronously
1 parent ff0378a commit 33f7c2e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed
 

‎src/main/java/fi/septicuss/tooltips/managers/tooltip/tasks/TooltipTask.java

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fi.septicuss.tooltips.managers.tooltip.tasks;
22

3+
import fi.septicuss.tooltips.Tooltips;
34
import fi.septicuss.tooltips.managers.preset.Preset;
45
import fi.septicuss.tooltips.managers.preset.actions.ActionProperties;
56
import fi.septicuss.tooltips.managers.preset.actions.DefaultTooltipAction;
@@ -151,15 +152,18 @@ public void runActions(String action, Player player) {
151152
}
152153

153154
final List<String> commands = Text.processText(player, actions.getCommandsForAction(action));
154-
commands.forEach(command -> {
155-
final String consoleCommand = command.replace("%player%", player.getName());
156155

157-
if (ActionCommands.isValidCommand(consoleCommand)) {
158-
ActionCommands.runCommand(player, presetId, consoleCommand);
159-
return;
160-
}
156+
Bukkit.getScheduler().runTask(Tooltips.get(), () -> {
157+
commands.forEach(command -> {
158+
final String consoleCommand = command.replace("%player%", player.getName());
159+
160+
if (ActionCommands.isValidCommand(consoleCommand)) {
161+
ActionCommands.runCommand(player, presetId, consoleCommand);
162+
return;
163+
}
161164

162-
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), consoleCommand);
165+
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), consoleCommand);
166+
});
163167
});
164168

165169
}

0 commit comments

Comments
 (0)
Please sign in to comment.