mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Fix
Fixes #724 Fixes flag remove for non list based flags when player lacks permission.
This commit is contained in:
parent
a8140f8cb0
commit
452efc4b08
@ -158,6 +158,10 @@ public class FlagCmd extends SubCommand {
|
|||||||
}
|
}
|
||||||
final Flag flag = FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase());
|
final Flag flag = FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase());
|
||||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase())) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
for (final String entry : args[2].split(",")) {
|
for (final String entry : args[2].split(",")) {
|
||||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + entry)) {
|
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + entry)) {
|
||||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + entry);
|
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + entry);
|
||||||
|
@ -59,6 +59,12 @@ public class Set extends SubCommand {
|
|||||||
|
|
||||||
public Set() {
|
public Set() {
|
||||||
component = new SetCommand() {
|
component = new SetCommand() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommand() {
|
||||||
|
return "set.component";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean set(PlotPlayer plr, final Plot plot, String value) {
|
public boolean set(PlotPlayer plr, final Plot plot, String value) {
|
||||||
final String world = plr.getLocation().getWorld();
|
final String world = plr.getLocation().getWorld();
|
||||||
@ -171,7 +177,7 @@ public class Set extends SubCommand {
|
|||||||
// components
|
// components
|
||||||
HashSet<String> components = new HashSet<String>(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
|
HashSet<String> components = new HashSet<String>(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
|
||||||
if (components.contains(args[0].toLowerCase())) {
|
if (components.contains(args[0].toLowerCase())) {
|
||||||
return component.set(plr, plot, StringMan.join(args, " "));
|
return component.onCommand(plr, Arrays.copyOfRange(args, 1, args.length));
|
||||||
}
|
}
|
||||||
// flag
|
// flag
|
||||||
{
|
{
|
||||||
|
@ -70,11 +70,11 @@ public abstract class Command<E extends CommandCaller> extends CommandManager {
|
|||||||
this.requiredType = requiredType;
|
this.requiredType = requiredType;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public RequiredType getRequiredType() {
|
public RequiredType getRequiredType() {
|
||||||
return this.requiredType;
|
return this.requiredType;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public void create() {
|
public void create() {
|
||||||
final Annotation annotation = getClass().getAnnotation(CommandDeclaration.class);
|
final Annotation annotation = getClass().getAnnotation(CommandDeclaration.class);
|
||||||
if (annotation == null) {
|
if (annotation == null) {
|
||||||
throw new RuntimeException("Command does not have a CommandDeclaration");
|
throw new RuntimeException("Command does not have a CommandDeclaration");
|
||||||
@ -91,13 +91,13 @@ public abstract class Command<E extends CommandCaller> extends CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
final public String toString() {
|
public String toString() {
|
||||||
return this.command;
|
return this.command;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean onCommand(final E plr, final String[] arguments);
|
public abstract boolean onCommand(final E plr, final String[] arguments);
|
||||||
|
|
||||||
final public int handle(final E plr, final String[] args) {
|
public int handle(final E plr, final String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
return super.handle(plr, "");
|
return super.handle(plr, "");
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ public abstract class Command<E extends CommandCaller> extends CommandManager {
|
|||||||
return super.handle(plr, s);
|
return super.handle(plr, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
final public String getCommand() {
|
public String getCommand() {
|
||||||
return this.command;
|
return this.command;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ public abstract class Command<E extends CommandCaller> extends CommandManager {
|
|||||||
return this.usage;
|
return this.usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public String getPermission() {
|
public String getPermission() {
|
||||||
if ((this.permission == null) || (this.permission.length() == 0)) {
|
if ((this.permission == null) || (this.permission.length() == 0)) {
|
||||||
this.permission = "plots." + command.toLowerCase();
|
this.permission = "plots." + command.toLowerCase();
|
||||||
}
|
}
|
||||||
@ -131,18 +131,18 @@ public abstract class Command<E extends CommandCaller> extends CommandManager {
|
|||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public Set<String> getAliases() {
|
public Set<String> getAliases() {
|
||||||
return this.aliases;
|
return this.aliases;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public Argument<?>[] getRequiredArguments() {
|
public Argument<?>[] getRequiredArguments() {
|
||||||
if (this.requiredArguments == null) {
|
if (this.requiredArguments == null) {
|
||||||
return new Argument<?>[0];
|
return new Argument<?>[0];
|
||||||
}
|
}
|
||||||
return this.requiredArguments;
|
return this.requiredArguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public CommandCategory getCategory() {
|
public CommandCategory getCategory() {
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
return CommandCategory.DEBUG;
|
return CommandCategory.DEBUG;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user