Addressing more issues

This commit is contained in:
NotMyFault 2021-03-28 17:39:02 +02:00
parent 7591d88d00
commit 30d3a458e2
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
5 changed files with 40 additions and 7 deletions

View File

@ -294,7 +294,9 @@ public class Cluster extends SubCommand {
} }
} }
DBFunc.delete(cluster); DBFunc.delete(cluster);
player.sendMessage(TranslatableCaption.of("cluster.cluster_deleted")); player.sendMessage(TranslatableCaption.of("cluster.cluster_deleted"), Template.of("cluster",
String.valueOf(cluster)
));
return true; return true;
} }
case "res": case "res":

View File

@ -58,7 +58,7 @@ import java.util.stream.Stream;
@CommandDeclaration(command = "debug", @CommandDeclaration(command = "debug",
category = CommandCategory.DEBUG, category = CommandCategory.DEBUG,
usage = "/plot debug [msg]", usage = "/plot debug",
permission = "plots.admin") permission = "plots.admin")
public class Debug extends SubCommand { public class Debug extends SubCommand {

View File

@ -25,6 +25,7 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.Caption; import com.plotsquared.core.configuration.caption.Caption;
import com.plotsquared.core.configuration.caption.StaticCaption; import com.plotsquared.core.configuration.caption.StaticCaption;
@ -34,8 +35,18 @@ import com.plotsquared.core.permissions.Permission;
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.plot.flag.implementations.HideInfoFlag; import com.plotsquared.core.plot.flag.implementations.HideInfoFlag;
import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.TabCompletions;
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.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@CommandDeclaration(command = "info", @CommandDeclaration(command = "info",
aliases = "i", aliases = "i",
usage = "/plot info <id> [-f to force info]", usage = "/plot info <id> [-f to force info]",
@ -153,6 +164,26 @@ public class Info extends SubCommand {
return true; return true;
} }
@Override
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
final List<String> completions = new LinkedList<>();
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO_FORCE)) {
completions.add("-f");
}
final List<Command> commands = completions.stream().filter(completion -> completion
.toLowerCase()
.startsWith(args[0].toLowerCase()))
.map(completion -> new Command(null, true, completion, "", RequiredType.PLAYER, CommandCategory.INFO) {
}).collect(Collectors.toCollection(LinkedList::new));
if (Permissions.hasPermission(player, Permission.PERMISSION_AREA_INFO_FORCE) && args[0].length() > 0) {
commands.addAll(TabCompletions.completePlayers(args[0], Collections.emptyList()));
}
return commands;
}
private Caption getCaption(String string) { private Caption getCaption(String string) {
switch (string) { switch (string) {
case "trusted": case "trusted":

View File

@ -57,9 +57,9 @@ import java.util.stream.Collectors;
@CommandDeclaration(command = "schematic", @CommandDeclaration(command = "schematic",
permission = "plots.schematic", permission = "plots.schematic",
aliases = {"sch", "schem"}, aliases = "schem",
category = CommandCategory.SCHEMATIC, category = CommandCategory.SCHEMATIC,
usage = "/plot schematic <save | saveall | paste>") usage = "/plot schematic <save | saveall | paste | list>")
public class SchematicCmd extends SubCommand { public class SchematicCmd extends SubCommand {
private final PlotAreaManager plotAreaManager; private final PlotAreaManager plotAreaManager;
@ -190,10 +190,10 @@ public class SchematicCmd extends SubCommand {
return false; return false;
} }
if (args.length != 2) { if (args.length != 2) {
player.sendMessage(TranslatableCaption.of("schematic_exportall_world_args")); player.sendMessage(TranslatableCaption.of("schematics.schematic_exportall_world_args"));
player.sendMessage( player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"), TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "Use /plot sch exportall area") Template.of("value", "Use /plot schematic exportall area")
); );
return false; return false;
} }

View File

@ -37,7 +37,7 @@
"cluster.cluster_intersection": "<prefix><gray>The proposed area overlaps with: <cluster></gray>", "cluster.cluster_intersection": "<prefix><gray>The proposed area overlaps with: <cluster></gray>",
"cluster.cluster_outside": "<prefix><gray>The proposed area is outside the plot area: <area></gray>", "cluster.cluster_outside": "<prefix><gray>The proposed area is outside the plot area: <area></gray>",
"cluster.cluster_added": "<prefix><dark_aqua>Successfully created the cluster.</dark_aqua>", "cluster.cluster_added": "<prefix><dark_aqua>Successfully created the cluster.</dark_aqua>",
"cluster.cluster_deleted": "<prefix><dark_aqua>Successfully deleted the cluster.</dark_aqua>", "cluster.cluster_deleted": "<prefix><dark_aqua>Successfully deleted the cluster <cluster>.</dark_aqua>",
"cluster.cluster_resized": "<prefix><dark_aqua>Successfully resized the cluster.</dark_aqua>", "cluster.cluster_resized": "<prefix><dark_aqua>Successfully resized the cluster.</dark_aqua>",
"cluster.cluster_added_user": "<prefix><dark_aqua>Successfully added user to the cluster.</dark_aqua>", "cluster.cluster_added_user": "<prefix><dark_aqua>Successfully added user to the cluster.</dark_aqua>",
"cluster.cannot_kick_player": "<prefix><red>You cannot kick that player: </red><gray><name></gray>", "cluster.cannot_kick_player": "<prefix><red>You cannot kick that player: </red><gray><name></gray>",