- args.length can replace argc in C.
- Args.length will return a value of the length of a array but when using it at the end of the array, instead of array[length], do array[length-1] .
- Unlike C that we can use arg[0] to get the command, when doing OnCommand method, args[0] directly refers to the first parameter. This way, reading args[0] when there are no parameters will cause a NullPointerException.
- To get the command name, use Command.getName or use the label parameter.
Use (sender instanceof Player) to see whether if a player or a console issued the command.
2016/12/5
1.Remember to check if a method works correctly before using it to prevent a NullPointerException.
2.If a player is offline, getting that player may result in NullPointerException.
2016/12/6