forked from Upstream/CommandPanels
Add xp-points-paywall=
This commit is contained in:
parent
3d85050e0f
commit
f9d3b9780c
@ -304,6 +304,27 @@ public class CommandTags {
|
|||||||
return PaywallOutput.Blocked;
|
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;
|
return PaywallOutput.NotApplicable;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user