Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from ReefRealm/bountysystem
Browse files Browse the repository at this point in the history
Improve bounty management in SkyPVP module
  • Loading branch information
mathiasclari authored Dec 25, 2023
2 parents c81a0c1 + 214f7d3 commit 1a6c7c8
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public void execute(CommandSender sender, String[] args) {
player.sendMessage("That player is not online.");
return;
}
if (player.equals(target)) {
player.sendMessage("You cannot set a bounty on yourself.");
return;
}

int value;
try {
Expand All @@ -81,12 +85,12 @@ public void execute(CommandSender sender, String[] args) {
}
if (MySQL.checkifBountyExist(target.getUniqueId().toString())) {
MySQL.setBounty(target.getUniqueId().toString(), value);
MySQL.removeCoins(player.getUniqueId().toString(), value);
player.sendMessage("Set " + target.getName() + "'s bounty to " + value + ".");
} else {
MySQL.createBounty(target.getUniqueId().toString(), value);
player.sendMessage("Created " + target.getName() + "'s bounty to " + value + ".");
}
MySQL.createBounty(target.getUniqueId().toString(), value);
MySQL.removeCoins(player.getUniqueId().toString(), value);
player.sendMessage("Set " + target.getName() + "'s bounty to " + value + ".");
} else {
player.sendMessage("Invalid command. Use /bounty, /bounty add <player> <value>, /bounty remove <player>, or /bounty set <player> <value>.");
}
Expand Down

0 comments on commit 1a6c7c8

Please sign in to comment.