From f9d3b9780cbb9c4e8306ffa0f307c963a81af7fb Mon Sep 17 00:00:00 2001 From: TheLonelyWolf1 <42873246+TheLonelyWolf1@users.noreply.github.com> Date: Fri, 6 Aug 2021 16:27:22 +0200 Subject: [PATCH] Add xp-points-paywall= --- .../commandtags/CommandTags.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/me/rockyhawk/commandpanels/commandtags/CommandTags.java b/src/me/rockyhawk/commandpanels/commandtags/CommandTags.java index c702485..6987e9e 100644 --- a/src/me/rockyhawk/commandpanels/commandtags/CommandTags.java +++ b/src/me/rockyhawk/commandpanels/commandtags/CommandTags.java @@ -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; }