AtlasMediaGroup / IcarusMod

The Superior Freedom Network custom plugin.
Other
8 stars 13 forks source link

Reporting is a tad broken #162

Closed Wild1145 closed 8 years ago

Wild1145 commented 8 years ago

When you try to report a player that is not there the plugin simply returns the parameters.

[17:36:23] [Server thread/INFO]: Wild1145 issued server command: /report test fake
[17:36:23] [Server thread/ERROR]: null
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_77]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_77]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_77]
    at com.superiornetworks.icarus.commands.ICM_BlankCommand.onCommand(ICM_BlankCommand.java:36) [IcarusMod.jar:?]
    at com.superiornetworks.icarus.commands.ICM_Command$ReflectCommand.execute(ICM_Command.java:195) [IcarusMod.jar:?]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [server.jar:git-Spigot-ccb6016-f92e01b]
    at org.bukkit.craftbukkit.v1_9_R1.CraftServer.dispatchCommand(CraftServer.java:645) [server.jar:git-Spigot-ccb6016-f92e01b]
    at net.minecraft.server.v1_9_R1.PlayerConnection.handleCommand(PlayerConnection.java:1350) [server.jar:git-Spigot-ccb6016-f92e01b]
    at net.minecraft.server.v1_9_R1.PlayerConnection.a(PlayerConnection.java:1185) [server.jar:git-Spigot-ccb6016-f92e01b]
    at net.minecraft.server.v1_9_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [server.jar:git-Spigot-ccb6016-f92e01b]
    at net.minecraft.server.v1_9_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [server.jar:git-Spigot-ccb6016-f92e01b]
    at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-Spigot-ccb6016-f92e01b]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_77]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_77]
    at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45) [server.jar:git-Spigot-ccb6016-f92e01b]
    at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:721) [server.jar:git-Spigot-ccb6016-f92e01b]
    at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400) [server.jar:git-Spigot-ccb6016-f92e01b]
    at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:660) [server.jar:git-Spigot-ccb6016-f92e01b]
    at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:559) [server.jar:git-Spigot-ccb6016-f92e01b]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_77]
Caused by: java.lang.NullPointerException
    at com.superiornetworks.icarus.ICM_Rank.getRank(ICM_Rank.java:50) ~[?:?]
    at com.superiornetworks.icarus.ICM_Rank.isRankOrHigher(ICM_Rank.java:38) ~[?:?]
    at com.superiornetworks.icarus.commands.Command_report.onCommand(Command_report.java:66) ~[?:?]
    ... 21 more
mgejay commented 8 years ago

There is never an instance to catch where player == null. After you define the reported player, the if statement needs to come right after that.

Player Reported = getPlayer(args[0]) if (Reported == null) { sender.sendMessage(ChatColor.RED + "Player not found!"); return true; }