Hallo,
ich bin es mal wieder. Ich habe einen InGame-Fehler ohne Fehler in Eclipse. Nun Frage ich euch: Was ist mein/der Denkfehler...
/spawn set geht und wird auch in der system.yml eingetragen, nur der /spawn Befehl geht nicht.
Hier mal alle Dateien:
Ich hoffe ihr könnt mir weiterhelfen 
ich bin es mal wieder. Ich habe einen InGame-Fehler ohne Fehler in Eclipse. Nun Frage ich euch: Was ist mein/der Denkfehler...
/spawn set geht und wird auch in der system.yml eingetragen, nur der /spawn Befehl geht nicht.
Hier mal alle Dateien:
Code:
package de.mrpyro13.ImpComs;
import java.io.File;
import java.io.IOException;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
public class iSpawn_Command implements CommandExecutor {
//MAIN IMPORT - CommandExecutor
@SuppressWarnings("unused")
private Main inst;
public iSpawn_Command(Main plugin){
this.inst = plugin;
}
//FILE IMPORT
File file = new File("plugins/ImpComs", "system.yml");
FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
//SCRIPT ANFANG
if (sender instanceof Player) {
Player p = (Player) sender;
if(args[0].equalsIgnoreCase("set")) {
String world = p.getWorld().getName();
double x = p.getLocation().getX();
double y = p.getLocation().getY();
double z = p.getLocation().getZ();
double yaw = p.getLocation().getYaw();
double pitch = p.getLocation().getPitch();
cfg.set("spawn" + "." + "world", world);
cfg.set("spawn" + "." + "x", x);
cfg.set("spawn" + "." + "y", y);
cfg.set("spawn" + "." + "z", z);
cfg.set("spawn" + "." + "yaw", yaw);
cfg.set("spawn" + "." + "pitch", pitch);
try {
cfg.save(file);
} catch (IOException e) {
e.printStackTrace();
}
p.sendMessage("§6[ImpComs] §aSpawn erfolgreich gesetzt!");
} else {
if (args.length == 0) {
String world = cfg.getString("spawn" + "." + "world");
double x = cfg.getDouble("spawn" + "." + "x");
double y = cfg.getDouble("spawn" + "." + "y");
double z = cfg.getDouble("spawn" + "." + "z");
double yaw = cfg.getDouble("spawn" + "." + "yaw");
double pitch = cfg.getDouble("spawn" + "." + "pitch");
Location loc = new Location(Bukkit.getWorld(world), x, y, z);
loc.setPitch((float) pitch);
loc.setYaw((float) yaw);
p.teleport(loc);
p.sendMessage("§6[ImpComs] §aDu wurdest zum Spawn teleportiert!");
} else {
p.sendMessage("§6[ImpComs] §cNutze /spawn [set]");
}
}
} else {
sender.sendMessage("§6[ImpComs] §cDieser Befehl ist nur fuer Spieler gedacht!");
}
//SCRIPT ENDE
return true;
}
}
Code:
[17:37:46] [Server thread/INFO]: MrPyro13 issued server command: /spawn set
[17:37:51] [Server thread/INFO]: MrPyro13 issued server command: /spawn
[17:37:51] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'spawn' in plugin ImpComs v0.1
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:175) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at org.bukkit.craftbukkit.v1_7_R1.CraftServer.dispatchCommand(CraftServer.java:683) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.PlayerConnection.handleCommand(PlayerConnection.java:952) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java:814) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.PacketPlayInChat.a(PacketPlayInChat.java:28) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.PacketPlayInChat.handle(PacketPlayInChat.java:47) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:655) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:250) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:545) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:457) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
Caused by: java.lang.ArrayIndexOutOfBound***ception: 0
at de.mrpyro13.ImpComs.iSpawn_Command.onCommand(iSpawn_Command.java:35) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
... 13 more
Code:
spawn:
world: world
x: -1271.5495737916647
y: 4.0
z: -131.46951023602082
yaw: -356.390869140625
pitch: 87.7499771118164