Spigot中加入带有彩色关机消息时出现错误。

huangapple go评论73阅读模式
英文:

Error in Spigot when Joining with colored shutdown message

问题

我在Spigot 1.8中有一个带有颜色的关机和重启消息。

spigot.yml:
  restart: "\xa7bServer wird neu gestartet"

bukkit.yml:
  shutdown-message: "\xa7bServer wurde geschlossen!"

使用"\xa7b ..." 是唯一有效的方式来给消息上色。 \u00a7b、\u00a7b 和 $b 都不起作用。

一旦玩家加入,控制台就会出现错误:

[12:50:26 ERROR]: 无法传递事件 PlayerJoinEvent 给 First_Plugin v1.0
org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.PlayerList.onPlayerJoin(PlayerList.java:272) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.PlayerList.a(PlayerList.java:156) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.LoginListener.b(LoginListener.java:109) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.LoginListener.c(LoginListener.java:41) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.NetworkManager.a(NetworkManager.java:159) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.ServerConnection.c(ServerConnection.java:82) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:800) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at java.base/java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.IllegalArgumentException: 无效的页码 1/0
        at org.bukkit.craftbukkit.v1_8_R1.inventory.CraftMetaBook.setPage(CraftMetaBook.java:213) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
        at de.prog_kid.first_plugin.listeners.JoinListener.handlePlayerJoin(JoinListener.java:47) ~[?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
        ... 14 more
[12:50:26 INFO]: Flatuss[/127.0.0.1:51052] 登录,实体ID为 29 位于 ([world] 0.5, 66.0, 0.5)

这是一个本地服务器,所以我无法测试多个玩家。玩游戏和加入游戏都正常。

这个错误是什么意思,我该如何修复它?

英文:

I have a colored shutdown and restart message in Spigot 1.8

spigot.yml:
  restart: "\xa7bServer wird neu gestartet"

bukkit.yml:
  shutdown-message: "\xa7bServer wurde geschlossen!"

Using "\xa7b ..." is the only working way to colorize the messages. \u00a7b §b and $b don´t work.

As soon as a player joines I get an error in the console:

[12:50:26 ERROR]: Could not pass event PlayerJoinEvent to First_Plugin v1.0
org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.PlayerList.onPlayerJoin(PlayerList.java:272) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.PlayerList.a(PlayerList.java:156) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.LoginListener.b(LoginListener.java:109) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.LoginListener.c(LoginListener.java:41) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.NetworkManager.a(NetworkManager.java:159) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.ServerConnection.c(ServerConnection.java:82) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:800) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot.jar:git-Spigot-c3c767f-33d5de3]
        at java.base/java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.IllegalArgumentException: Invalid page number 1/0
        at org.bukkit.craftbukkit.v1_8_R1.inventory.CraftMetaBook.setPage(CraftMetaBook.java:213) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
        at de.prog_kid.first_plugin.listeners.JoinListener.handlePlayerJoin(JoinListener.java:47) ~[?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
        ... 14 more
[12:50:26 INFO]: Flatuss[/127.0.0.1:51052] logged in with entity id 29 at ([world] 0.5, 66.0, 0.5)

It´s a local server so I can´t test multiple players. Playing and joining works normaly.

What does the error mean and how can I fix it?

答案1

得分: 0

你可以在这里看到为什么会导致错误:

由于:java.lang.IllegalArgumentException: 无效的页面编号 1/0

还有在这里可以看到错误发生在这个位置,本例中是在你的JoinListener.java文件的第47行:

位于 de.prog_kid.first_plugin.listeners.JoinListener.handlePlayerJoin(JoinListener.java:47)
英文:

You can see here why it caused an error

Caused by: java.lang.IllegalArgumentException: Invalid page number 1/0

And here where the error is in this case it's in your JoinListener.java in line 47

at de.prog_kid.first_plugin.listeners.JoinListener.handlePlayerJoin(JoinListener.java:47)

huangapple
  • 本文由 发表于 2020年8月15日 19:31:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/63425545.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定