::Givepts command for anyone who is using ospvp.
Code:
public class Givepts implements Command {
@Override
public void execute(Player c, String input) {
String[] args = input.split("-");
if (args.length != 2) {
c.sendMessage("The correct format is '::givepts-name-amount'.");
return;
}
Player player = PlayerHandler.getPlayer(args[0]);
if (player == null) {
c.sendMessage("The player '" + args[0] + "' could not be found, try again.");
return;
}
int amount = c.donatorPoints;
try {
amount = Integer.parseInt(args[1]);
} catch (NumberFormatException e) {
c.sendMessage("The level of rights must be a whole number.");
return;
}
player.donatorPoints += amount;
player.sendMessage("You have given " + amount + " to " + player + ".");
player.properLogout = true;
player.disconnected = true;
}
}