mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Minor fixes
This commit is contained in:
@ -197,7 +197,7 @@ public class MainCommand extends Command {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) {
|
||||
public void execute(final PlotPlayer player, String[] args, RunnableVal3<Command, Runnable, Runnable> confirm, RunnableVal2<Command, CommandResult> whenDone) {
|
||||
// Clear perm caching //
|
||||
player.deleteMeta("perm");
|
||||
// Optional command scope //
|
||||
@ -223,6 +223,37 @@ public class MainCommand extends Command {
|
||||
// Trim command
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
}
|
||||
if (args.length >= 2 && args[0].charAt(0) == '-') {
|
||||
switch (args[0].substring(1)) {
|
||||
case "f":
|
||||
confirm = new RunnableVal3<Command, Runnable, Runnable>() {
|
||||
@Override
|
||||
public void run(final Command cmd, final Runnable success, final Runnable failure) {
|
||||
if (EconHandler.manager != null) {
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area != null) {
|
||||
Expression<Double> priceEval = area.PRICES.get(cmd.getFullId());
|
||||
Double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
|
||||
if (price != 0d && EconHandler.manager.getMoney(player) < price) {
|
||||
if (failure != null) {
|
||||
failure.run();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (success != null) {
|
||||
success.run();
|
||||
}
|
||||
}
|
||||
};
|
||||
args = Arrays.copyOfRange(args, 1, args.length);
|
||||
break;
|
||||
default:
|
||||
C.INVALID_COMMAND_FLAG.send(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
super.execute(player, args, confirm, whenDone);
|
||||
|
@ -452,6 +452,10 @@ public enum C {
|
||||
INVALID_PLAYER_WAIT("$2Player not found: $1%s$2, fetching it. Try again soon.", "Errors"),
|
||||
INVALID_PLAYER("$2Player not found: $1%s$2.", "Errors"),
|
||||
INVALID_PLAYER_OFFLINE("$2The player must be online: $1%s.", "Errors"),
|
||||
/*
|
||||
* Command flag
|
||||
*/
|
||||
INVALID_COMMAND_FLAG("$2Invalid command flag: %s0", "Errors"),
|
||||
/*
|
||||
* Unknown Error
|
||||
*/
|
||||
|
Reference in New Issue
Block a user