style: 从 pages 子目录中读取页面配置文件
This commit is contained in:
@@ -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;
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user