gpt4 book ai didi

java - 为什么我会收到 IllegalAccessError?

转载 作者:行者123 更新时间:2023-12-01 22:46:56 25 4
gpt4 key购买 nike

我目前正在编写一个自动更新程序,它可以从 GitHub 下载最新版本的插件。我禁用了该插件,我可以替换它,现在我想启用它,但出现以下错误

java.lang.IllegalAccessError: tried to access class de.pixel.woolbattle.game.Lobby$1 from class de.pixel.woolbattle.game.Lobby, which seems really odd to me. My Discord: DasBabyPixel#3070

错误指向的行是我的“Lobby”类中的第 30 行。有一个private static int DeathTimer = Bukkit.getScheduler().scheduleSyncRepeatingTask(...)我尝试将“私有(private)”设置为“ protected ”或“公共(public)”,但没有一个起作用

private static int deathTimer = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getPlugin(Main.class), new Runnable() {
@Override
public void run() {
if (Main.getGameState().getLobby() != null && Main.getGameState().getLobby().isEnabled()) {
if (isPaused)
return;
for (Player p : Main.getPlayers()) {
YamlConfiguration cfg = Main.getPlugin().getConfig("lobby");
if (p.getLocation().getBlockY() < cfg.getInt("deathheight")) {
p.teleport(Main.getGameState().getLobby().getSpawn());
}
}
}
}
}, 10, 10);

堆栈跟踪:

java.lang.IllegalAccessError: tried to access class de.pixel.woolbattle.game.Lobby$1 from class de.pixel.woolbattle.game.Lobby
at de.pixel.woolbattle.game.Lobby.<clinit>(Lobby.java:30) ~[?:?]
at de.pixel.woolbattle.Main.onEnable(Main.java:91) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8.jar:git-Spigot-db6de12-18fbb24]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_221]

最佳答案

我发现问题是 jar 被嵌入覆盖。我编写了一个外部插件来下载 API 和主插件,如果失败,它会从内部存储路径复制它们。当服务器停止时,我只需删除所有下载的插件,这样我就可以重新下载它们,而不会出现相同的奇怪嵌入错误。

关于java - 为什么我会收到 IllegalAccessError?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58470837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com