Check if give is not negative

This commit is contained in:
Debucquoy Anthony 2024-01-26 23:38:12 +01:00
parent 56b7ae97ef
commit 402b94a797
Signed by: tonitch
GPG Key ID: A78D6421F083D42E
3 changed files with 10 additions and 7 deletions

View File

@ -3,6 +3,10 @@
- [ ] i18n
- [-] Make Discord Webhoook for item changes
- [x] deathBan reset
- [ ] voids exchanges
- [x] voids exchanges
- [ ] chest name
- [ ] /void manage bring
- [ ] Dupe bug (respawn) -> Gamerule
- [x] /void give négatives values
- [ ] /void give afficher title
- subtitle + chat

View File

@ -44,7 +44,7 @@ public class VoidCommands implements CommandExecutor, TabCompleter{
case "give":
if(args.length < 2) return false;
Player target = Bukkit.getPlayer(args[1]);
if(target != null && sender instanceof Player ply)
if(target != null && sender instanceof Player ply && Integer.parseInt(args[2]) > 0)
Voids.give(ply,target, Integer.parseInt(args[2]));
break;
case "event":

View File

@ -48,12 +48,11 @@ public final class Voids implements Listener{
}
public static boolean give(Player giver, Player receiver, int amount){
if(subtract(giver, amount, false)){
if( amount < 0 || !subtract(giver, amount, false))
return false;
add(receiver, amount);
return true;
}
return false;
}
public static HashMap<Player, Integer> scoreboard(){
HashMap<Player, Integer> ret = new HashMap<>();