命令运行时的java.lang.ClassCastException。一切正常,出现内部错误消息
错误:由于以下原因导致的信息:java.lang.ClassCastException:com.ShlobdonG.gMarry.Commands无法转换为org.bukkit.plugin.plugin 代码:命令运行时的java.lang.ClassCastException。一切正常,出现内部错误消息,java,bukkit,Java,Bukkit,错误:由于以下原因导致的信息:java.lang.ClassCastException:com.ShlobdonG.gMarry.Commands无法转换为org.bukkit.plugin.plugin 代码: if (cmd.getName().equalsIgnoreCase("vmarry")) { if (!(player == null)) { if (!player.hasPermission("gmarry.marry")) { s
if (cmd.getName().equalsIgnoreCase("vmarry")) {
if (!(player == null)) {
if (!player.hasPermission("gmarry.marry")) {
sender.sendMessage("You can't marry a player because of permission!");
return true;
} else {
int cooldown = this.plugin.getConfig().getInt(
"request-cooldown");
if (this.plugin.vmarry.containsKey(player.getName())) {
long diff = (System.currentTimeMillis() - this.plugin.vmarry
.get(sender.getName())) / 1000;
if (diff < cooldown) {
player.sendMessage("You must wait "
+ cooldown
+ " seconds before marrying another player.");
return false;
}
}
}
if (args.length > 0) {
final Player target = Bukkit.getServer().getPlayer(
args[0]);
long keepAlive = this.plugin.getConfig().getLong(
"keep-alive") * 20;
if (target == null) {
sender.sendMessage("You can only marry players that are online!");
return false;
}
if (target == player) {
sender.sendMessage("You can't bite yourself!");
return false;
}
sendRequest(player, target);
Bukkit.getServer()
.getScheduler()
.scheduleSyncDelayedTask((Plugin) this,
new Runnable() {
public void run() {
killRequest(target.getName());
}
}, keepAlive);
this.plugin.vmarry.put(player.getName(),
System.currentTimeMillis());
} else {
player.sendMessage("Attempt to marry player..");
player.sendMessage("/vmarry <player>");
}
}
}
位于com.ShlobdonG.gMarry.Commands.onCommand(Commands.java:182)
scheduleSynchDelayedTask((插件)此
原因:java.lang.ClassCastException:com.ShlobdonG.gMarry.Commands无法转换为org.bukkit.plugin.plugin
有道理,对吧
公共类命令
可能没有扩展/实现插件
stacktrace包含代码的行号。请显示它并告诉我们它是命令的哪一行。java
第182行…它(和周围的代码)说了什么?.scheduleSyncDelayedTask((插件)这,那就是当你急急忙忙的时候会发生的事情,你忘了给主班打电话。哎呀。非常感谢你帮我记住了这件事!当然感谢你。
10.02 22:41:50 [Server] INFO ... 15 more
10.02 22:41:50 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at com.ShlobdonG.gMarry.Commands.onCommand(Commands.java:182) ~[?:?]
10.02 22:41:50 [Server] INFO Caused by: java.lang.ClassCastException: com.ShlobdonG.gMarry.Commands cannot be cast to org.bukkit.plugin.Plugin
10.02 22:41:50 [Server] INFO at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:574) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.MinecraftServer.C(MinecraftServer.java:675) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.DedicatedServer.D(DedicatedServer.java:399) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.MinecraftServer.D(MinecraftServer.java:739) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.SystemUtils.a(SourceFile:46) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_111]
10.02 22:41:50 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_111]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.PlayerConnection.a(PlayerConnection.java:1179) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at net.minecraft.server.v1_11_R1.PlayerConnection.handleCommand(PlayerConnection.java:1344) [spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at org.bukkit.craftbukkit.v1_11_R1.CraftServer.dispatchCommand(CraftServer.java:650) ~[spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot_server.jar:git-Spigot-6854dee-dbf4ecf]
10.02 22:41:50 [Server] INFO org.bukkit.command.CommandException: Unhandled exception executing command 'vmarry' in plugin gMarry v1.0
10.02 22:41:50 [Server] ERROR null