Code:
if (playerCommand.startsWith("givepoints")) {
try {
final String[] args = playerCommand.split(" ");
final String otherplayer = args[1];
final int point = Integer.parseInt(args[2]);
for (final Player player : PlayerHandler.players) {
if (player != null) {
if (player.playerName.equalsIgnoreCase(otherplayer)) {
final Client c2 = (Client) player;
c2.DonorPoints += point; //CHANGE THIS TO YOUR DONOR POINTS VARIABLE
c.sendMessage("<shad=60811334><img=4>You have given "
+ otherplayer + ", " + point
+ " Reward points.<img=4>");
c2.sendMessage("<shad=60811334><img=4>You have been given "
+ point + " Reward points by "
+ c.playerName + ".<img=4>");
}
}
}
} catch(Exception e) {
c.sendMessage("Player must be offline.");
}
}
Thats my command and it still doesnt works on players with spaces how can i fix it ?