Only inform license owners of new IPs and HWIDs if the license was actually used

This commit is contained in:
Braydon 2023-06-02 00:49:41 -04:00
parent 3038e14b81
commit 36673af4d0

@ -171,6 +171,9 @@ public final class LicenseService {
} }
throw new LicenseExpiredException(); throw new LicenseExpiredException();
} }
try {
license.use(hashedIp, hwid); // Use the license
repository.save(license); // Save the used license
// Sending new IP log to the license owner // Sending new IP log to the license owner
if (newIp && discordService.isLogNewIpsToOwner()) { if (newIp && discordService.isLogNewIpsToOwner()) {
@ -194,10 +197,8 @@ public final class LicenseService {
.addField("HWID", "```" + hwid + "```", false) .addField("HWID", "```" + hwid + "```", false)
); );
} }
// Use the license
try { // Logging the license use
license.use(hashedIp, hwid);
repository.save(license); // Save the used license
log.info("License key '{}' for product '{}' was used by {} (HWID: {})", key, product, ip, hwid); log.info("License key '{}' for product '{}' was used by {} (HWID: {})", key, product, ip, hwid);
return license; return license;
} catch (APIException ex) { } catch (APIException ex) {