Wenn ich den Befehl "/ voltiac" mache, druckt es diesen Fehler in der Konsole und sagt "Ein interner Fehler ist aufgetreten, während versucht, diesen Befehl auszuführen" in Minecraft. Aber wenn ich die Befehle "/ voltiac help" und "/ voltac um" mache, funktionieren sie perfekt. Was ich versuchte, das Plugin zu bekommen, war, als ich den Befehl "/ voltiac" machte, es war dasselbe wie "/ voltac um".Minecraft Bukkit Java Fehler beim Ausführen des Befehls
ist hier der Fehler
[12:15:52] [Server thread/INFO]: DiamondDeveloper issued server command: /voltiac
[12:15:52] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'voltiac' in plugin Voltiac v0.4.4
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:140) ~[craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:620) ~[craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1106) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:966) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(SourceFile:37) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(SourceFile:9) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_73]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_73]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:673) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:335) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:629) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:537) [craftbukkit-1.8.jar:git-Bukkit-18fbb24]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_73]
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at ml.voltiac.bukkit.Main.onCommand(Main.java:48) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[craftbukkit-1.8.jar:git-Bukkit-18fbb24]
... 15 more
meinen Code Hier ist
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = (Player) sender;
// --------voltiac command--------
if (label.equalsIgnoreCase("voltiac")) {
PluginDescriptionFile pdffile = getDescription();
if (!(sender instanceof Player)) {
sender.sendMessage(TextFormat.playerOnly());
return false;
}
if (args[0].equalsIgnoreCase("help")) {
player.sendMessage(ChatColor.RESET + "" + ChatColor.DARK_PURPLE + ChatColor.STRIKETHROUGH
+ "-[-------------------------------------------]-");
player.sendMessage(TextFormat.helpFormat("voltiac", ""));
player.sendMessage(TextFormat.helpFormat("voltiac about", ""));
player.sendMessage(TextFormat.helpFormat("voltiac help", ""));
player.sendMessage(TextFormat.helpFormat("", ""));
player.sendMessage(TextFormat.helpFormat("", ""));
player.sendMessage(ChatColor.RESET + "" + ChatColor.DARK_PURPLE + ChatColor.STRIKETHROUGH
+ "-[-------------------------------------------]-");
} else if (args[0].equalsIgnoreCase("about")) {
player.sendMessage(ChatColor.RESET + "" + ChatColor.DARK_PURPLE + ChatColor.STRIKETHROUGH
+ "-[-------------------------------------------]-");
player.sendMessage(TextFormat.aboutFormat("Name", "Voltiac"));
player.sendMessage(TextFormat.aboutFormat("Version", pdffile.getVersion()));
player.sendMessage(TextFormat.aboutFormat("Made by", "DiamondDeveloper"));
player.sendMessage(TextFormat.aboutFormat("Copyright", "Voltiac 2016"));
player.sendMessage(TextFormat.aboutFormat("Website", ChatColor.UNDERLINE + "www.voltiac.ml"));
player.sendMessage(ChatColor.RESET + "" + ChatColor.DARK_PURPLE + ChatColor.STRIKETHROUGH
+ "-[-------------------------------------------]-");
return true;
} else {
player.sendMessage(ChatColor.RESET + "" + ChatColor.DARK_PURPLE + ChatColor.STRIKETHROUGH
+ "-[-------------------------------------------]-");
player.sendMessage(TextFormat.aboutFormat("Name", "Voltiac"));
player.sendMessage(TextFormat.aboutFormat("Version", pdffile.getVersion()));
player.sendMessage(TextFormat.aboutFormat("Made by", "DiamondDeveloper"));
player.sendMessage(TextFormat.aboutFormat("Copyright", "Voltiac 2016"));
player.sendMessage(TextFormat.aboutFormat("Website", ChatColor.UNDERLINE + "www.voltiac.ml"));
player.sendMessage(ChatColor.RESET + "" + ChatColor.DARK_PURPLE + ChatColor.STRIKETHROUGH
+ "-[-------------------------------------------]-");
return true;
}
return true;
}
return false;
}
}
Ich habe diese Antwort auf die bukkit Foren, aber wie kann ich tun, was er sagt?
Verursacht durch: java.lang.ArrayIndexOutOfBoundsException: 0 bei ml.voltiac.bukkit.Main.onCommand (Main.java:48) ~ [:?]
Sie versuchen, eine bekommen Wert aus einem Array, das keine Werte enthält (grundlegendes Java-Problem). Stellen Sie sicher, dass sich im Array 'args' Objekte befinden, bevor Sie Werte erhalten.
(BTW 48 Linie ist „sender.sendMessage (TextFormat.playerOnly());“)