Check if give is not negative
This commit is contained in:
parent
56b7ae97ef
commit
402b94a797
6
TODO.md
6
TODO.md
@ -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
|
||||
|
@ -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":
|
||||
|
@ -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<>();
|
||||
|
Loading…
Reference in New Issue
Block a user