Skip to content

Commit

Permalink
Change -override and -absolute to use two dashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dscalzi committed May 6, 2019
1 parent 9e5cf68 commit 6bac652
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions ZipExtractor-Bukkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ bukkit {
setDefault('OP')
}
'zipextractor.admin.override.extract' {
description = 'Allow usage of /ZipExtractor extract -override'
description = 'Allow usage of /ZipExtractor extract --override'
setDefault('OP')
}
'zipextractor.admin.override.compress' {
description = 'Allow usage of /ZipExtractor compress -override'
description = 'Allow usage of /ZipExtractor compress --override'
setDefault('OP')
}
'zipextractor.admin.src' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void cmdExtract(ICommandSender sender, String[] args) {
} else {

boolean override = !cm.warnOnConflitcts();
if (args.length >= 2 && args[1].equalsIgnoreCase("-override")) {
if (args.length >= 2 && args[1].equalsIgnoreCase("--override")) {
if (!sender.hasPermission("zipextractor.admin.override.extract")) {
mm.noPermission(sender);
return;
Expand Down Expand Up @@ -210,7 +210,7 @@ public void cmdCompress(ICommandSender sender, String[] args) {
}

boolean override = !cm.warnOnConflitcts();
if (args.length >= 2 && args[1].equalsIgnoreCase("-override")) {
if (args.length >= 2 && args[1].equalsIgnoreCase("--override")) {
if (!sender.hasPermission("zipextractor.admin.override.compress")) {
mm.noPermission(sender);
return;
Expand Down Expand Up @@ -238,7 +238,7 @@ public void cmdSrc(ICommandSender sender, String[] args) {
mm.noPermission(sender);
return;
}
if (args.length > 1 && args[1].equalsIgnoreCase("-absolute")) {
if (args.length > 1 && args[1].equalsIgnoreCase("--absolute")) {
Optional<File> srcOpt = cm.getSourceFile();
if (!srcOpt.isPresent()) {
mm.invalidPath(sender, cm.getSourceRaw(), "source");
Expand All @@ -255,7 +255,7 @@ public void cmdDest(ICommandSender sender, String[] args) {
mm.noPermission(sender);
return;
}
if (args.length > 1 && args[1].equalsIgnoreCase("-absolute")) {
if (args.length > 1 && args[1].equalsIgnoreCase("--absolute")) {
Optional<File> destOpt = cm.getDestFile();
if (!destOpt.isPresent()) {
mm.invalidPath(sender, cm.getDestRaw(), "destination");
Expand Down Expand Up @@ -394,8 +394,8 @@ public List<String> tabComplete(ICommandSender sender, String[] args) {
boolean d = sender.hasPermission("zipextractor.admin.compress")
&& "compress".startsWith(arg0Normal);
if (a | b)
if ("-absolute".startsWith(args[1].toLowerCase()))
ret.add("-absolute");
if ("--absolute".startsWith(args[1].toLowerCase()))
ret.add("--absolute");
if (sender.hasPermission("zipextractor.admin.use") && "help".startsWith(arg0Normal)) {
String[] newArgs = new String[args.length - 1];
System.arraycopy(args, 1, newArgs, 0, args.length - 1);
Expand All @@ -407,8 +407,8 @@ public List<String> tabComplete(ICommandSender sender, String[] args) {
}
if (((c && sender.hasPermission("zipextractor.admin.override.extract"))
|| (d && sender.hasPermission("zipextractor.admin.override.compress")))
&& "-override".startsWith(args[1].toLowerCase())) {
ret.add("-override");
&& "--override".startsWith(args[1].toLowerCase())) {
ret.add("--override");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,18 @@ public void warnOfConflicts(ICommandSender sender, int amt) {
"Warning, this extraction will override " + "&o" + Integer.toString(amt) + cError + " file"
+ (amt == 1 ? "" : "s") + ". To view " + (amt == 1 ? "this" : "these") + " file"
+ (amt == 1 ? "" : "s") + " run the command " + "&o" + "/ze extract view [page]");
sendError(sender, "To proceed with the extraction: " + "&o" + "/ze extract -override");
sendError(sender, "To proceed with the extraction: " + "&o" + "/ze extract --override");
}

public void destExists(ICommandSender sender) {
sendError(sender, "Warning, the destination of this compression already exists.");
sendError(sender, "To proceed with the compression: " + "&o" + "/ze compress -override");
sendError(sender, "To proceed with the compression: " + "&o" + "/ze compress --override");
}

public void destExistsPiped(ICommandSender sender, File path) {
sendError(sender, "Warning, an intermediate destination of this piped compression already exists.");
sendError(sender, "&o" + path.toPath().toAbsolutePath().normalize().toString());
sendError(sender, "To proceed with the compression: " + "&o" + "/ze compress -override");
sendError(sender, "To proceed with the compression: " + "&o" + "/ze compress --override");
}

public void noWarnData(ICommandSender sender) {
Expand Down Expand Up @@ -361,9 +361,9 @@ public void commandList(ICommandSender sender, int page) {
if (sender.hasPermission("zipextractor.admin.compress"))
cmds.add(listPrefix + "/ZipExtractor compress " + cTrim + "- Compress the specified file.");
if (sender.hasPermission("zipextractor.admin.src"))
cmds.add(listPrefix + "/ZipExtractor src [-absolute] " + cTrim + "- View the source filepath.");
cmds.add(listPrefix + "/ZipExtractor src [--absolute] " + cTrim + "- View the source filepath.");
if (sender.hasPermission("zipextractor.admin.dest"))
cmds.add(listPrefix + "/ZipExtractor dest [-absolute] " + cTrim + "- View the destination filepath.");
cmds.add(listPrefix + "/ZipExtractor dest [--absolute] " + cTrim + "- View the destination filepath.");
if (sender.hasPermission("zipextractor.admin.setsrc"))
cmds.add(listPrefix + "/ZipExtractor setsrc <path> " + cTrim + "- Set the source's filepath.");
if (sender.hasPermission("zipextractor.admin.setdest"))
Expand Down Expand Up @@ -429,7 +429,7 @@ public void commandInfo(ICommandSender sender, String cmd) {
return;
}
sendMessage(sender, cPrimary
+ "View the currently set source file path. To view the absolute path, run the command as /ZipExtractor src -absolute");
+ "View the currently set source file path. To view the absolute path, run the command as /ZipExtractor src --absolute");
return;
}
if (cmd.equalsIgnoreCase("dest")) {
Expand All @@ -438,7 +438,7 @@ public void commandInfo(ICommandSender sender, String cmd) {
return;
}
sendMessage(sender, cPrimary
+ "View the currently set destitation file path. To view the absolute path, run the command as /ZipExtractor dest -absolute");
+ "View the currently set destitation file path. To view the absolute path, run the command as /ZipExtractor dest --absolute");
return;
}
if (cmd.equalsIgnoreCase("setsrc")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public void onPostInit(GamePostInitializationEvent event) {
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor.")).id(plugin.getId() + ".admin.use").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor extract.")).id(plugin.getId() + ".admin.extract").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor compress.")).id(plugin.getId() + ".admin.compress").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor extract -override.")).id(plugin.getId() + ".admin.override.extract").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor compress -override.")).id(plugin.getId() + ".admin.override.compress").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor extract --override.")).id(plugin.getId() + ".admin.override.extract").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor compress --override.")).id(plugin.getId() + ".admin.override.compress").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor src.")).id(plugin.getId() + ".admin.src").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor dest.")).id(plugin.getId() + ".admin.dest").register();
opdb.assign(PermissionDescription.ROLE_ADMIN, true).description(Text.of("Allow usage of /ZipExtractor setsrc.")).id(plugin.getId() + ".admin.setsrc").register();
Expand Down

0 comments on commit 6bac652

Please sign in to comment.