@StageGuard 感谢,那如果我不指定,想读取全部数据,是不可以的吗
O
oneoness 发布的最新帖子
-
reloadPluginData加载不了数据
数据
public class UserMap extends JavaAutoSavePluginData { public UserMap() { super("bili_userMap"); } }
命令
@Slf4j public class TestCommand extends JRawCommand { public TestCommand() { super(ConsoleCommandOwner.INSTANCE, "test", "test"); } @Override public void onCommand(@NotNull CommandContext context, @NotNull MessageChain args) { UserMap userMap = new UserMap(); AutoPlanPlugin.INSTANCE.reloadPluginData(userMap); log.info(String.valueOf(userMap.getValueNodes().size())); for (AbstractPluginData.ValueNode<?> valueNode : userMap.getValueNodes()) { log.info(valueNode.getValueName() + "=" + valueNode.getValue()); } } }
yml文件内的数据
test: test a: a b: c: c
启动后使用命令的日志
> /test 2022-10-11 11:39:54 W/stderr: [DefaultDispatcher-worker-2] INFO cn.cimoc.mirai.plugin.bili.command.TestCommand - 0 2022-10-11 11:39:54 W/stderr:
可以看到使用reloadPluginData方法后,这个数据对象中的数据依旧是空的,请问我哪里操作不当。
-
RE: Cannot find plugin description resource 'plugin.yml'
@oneoness 在 Cannot find plugin description resource 'plugin.yml' 中说:
et.mamoe.mirai.console.internal.util.ServiceLoadException: Could not load service cn.cimoc.mirai.plugin.AutoPlanPlugin. at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadService(PluginServiceHelper.kt:60) at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadAllServices(PluginServiceHelper.kt:42) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl$extractPlugins$findAllInstances$2.invoke(BuiltInJvmPluginLoaderImpl.kt:170) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl$extractPlugins$findAllInstances$2.invoke(BuiltInJvmPluginLoaderImpl.kt:165) at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210) at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:314) at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303) at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214) at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214) at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:307) at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303) at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786) at kotlin.sequences.SequencesKt___SequencesKt.toSet(_Sequences.kt:827) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.extractPlugins(BuiltInJvmPluginLoaderImpl.kt:191) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.listPlugins(BuiltInJvmPluginLoaderImpl.kt:66) at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.listPlugins(JvmPluginLoader.kt) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.listAndSortAllPlugins(PluginManagerImpl.kt:192) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.findAndSortAllPluginsUsingBuiltInLoaders(PluginManagerImpl.kt:138) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.loadAllPluginsUsingBuiltInLoaders$mirai_console(PluginManagerImpl.kt:148) at net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge.doStart$mirai_console(MiraiConsoleImplementationBridge.kt:178) at net.mamoe.mirai.console.MiraiConsoleImplementation$Companion.start(MiraiConsoleImplementation.kt:464) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon(MiraiConsoleTerminalLoader.kt:168) at cn.cimoc.mirai.Pro1Application.main(Pro1Application.java:17) Caused by: java.lang.ExceptionInInitializerError at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:398) at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadService(PluginServiceHelper.kt:51) ... 22 more Caused by: java.lang.IllegalStateException: Cannot find plugin description resource 'plugin.yml' at net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription$Companion.loadFromResource(JvmPluginDescription.kt:51) at net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription$Companion.loadFromResource$default(JvmPluginDescription.kt:45) at net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription$Companion.loadFromResource(JvmPluginDescription.kt) at net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription.loadFromResource(JvmPluginDescription.kt) at mirai-autoplan-1.0.jar//cn.cimoc.mirai.plugin.AutoPlanPlugin.<init>(AutoPlanPlugin.java:24) at mirai-autoplan-1.0.jar//cn.cimoc.mirai.plugin.AutoPlanPlugin.<clinit>(AutoPlanPlugin.java:17) ... 25 more Process finished with exit code 0
这里包名和问题里的不一样是因为重新建了一个项目
-
RE: Cannot find plugin description resource 'plugin.yml'
et.mamoe.mirai.console.internal.util.ServiceLoadException: Could not load service cn.cimoc.mirai.plugin.AutoPlanPlugin. at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadService(PluginServiceHelper.kt:60) at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadAllServices(PluginServiceHelper.kt:42) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl$extractPlugins$findAllInstances$2.invoke(BuiltInJvmPluginLoaderImpl.kt:170) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl$extractPlugins$findAllInstances$2.invoke(BuiltInJvmPluginLoaderImpl.kt:165) at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210) at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:314) at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303) at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214) at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214) at kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:307) at kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303) at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:786) at kotlin.sequences.SequencesKt___SequencesKt.toSet(_Sequences.kt:827) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.extractPlugins(BuiltInJvmPluginLoaderImpl.kt:191) at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.listPlugins(BuiltInJvmPluginLoaderImpl.kt:66) at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.listPlugins(JvmPluginLoader.kt) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.listAndSortAllPlugins(PluginManagerImpl.kt:192) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.findAndSortAllPluginsUsingBuiltInLoaders(PluginManagerImpl.kt:138) at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.loadAllPluginsUsingBuiltInLoaders$mirai_console(PluginManagerImpl.kt:148) at net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge.doStart$mirai_console(MiraiConsoleImplementationBridge.kt:178) at net.mamoe.mirai.console.MiraiConsoleImplementation$Companion.start(MiraiConsoleImplementation.kt:464) at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon(MiraiConsoleTerminalLoader.kt:168) at cn.cimoc.mirai.Pro1Application.main(Pro1Application.java:17) Caused by: java.lang.ExceptionInInitializerError at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:398) at net.mamoe.mirai.console.internal.util.PluginServiceHelper.loadService(PluginServiceHelper.kt:51) ... 22 more Caused by: java.lang.IllegalStateException: Cannot find plugin description resource 'plugin.yml' at net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription$Companion.loadFromResource(JvmPluginDescription.kt:51) at net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription$Companion.loadFromResource$default(JvmPluginDescription.kt:45) at net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription$Companion.loadFromResource(JvmPluginDescription.kt) at net.mamoe.mirai.console.plugin.jvm.JvmPluginDescription.loadFromResource(JvmPluginDescription.kt) at mirai-autoplan-1.0.jar//cn.cimoc.mirai.plugin.AutoPlanPlugin.<init>(AutoPlanPlugin.java:24) at mirai-autoplan-1.0.jar//cn.cimoc.mirai.plugin.AutoPlanPlugin.<clinit>(AutoPlanPlugin.java:17) ... 25 more Process finished with exit code 0
-
为啥自己写的复合指令会覆盖原生指令
如题。在我自己写的插件中,写了几个复合指令:
放入console运行后,使用原生指令help如下图所示
而且这些提示我记得原本是白色的吧,还有就是这个W/console又是啥
有没有大佬来帮帮忙
-
RE: 插件使用Spring容器,放入console后启动找不到bean
@cssxsh 确实,我现在正在考虑换成JDK11自带的HttpClient。不过还是没明白为什么Spring的Bean出问题了