fix commands running before panel opens

This commit is contained in:
rockyhawk64 2025-10-14 17:46:17 +11:00
parent f5993c525a
commit 4408bacc7e
5 changed files with 7 additions and 11 deletions

View File

@ -47,7 +47,6 @@ public class CommandRunner {
String command = commands.get(index).trim();
// Handle the delay tag at flow level
if (command.startsWith("[delay]")) {
String delayStr = ctx.text.applyPlaceholders(
player,
@ -70,10 +69,7 @@ public class CommandRunner {
}
// Run the command
Bukkit.getGlobalRegionScheduler().run(
ctx.plugin,
task -> runCommand(panel, player, command)
);
runCommand(panel, player, command);
// Move to the next command
runCommands(panel, player, commands, index + 1);

View File

@ -3,7 +3,6 @@ package me.rockyhawk.commandpanels.interaction.commands.tags;
import me.rockyhawk.commandpanels.Context;
import me.rockyhawk.commandpanels.interaction.commands.CommandTagResolver;
import me.rockyhawk.commandpanels.session.Panel;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class ChatTag implements CommandTagResolver {

View File

@ -15,6 +15,8 @@ public class ConsoleCmdTag implements CommandTagResolver {
@Override
public void handle(Context ctx, Panel panel, Player player, String raw, String command) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
Bukkit.getGlobalRegionScheduler().run(ctx.plugin,
task -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command)
);
}
}

View File

@ -19,8 +19,8 @@ public class RefreshPanelTag implements CommandTagResolver {
*/
@Override
public void handle(Context ctx, Panel panel, Player player, String raw, String command) {
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task -> {
panel.open(ctx, player, false);
});
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task ->
panel.open(ctx, player, false)
);
}
}

View File

@ -6,7 +6,6 @@ import me.rockyhawk.commandpanels.interaction.commands.RequirementRunner;
import me.rockyhawk.commandpanels.session.ClickActions;
import me.rockyhawk.commandpanels.session.inventory.InventoryPanel;
import me.rockyhawk.commandpanels.session.inventory.PanelItem;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;