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 - [ ] i18n
- [-] Make Discord Webhoook for item changes - [-] Make Discord Webhoook for item changes
- [x] deathBan reset - [x] deathBan reset
- [ ] voids exchanges - [x] voids exchanges
- [ ] chest name - [ ] chest name
- [ ] /void manage bring - [ ] /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": case "give":
if(args.length < 2) return false; if(args.length < 2) return false;
Player target = Bukkit.getPlayer(args[1]); 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])); Voids.give(ply,target, Integer.parseInt(args[2]));
break; break;
case "event": case "event":

View File

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