mirror of
https://github.com/rockyhawk64/CommandPanels.git
synced 2025-11-18 07:14:17 +01:00
run refreshes in a scheduler
This commit is contained in:
parent
c646e6a848
commit
dc61d9155f
@ -3,6 +3,7 @@ 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 RefreshPanelTag implements CommandTagResolver {
|
||||
@ -12,8 +13,14 @@ public class RefreshPanelTag implements CommandTagResolver {
|
||||
return tag.startsWith("[refresh]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules refreshes as they need to happen after
|
||||
* other actions such as permission changes
|
||||
*/
|
||||
@Override
|
||||
public void handle(Context ctx, Panel panel, Player player, String raw, String command) {
|
||||
panel.open(ctx, player, false);
|
||||
Bukkit.getGlobalRegionScheduler().run(ctx.plugin, task -> {
|
||||
panel.open(ctx, player, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user