PlotSquared/Core/src/main/resources/addplots.js

17 lines
767 B
JavaScript
Raw Normal View History

/*
This will increase a player's allowed plots by the provided value
/plot debugexec runasync addplots.js <player> <amount>
*/
var uuid = UUIDHandler.getUUID('%s0', null);
if (uuid === null) {
2019-02-04 14:59:11 +01:00
C_INVALID_PLAYER.send(PlotPlayer, '%s0');
2019-04-24 00:48:22 +02:00
} else if (!MathMan.class.static.isInteger('%s1')) {
C_NOT_VALID_NUMBER.send(PlotPlayer, '(0, ' + Settings.MAX_PLOTS + ')');
2019-04-24 00:48:22 +02:00
} else {
var amount = parseInt('%s1');
var pp = IMP.wrapPlayer(UUIDHandler.getUUIDWrapper().getOfflinePlayer(uuid).player);
var allowed = pp.getAllowedPlots();
MainUtil.class.static.sendMessage(PlotPlayer, '$4Setting permission: plots.plot.' + (allowed + amount) + ' for %s0');
IMP.getEconomyHandler().setPermission("", pp.getName(), 'plots.plot.' + (allowed + amount), true);
}