zLeqitEclipse
New Member
Hi, im coding an Essentials Plugin. Right Now i am at the /gamemode command. The Command is working fine but, when i want to give another player gamemode (/gamemode 1 NAME) its giving me an NullPointerEX. Im fetching the target Player by:
This is my exception in Console:
I hope anyone can help
Java:
Player target = mainClass.getServer().getPlayer(args[1]);
at de.zleqiteclipse.boxedessentials.Main.commands.gamemode.execute(gamemode.java:46)
at cn.nukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:257)
at cn.nukkit.Server.dispatchCommand(Server.java:764)
at cn.nukkit.Player.handleDataPacket(Player.java:2807)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at cn.nukkit.network.Network.processPackets(Network.java:268)
at cn.nukkit.network.Network.processBatch(Network.java:251)
at cn.nukkit.Player.handleDataPacket(Player.java:2103)
at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:156)
at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132)
at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:65)
at cn.nukkit.network.Network.processInterfaces(Network.java:152)
at cn.nukkit.Server.tick(Server.java:1137)
at cn.nukkit.Server.tickProcessor(Server.java:916)
at cn.nukkit.Server.start(Server.java:893)
at cn.nukkit.Server.<init>(Server.java:578)
at cn.nukkit.Nukkit.main(Nukkit.java:112)
> 03:23:59 [ERROR] Throwing
java.lang.NullPointerException: null
at de.zleqiteclipse.boxedessentials.Main.commands.gamemode.execute(gamemode.java:46) ~[?:?]
at cn.nukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:257) ~[server.jar:?]
at cn.nukkit.Server.dispatchCommand(Server.java:764) ~[server.jar:?]
at cn.nukkit.Player.handleDataPacket(Player.java:2807) ~[server.jar:?]
at java.util.ArrayList.forEach(ArrayList.java:1257) [?:1.8.0_242]
at cn.nukkit.network.Network.processPackets(Network.java:268) [server.jar:?]
at cn.nukkit.network.Network.processBatch(Network.java:251) [server.jar:?]
at cn.nukkit.Player.handleDataPacket(Player.java:2103) [server.jar:?]
at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:156) [server.jar:?]
at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132) [server.jar:?]
at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:65) [server.jar:?]
at cn.nukkit.network.Network.processInterfaces(Network.java:152) [server.jar:?]
at cn.nukkit.Server.tick(Server.java:1137) [server.jar:?]
at cn.nukkit.Server.tickProcessor(Server.java:916) [server.jar:?]
at cn.nukkit.Server.start(Server.java:893) [server.jar:?]
at cn.nukkit.Server.<init>(Server.java:578) [server.jar:?]
at cn.nukkit.Nukkit.main(Nukkit.java:112) [server.jar:?]
at cn.nukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:257)
at cn.nukkit.Server.dispatchCommand(Server.java:764)
at cn.nukkit.Player.handleDataPacket(Player.java:2807)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at cn.nukkit.network.Network.processPackets(Network.java:268)
at cn.nukkit.network.Network.processBatch(Network.java:251)
at cn.nukkit.Player.handleDataPacket(Player.java:2103)
at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:156)
at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132)
at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:65)
at cn.nukkit.network.Network.processInterfaces(Network.java:152)
at cn.nukkit.Server.tick(Server.java:1137)
at cn.nukkit.Server.tickProcessor(Server.java:916)
at cn.nukkit.Server.start(Server.java:893)
at cn.nukkit.Server.<init>(Server.java:578)
at cn.nukkit.Nukkit.main(Nukkit.java:112)
> 03:23:59 [ERROR] Throwing
java.lang.NullPointerException: null
at de.zleqiteclipse.boxedessentials.Main.commands.gamemode.execute(gamemode.java:46) ~[?:?]
at cn.nukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:257) ~[server.jar:?]
at cn.nukkit.Server.dispatchCommand(Server.java:764) ~[server.jar:?]
at cn.nukkit.Player.handleDataPacket(Player.java:2807) ~[server.jar:?]
at java.util.ArrayList.forEach(ArrayList.java:1257) [?:1.8.0_242]
at cn.nukkit.network.Network.processPackets(Network.java:268) [server.jar:?]
at cn.nukkit.network.Network.processBatch(Network.java:251) [server.jar:?]
at cn.nukkit.Player.handleDataPacket(Player.java:2103) [server.jar:?]
at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:156) [server.jar:?]
at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132) [server.jar:?]
at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:65) [server.jar:?]
at cn.nukkit.network.Network.processInterfaces(Network.java:152) [server.jar:?]
at cn.nukkit.Server.tick(Server.java:1137) [server.jar:?]
at cn.nukkit.Server.tickProcessor(Server.java:916) [server.jar:?]
at cn.nukkit.Server.start(Server.java:893) [server.jar:?]
at cn.nukkit.Server.<init>(Server.java:578) [server.jar:?]
at cn.nukkit.Nukkit.main(Nukkit.java:112) [server.jar:?]
I hope anyone can help