mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
3.3.2
This commit is contained in:
parent
d4d9a9e148
commit
056f77a3ba
@ -13,7 +13,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
@CommandDeclaration(command = "help",
|
||||
description = "Get this help menu",
|
||||
aliases = {"he", "h", "?"},
|
||||
aliases = {"he", "?"},
|
||||
category = CommandCategory.INFO,
|
||||
usage="help [category|#]",
|
||||
permission="plots.use")
|
||||
@ -23,7 +23,7 @@ public class Help extends Command {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExecute(PlotPlayer player) {
|
||||
public boolean canExecute(PlotPlayer player, boolean message) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ public class MainCommand extends Command {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExecute(PlotPlayer player) {
|
||||
public boolean canExecute(PlotPlayer player, boolean message) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class Merge extends SubCommand {
|
||||
}
|
||||
}
|
||||
final PlotArea plotworld = plot.getArea();
|
||||
final double price = plotworld.PRICES.get("merge");
|
||||
final double price = plotworld.PRICES.containsKey("merge") ? plotworld.PRICES.get("merge") : 0;
|
||||
if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d && EconHandler.manager.getMoney(plr) < price) {
|
||||
sendMessage(plr, C.CANNOT_AFFORD_MERGE, price + "");
|
||||
return false;
|
||||
|
@ -62,7 +62,7 @@ public abstract class Command {
|
||||
public List<Command> getCommands(PlotPlayer player) {
|
||||
List<Command> commands = new ArrayList<>();
|
||||
for (Command cmd : allCommands) {
|
||||
if (cmd.canExecute(player)) {
|
||||
if (cmd.canExecute(player, false)) {
|
||||
commands.add(cmd);
|
||||
}
|
||||
}
|
||||
@ -322,7 +322,6 @@ public abstract class Command {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!cmd.canExecute(player)) {
|
||||
Argument<?>[] reqArgs = cmd.getRequiredArguments();
|
||||
if ((reqArgs != null) && (reqArgs.length > 0)) {
|
||||
boolean failed = args.length > reqArgs.length;
|
||||
@ -338,7 +337,7 @@ public abstract class Command {
|
||||
return;
|
||||
}
|
||||
}
|
||||
C.NO_PERMISSION.send(player, cmd.getPermission());
|
||||
if (!cmd.canExecute(player, true)) {
|
||||
return;
|
||||
}
|
||||
cmd.execute(player, Arrays.copyOfRange(args, 1, args.length), confirm, whenDone);
|
||||
@ -395,8 +394,19 @@ public abstract class Command {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public boolean canExecute(PlotPlayer player) {
|
||||
return required.allows(player) && Permissions.hasPermission(player, getPermission());
|
||||
public boolean canExecute(PlotPlayer player, boolean message) {
|
||||
if (!required.allows(player)) {
|
||||
if (message) {
|
||||
MainUtil.sendMessage(player, required == RequiredType.PLAYER ? C.IS_CONSOLE : C.NOT_CONSOLE);
|
||||
}
|
||||
} else if (!Permissions.hasPermission(player, getPermission())) {
|
||||
if (message) {
|
||||
C.NO_PERMISSION.send(player, getPermission());
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean matches(String arg) {
|
||||
@ -440,11 +450,11 @@ public abstract class Command {
|
||||
String arg = args[0].toLowerCase();
|
||||
if (space) {
|
||||
Command cmd = getCommand(arg);
|
||||
return (cmd != null && cmd.canExecute(player)) ? (cmd.tab(player, Arrays.copyOfRange(args, 1, args.length), space)) : null;
|
||||
return (cmd != null && cmd.canExecute(player, false)) ? (cmd.tab(player, Arrays.copyOfRange(args, 1, args.length), space)) : null;
|
||||
} else {
|
||||
Set<Command> commands = new HashSet<Command>();
|
||||
for (Map.Entry<String, Command> entry : staticCommands.entrySet()) {
|
||||
if (entry.getKey().startsWith(arg) && entry.getValue().canExecute(player)) {
|
||||
if (entry.getKey().startsWith(arg) && entry.getValue().canExecute(player, false)) {
|
||||
commands.add(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +55,8 @@ public class SpongeCommand implements CommandCallable {
|
||||
final Set<String> tabOptions = new HashSet<>();
|
||||
final String arg = split[0].toLowerCase();
|
||||
ArrayList<String> labels = new ArrayList<>();
|
||||
for (final Command<PlotPlayer> cmd : MainCommand.getInstance().getCommands()) {
|
||||
final String label = cmd.getCommand();
|
||||
for (final Command cmd : MainCommand.getInstance().getCommands()) {
|
||||
final String label = cmd.toS();
|
||||
HashSet<String> aliases = new HashSet<>(cmd.getAliases());
|
||||
aliases.add(label);
|
||||
for (String alias : aliases) {
|
||||
|
@ -10,7 +10,7 @@ buildscript {
|
||||
}
|
||||
|
||||
group = 'com.intellectualcrafters'
|
||||
version = '3.3.1'
|
||||
version = '3.3.2'
|
||||
description = """PlotSquared"""
|
||||
|
||||
subprojects {
|
||||
|
Loading…
Reference in New Issue
Block a user