Check if give is not negative
This commit is contained in:
		| @ -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,11 +48,10 @@ public final class Voids implements Listener{ | ||||
| 	}  | ||||
|  | ||||
| 	public static boolean give(Player giver, Player receiver, int amount){ | ||||
| 		if(subtract(giver, amount, false)){ | ||||
| 			add(receiver, amount); | ||||
| 			return true; | ||||
| 		} | ||||
| 		return false; | ||||
| 		if(	amount < 0 || !subtract(giver, amount, false)) | ||||
| 			return false; | ||||
| 		add(receiver, amount); | ||||
| 		return true; | ||||
| 	} | ||||
|  | ||||
| 	public static HashMap<Player, Integer> scoreboard(){ | ||||
|  | ||||
		Reference in New Issue
	
	Block a user