More json stuff

This commit is contained in:
N0tMyFaultOG 2020-08-18 12:22:26 +02:00
parent d91357a807
commit 86cfeb76b6
5 changed files with 35 additions and 2 deletions

View File

@ -71,7 +71,7 @@ public class Condense extends SubCommand {
if (args.length != 2 && args.length != 3) { if (args.length != 2 && args.length != 3) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot condense <area> <start|stop|info> [radius]") Template.of("value", "/plot condense <area> <start | stop | info> [radius]")
); );
return false; return false;
} }

View File

@ -40,10 +40,14 @@ import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3; import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import java.util.Collection;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@CommandDeclaration(command = "grant", @CommandDeclaration(command = "grant",
category = CommandCategory.CLAIMING, category = CommandCategory.CLAIMING,
@ -132,4 +136,10 @@ public class Grant extends Command {
sendUsage(player); sendUsage(player);
return CompletableFuture.completedFuture(true); return CompletableFuture.completedFuture(true);
} }
@Override public Collection<Command> tab(final PlotPlayer player, String[] args, boolean space) {
return Stream.of("check", "add")
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
.map(value -> new Command(null, false, value, "plots.grant", RequiredType.NONE, null) {
}).collect(Collectors.toList());
}
} }

View File

@ -45,7 +45,7 @@ import java.util.List;
@CommandDeclaration(command = "inbox", @CommandDeclaration(command = "inbox",
description = "Review the comments for a plot", description = "Review the comments for a plot",
usage = "/plot inbox [inbox] [delete <index>|clear|page]", usage = "/plot inbox [inbox] [delete <index> | clear | page]",
permission = "plots.inbox", permission = "plots.inbox",
category = CommandCategory.CHAT, category = CommandCategory.CHAT,
requiredType = RequiredType.PLAYER) requiredType = RequiredType.PLAYER)

View File

@ -30,9 +30,16 @@ import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.query.PlotQuery;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import java.util.Collection;
import java.util.Collections;
import java.util.Locale;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@CommandDeclaration(command = "target", @CommandDeclaration(command = "target",
usage = "/plot target <<X;Z> | nearest>", usage = "/plot target <<X;Z> | nearest>",
description = "Target a plot with your compass", description = "Target a plot with your compass",
@ -79,4 +86,10 @@ public class Target extends SubCommand {
player.sendMessage(TranslatableCaption.of("compass.compass_target")); player.sendMessage(TranslatableCaption.of("compass.compass_target"));
return true; return true;
} }
@Override public Collection<Command> tab(final PlotPlayer player, String[] args, boolean space) {
return Stream.of("<X;Z>", "nearest")
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
.map(value -> new Command(null, false, value, "plots.target", RequiredType.NONE, null) {
}).collect(Collectors.toList());
}
} }

View File

@ -54,7 +54,11 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Collection;
import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
@ -263,4 +267,10 @@ public class Template extends SubCommand {
} }
return false; return false;
} }
@Override public Collection<Command> tab(final PlotPlayer player, String[] args, boolean space) {
return Stream.of("import", "export")
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
.map(value -> new Command(null, false, value, "plots.admin", RequiredType.NONE, null) {
}).collect(Collectors.toList());
}
} }