style: 从 pages 子目录中读取页面配置文件

This commit is contained in:
2022-11-11 07:11:36 +08:00
parent aaa888f058
commit f254ff2fef
2 changed files with 3 additions and 7 deletions

View File

@@ -27,10 +27,6 @@ public class HamsterCorePlugin extends JavaPlugin {
return instance; return instance;
} }
public static void sync(Runnable runnable) {
Bukkit.getScheduler().runTask(instance, runnable);
}
@Override @Override
public void onLoad() { public void onLoad() {
instance = this; instance = this;

View File

@@ -1,9 +1,9 @@
package cn.hamster3.mc.plugin.core.bukkit.page.handler; package cn.hamster3.mc.plugin.core.bukkit.page.handler;
import cn.hamster3.mc.plugin.core.bukkit.HamsterCorePlugin;
import cn.hamster3.mc.plugin.core.bukkit.page.ButtonGroup; import cn.hamster3.mc.plugin.core.bukkit.page.ButtonGroup;
import cn.hamster3.mc.plugin.core.bukkit.page.PageConfig; import cn.hamster3.mc.plugin.core.bukkit.page.PageConfig;
import cn.hamster3.mc.plugin.core.bukkit.page.PageManager; import cn.hamster3.mc.plugin.core.bukkit.page.PageManager;
import org.bukkit.Bukkit;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -85,11 +85,11 @@ public abstract class PageHandler implements InventoryHolder {
if (init) { if (init) {
initPage(); initPage();
} }
HamsterCorePlugin.sync(() -> player.openInventory(getInventory())); Bukkit.getScheduler().runTask(config.getPlugin(), () -> player.openInventory(getInventory()));
} }
public void close() { public void close() {
HamsterCorePlugin.sync(player::closeInventory); Bukkit.getScheduler().runTask(config.getPlugin(), player::closeInventory);
} }
@NotNull @NotNull