Add xp-points-paywall=

This commit is contained in:
TheLonelyWolf1 2021-08-06 16:27:22 +02:00 committed by GitHub
parent 3d85050e0f
commit f9d3b9780c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,6 +304,27 @@ public class CommandTags {
return PaywallOutput.Blocked;
}
}
case "xp-points-paywall=": {
//if player uses xp-points-paywall= [price]
try {
int balance = Utils.getPlayerExp(p);
if (balance >= Integer.parseInt(command.split("\\s")[1])) {
Utils.changePlayerExp(p, Integer.parseInt(command.split("\\s")[1]));
//if the message is empty don't send
plugin.tex.sendString(p,Objects.requireNonNull(plugin.config.getString("purchase.xppoints.success")).replaceAll("%cp-args%", command.split("\\s")[1]));
return PaywallOutput.Passed;
} else {
plugin.tex.sendString(p, plugin.config.getString("purchase.xppoints.failure"));
return PaywallOutput.Blocked;
}
} catch (Exception buyc) {
plugin.debug(buyc,p);
plugin.tex.sendString(p, tag + plugin.config.getString("config.format.error") + " " + "commands: " + command);
return PaywallOutput.Blocked;
}
}
}
return PaywallOutput.NotApplicable;
}