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
|
- [ ] 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
|
||||||
|
@ -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":
|
||||||
|
@ -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(){
|
||||||
|
Loading…
Reference in New Issue
Block a user