You are not logged in.

  • Login
Bitte besucht unser neues Forum unter https://forum.nitrado.net | Please visit our new Forum at https://forum.nitrado.net

Jongartv

User / Kunde

  • "Jongartv" started this thread

Posts: 20

  • Send private message

1

Monday, June 4th 2018, 5:22pm

Fehler bei teleportiren in andere welt

Hallo zusammen,
ich lerne gerade programmieren und habe einen fehler wenn ich mich in eine andere welt teleportieren möchte.



package eu.Jongartv.lernen.commands;

import org.bukkit.Location;
import org.bukkit.Material;
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.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import eu.Jongartv.lernen.main.Main;

public class Schlacht implements CommandExecutor, Listener {

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player p = (Player) sender;
if(p.hasPermission("schlacht.list")) {
if(args.length == 1) {

if(args[0].equalsIgnoreCase("setspawn")) {
if(p.hasPermission("schlacht.setspawn")) {
FileConfiguration c = Main.getPlugin().getConfig();
Location l =p.getLocation();
c.set("Schlacht.World", l.getWorld().getName());
c.set("Schlacht.X", l.getX());
c.set("Schlacht.Y", l.getY());
c.set("Schlacht.Z", l.getZ());
c.set("Schlacht.Yaw", l.getYaw());
c.set("Schlacht.Pitch", l.getPitch());
Main.getPlugin().saveConfig();

p.sendMessage("§f[§l§bSchlacht§f] §cDu hast den Spawn erfolgreich gesetzt!");
}
}
} else {
p.sendMessage("§f[§l§bSchlacht§f] §c/schlacht setspawn");
p.sendMessage("§f[§l§bSchlacht§f] §c/schlacht gospawn");
}


}else
p.sendMessage("§f[§l§bSchlacht§f] §cDazu hast du keine berechtigung!");
}
if(sender instanceof Player) {
Player p = (Player) sender;
if(args.length == 1) {
if(args[0].equalsIgnoreCase("gospawn")) {
if(p.hasPermission("schlacht.gospawn")) {
ItemStack item = new ItemStack(Material.SNOW_BALL);
ItemMeta imeta = item.getItemMeta();
imeta.setDisplayName("§bSchneeball");
item.setItemMeta(imeta);
item.setAmount(16);
p.getInventory().setItem(0, item);
World w = p.getServer().getWorld("w");
p.getLocation().setWorld(w);
p.teleport(w.getSpawnLocation());



}


}
}
}
return false;
}

@EventHandler
public void onWurf(PlayerInteractEvent e) {
if(e.hasItem()) {
ItemStack item1 = e.getItem();
if(item1.getType() == Material.SNOW_BALL) {
item1.setAmount(17);
}
}
}
}

Hier der fehler:

org.bukkit.command.CommandException: Unhandled exception executing command 'schlacht' in plugin lernen v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:649) ~[spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1397) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1232) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_25]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_25]
at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25]
Caused by: java.lang.NullPointerException
at eu.Jongartv.lernen.commands.Schlacht.onCommand(Schlacht.java:65) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot-1.12.2.jar:git-Spigot-3d850ec-809c399]
... 15 more
>

So dass wars ich hoffe ihr könnt mir helfen

MedPlex

Nitrado Mitarbeiter

  • "MedPlex" is male

Posts: 90

Location: Karlsruhe

Occupation: Customer Care Agent Nitrado

  • Send private message

2

Tuesday, June 5th 2018, 4:56pm

Kannst du hierbei einmal deinen Server komplett Starten und uns den Log mal anhängen?

Lg Max 8)
In der Nacht fällt der Boden von den Wänden :whistling:

Du brauchst nen Server? Nitrado.net!

xtrumb

User / Kunde

  • "xtrumb" is male

Posts: 2,295

Location: hier

Occupation: Fachinformatiker für Systemintegration

Thanks: 16

  • Send private message

3

Wednesday, June 6th 2018, 7:27am

Zeile 65 ist Null
Mit freundlichen Grüßen
TrueMB

Dienstleistungs Service
Unser Csgo Team

Bitte besucht unser neues Forum unter https://forum.nitrado.net| Please visit our new Forum at https://forum.nitrado.net