mirror of
https://github.com/rockyhawk64/CommandPanels.git
synced 2025-11-18 07:14:17 +01:00
fix commands running before panel opens
This commit is contained in:
parent
f5993c525a
commit
4408bacc7e
@ -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);
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user