MrJxnas Posted June 21, 2019 Share Posted June 21, 2019 Hallo, Ich habe ein Warp Plugin programmiert aber irgendwie geht es nicht hie ist der code: package de.mrjxnas.warp; import java.io.File; import java.io.IOException; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; 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 WarpCommand implements CommandExecutor { private File file = new File("plugins/Warp", "warps.yml"); private FileConfiguration cfg = YamlConfiguration.loadConfiguration(this.file); private String err_need_player = "§cDu musst ein Spieler sein!"; private String err_need_argument = "§cZu wenig Argumente."; @Override public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { Player player = null; if(cs instanceof Player) { player = (Player) cs; } if(label.equalsIgnoreCase("warp")) { if(player != null) { if(args.length >= 1) { String str = "warps." + args[0].toLowerCase() + "."; try { World w = Bukkit.getWorld(this.cfg.getString(str + "Server")); if(w == null) { cs.sendMessage("§cDer Warp liegt in einer unbekannten Welt."); return true; } double x = this.cfg.getDouble(str + "X"); double y = this.cfg.getDouble(str + "Y"); double z = this.cfg.getDouble(str + "Z"); double yaw = this.cfg.getDouble(str + "yaw"); double pitch = this.cfg.getDouble(str + "pitch"); Location loc = new Location(w, x, y, z, (float) yaw, (float)pitch); player.teleport(loc); cs.sendMessage("§aDu wurdest zuum Warp " + args[0].toLowerCase() + "§ateleportiert!"); }catch(NullPointerException exc) { cs.sendMessage("§cDer Warp " + args[0].toLowerCase() + "§cexistiert nicht!"); } }else{ cs.sendMessage(this.err_need_argument); } }else { cs.sendMessage(this.err_need_player); } }else if(label.equalsIgnoreCase("setwarp")) { if (player != null) { if (args.length >= 1) { Location loc = player.getLocation(); String str = "warps." + args[0].toLowerCase() + "."; this.cfg.set(str + "Server", loc.getWorld().getName()); this.cfg.set(str + "x", loc.getX()); this.cfg.set(str + "y", loc.getY()); this.cfg.set(str + "z", loc.getZ()); this.cfg.set(str + "yaw", loc.getYaw()); this.cfg.set(str + "pitch", loc.getPitch()); try { this.cfg.save(this.file); cs.sendMessage("§aWarp" + args[0].toLowerCase() + "§a erfolgreich gesetzt!"); } catch (IOException e) { e.printStackTrace(); } }else { cs.sendMessage(this.err_need_argument); } }else { cs.sendMessage(this.err_need_player); } }else if (label.equalsIgnoreCase("delwarp")) { if (args.length >= 1) { this.cfg.set("warps." + args[0].toLowerCase(), null); try { this.cfg.save(this.file); cs.sendMessage("§aWarp" + args[0].toLowerCase() + "§a erfolgreich gelöscht!"); } catch (IOException e) { e.printStackTrace(); } }else { cs.sendMessage(this.err_need_argument); } }else if (label.equalsIgnoreCase("warps")) { String str = "Warps: "; for (String warp : this.cfg.getConfigurationSection("warps").getKeys(false)) { str += warp + " "; } cs.sendMessage(str); } return false; } } Und in der Console : at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:741) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at org.bukkit.Bukkit.reload(Bukkit.java:535) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_211] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_211] at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot-1.8.8.jar:git-Spigot-21fe707-e1ebe52] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_211] Danke für Hilfe Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now