mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-29 20:27:42 +01:00
Update command messages for users
This commit is contained in:
parent
a7b9b72f96
commit
f61ba7a02c
@ -25,7 +25,7 @@ public class AddlineCommand extends LineEditingCommand implements QuickEditComma
|
||||
super("addline");
|
||||
setMinArgs(2);
|
||||
setUsageArgs("<hologram> <text>");
|
||||
setDescription("Adds a line to an existing hologram.");
|
||||
setDescription("Adds a line to a hologram.");
|
||||
|
||||
this.commandManager = commandManager;
|
||||
this.hologramEditor = hologramEditor;
|
||||
|
@ -23,8 +23,8 @@ public class AlignCommand extends HologramSubCommand {
|
||||
public AlignCommand(InternalHologramEditor hologramEditor) {
|
||||
super("align");
|
||||
setMinArgs(3);
|
||||
setUsageArgs("<X | Y | Z | XZ> <hologram> <referenceHologram>");
|
||||
setDescription("Aligns the first hologram to the second, in the specified axis.");
|
||||
setUsageArgs("<X | Y | Z | XZ> <hologramToAlign> <referenceHologram>");
|
||||
setDescription("Aligns a hologram to another along the specified axis.");
|
||||
|
||||
this.hologramEditor = hologramEditor;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class CopyCommand extends HologramSubCommand {
|
||||
super("copy");
|
||||
setMinArgs(2);
|
||||
setUsageArgs("<fromHologram> <toHologram>");
|
||||
setDescription("Copies the contents of a hologram into another one.");
|
||||
setDescription("Copies the content from a hologram to another one, replacing it.");
|
||||
|
||||
this.hologramEditor = hologramEditor;
|
||||
}
|
||||
@ -44,8 +44,8 @@ public class CopyCommand extends HologramSubCommand {
|
||||
toHologram.getLines().setAll(clonedLines);
|
||||
hologramEditor.saveChanges(toHologram, ChangeType.EDIT_LINES);
|
||||
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Hologram \"" + fromHologram.getName() + "\""
|
||||
+ " copied into hologram \"" + toHologram.getName() + "\".");
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Lines of hologram \"" + fromHologram.getName() + "\""
|
||||
+ " copied to hologram \"" + toHologram.getName() + "\".");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class CreateCommand extends HologramSubCommand {
|
||||
String hologramName = args[0];
|
||||
|
||||
CommandValidate.check(hologramName.matches("[a-zA-Z0-9_\\-]+"),
|
||||
"The name must contain only alphanumeric chars, underscores and hyphens.");
|
||||
"The name must contain only alphanumeric characters, underscores and hyphens.");
|
||||
CommandValidate.check(!hologramEditor.hologramExists(hologramName), "A hologram with that name already exists.");
|
||||
|
||||
BaseHologramPosition spawnPosition = new BaseHologramPosition(player.getLocation());
|
||||
@ -71,7 +71,7 @@ public class CreateCommand extends HologramSubCommand {
|
||||
hologramEditor.saveChanges(hologram, ChangeType.CREATE);
|
||||
|
||||
hologramEditor.teleportLookingDown(player, player.getLocation());
|
||||
player.sendMessage(ColorScheme.PRIMARY + "You created a hologram named \"" + hologram.getName() + "\".");
|
||||
player.sendMessage(ColorScheme.PRIMARY + "Hologram named \"" + hologram.getName() + "\" created.");
|
||||
|
||||
if (moveUp) {
|
||||
player.sendMessage(ColorScheme.SECONDARY_DARKER + "(You were on the ground,"
|
||||
|
@ -22,7 +22,7 @@ public class DeleteCommand extends HologramSubCommand {
|
||||
super("delete", "remove");
|
||||
setMinArgs(1);
|
||||
setUsageArgs("<hologram>");
|
||||
setDescription("Deletes a hologram. Cannot be undone.");
|
||||
setDescription("Deletes a hologram (cannot be undone!).");
|
||||
|
||||
this.hologramEditor = hologramEditor;
|
||||
}
|
||||
@ -34,7 +34,7 @@ public class DeleteCommand extends HologramSubCommand {
|
||||
hologramEditor.delete(hologram);
|
||||
hologramEditor.saveChanges(hologram, ChangeType.DELETE);
|
||||
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "You deleted the hologram \"" + hologram.getName() + "\".");
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Hologram \"" + hologram.getName() + "\" deleted.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class EditCommand extends HologramSubCommand {
|
||||
super("edit");
|
||||
setMinArgs(1);
|
||||
setUsageArgs("<hologram>");
|
||||
setDescription("Shows the commands to manipulate an existing hologram.");
|
||||
setDescription("Lists the commands to edit a hologram.");
|
||||
|
||||
this.commandManager = commandManager;
|
||||
this.hologramEditor = hologramEditor;
|
||||
|
@ -29,7 +29,7 @@ public class HelpCommand extends HologramSubCommand {
|
||||
public HelpCommand(HologramCommandManager commandManager) {
|
||||
super("help");
|
||||
setShowInHelpCommand(false);
|
||||
setDescription("Show the list of commands.");
|
||||
setDescription("Lists the main commands with a description.");
|
||||
|
||||
this.commandManager = commandManager;
|
||||
}
|
||||
@ -72,7 +72,7 @@ public class HelpCommand extends HologramSubCommand {
|
||||
.append(" Try to ", FormatRetention.NONE).color(ChatColor.GRAY)
|
||||
.append("hover").color(ChatColor.WHITE).underlined(true)
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
TextComponent.fromLegacyText(ChatColor.LIGHT_PURPLE + "Hover on the commands to get info about them.")))
|
||||
TextComponent.fromLegacyText(ChatColor.LIGHT_PURPLE + "Hover on the commands to see the description.")))
|
||||
.append(" or ", FormatRetention.NONE).color(ChatColor.GRAY)
|
||||
.append("click").color(ChatColor.WHITE).underlined(true)
|
||||
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
|
||||
|
@ -24,7 +24,7 @@ public class InfoCommand extends LineEditingCommand implements QuickEditCommand
|
||||
super("info", "details");
|
||||
setMinArgs(1);
|
||||
setUsageArgs("<hologram>");
|
||||
setDescription("Shows the lines of a hologram.");
|
||||
setDescription("Lists the lines of a hologram.");
|
||||
|
||||
this.commandManager = commandManager;
|
||||
this.hologramEditor = hologramEditor;
|
||||
|
@ -28,9 +28,8 @@ public class InsertlineCommand extends LineEditingCommand implements QuickEditCo
|
||||
setMinArgs(3);
|
||||
setUsageArgs("<hologram> <lineNumber> <text>");
|
||||
setDescription(
|
||||
"Inserts a line after the specified index.",
|
||||
"If the index is 0, the line will be put before",
|
||||
"the first line of the hologram.");
|
||||
"Inserts a line after the specified line number.",
|
||||
"To insert at the top of the hologram, use \"0\" for the line number.");
|
||||
|
||||
this.commandManager = commandManager;
|
||||
this.hologramEditor = hologramEditor;
|
||||
@ -45,7 +44,7 @@ public class InsertlineCommand extends LineEditingCommand implements QuickEditCo
|
||||
int oldLinesAmount = hologram.getLines().size();
|
||||
|
||||
CommandValidate.check(insertAfterIndex >= 0 && insertAfterIndex <= oldLinesAmount,
|
||||
"The number must be between 0 and " + oldLinesAmount + " (amount of lines of the hologram).");
|
||||
"The line number must be between 0 and " + oldLinesAmount + ".");
|
||||
|
||||
InternalHologramLine line = hologramEditor.parseHologramLine(hologram, serializedLine);
|
||||
|
||||
@ -53,12 +52,12 @@ public class InsertlineCommand extends LineEditingCommand implements QuickEditCo
|
||||
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
|
||||
|
||||
if (insertAfterIndex == 0) {
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Line inserted before first line.");
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Line inserted before the first line.");
|
||||
} else if (insertAfterIndex == oldLinesAmount) {
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Line appended at the end.");
|
||||
DisplayFormat.sendTip(sender, "You can use \"/" + context.getRootLabel() + " addline\" to append a line at the end.");
|
||||
} else {
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Line inserted between lines " + insertAfterIndex
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Line inserted between the lines " + insertAfterIndex
|
||||
+ " and " + (insertAfterIndex + 1) + ".");
|
||||
}
|
||||
commandManager.sendQuickEditCommands(context, hologram);
|
||||
|
@ -24,7 +24,7 @@ public class MovehereCommand extends HologramSubCommand {
|
||||
super("movehere");
|
||||
setMinArgs(1);
|
||||
setUsageArgs("<hologram>");
|
||||
setDescription("Moves a hologram to your location.");
|
||||
setDescription("Moves a hologram to your position.");
|
||||
|
||||
this.hologramEditor = hologramEditor;
|
||||
}
|
||||
@ -38,7 +38,7 @@ public class MovehereCommand extends HologramSubCommand {
|
||||
hologramEditor.saveChanges(hologram, ChangeType.EDIT_POSITION);
|
||||
|
||||
hologramEditor.teleportLookingDown(player, player.getLocation());
|
||||
player.sendMessage(ColorScheme.PRIMARY + "You moved the hologram \"" + hologram.getName() + "\" near to you.");
|
||||
player.sendMessage(ColorScheme.PRIMARY + "Hologram \"" + hologram.getName() + "\" moved to your position.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class ReadimageCommand extends LineEditingCommand {
|
||||
throw new CommandException("The plugin was unable to read the image. Be sure that the format is supported.");
|
||||
} catch (IOException e) {
|
||||
Log.warning("Error while reading an image", e);
|
||||
throw new CommandException("I/O exception while reading the image. " + (isUrl ? "Is the URL valid?" : "Is it in use?"));
|
||||
throw new CommandException("I/O error while reading the image. " + (isUrl ? "Is the URL valid?" : "Is it in use?"));
|
||||
}
|
||||
|
||||
ImageMessage imageMessage = new ImageMessage(image, width);
|
||||
@ -120,9 +120,9 @@ public class ReadimageCommand extends LineEditingCommand {
|
||||
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
|
||||
|
||||
if (append) {
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "The image was appended int the end of the hologram.");
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Added the image at the end of the hologram.");
|
||||
} else {
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "The image was drawn in the hologram.");
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Hologram content replaced with the image.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ package me.filoghost.holographicdisplays.plugin.commands.subs;
|
||||
import me.filoghost.fcommons.command.CommandContext;
|
||||
import me.filoghost.fcommons.command.sub.SubCommandContext;
|
||||
import me.filoghost.fcommons.command.validation.CommandException;
|
||||
import me.filoghost.fcommons.logging.Log;
|
||||
import me.filoghost.holographicdisplays.plugin.commands.InternalHologramEditor;
|
||||
import me.filoghost.holographicdisplays.plugin.config.HologramLineParser;
|
||||
import me.filoghost.holographicdisplays.plugin.config.HologramLoadException;
|
||||
@ -64,12 +65,13 @@ public class ReadtextCommand extends LineEditingCommand {
|
||||
try {
|
||||
serializedLines = Files.readAllLines(fileToRead);
|
||||
} catch (IOException e) {
|
||||
throw new CommandException("I/O exception while reading the file. Is it in use?");
|
||||
Log.warning("Error while reading a file", e);
|
||||
throw new CommandException("I/O error while reading the file. Is it in use?");
|
||||
}
|
||||
|
||||
int linesAmount = serializedLines.size();
|
||||
if (linesAmount > 40) {
|
||||
DisplayFormat.sendWarning(sender, "The file contained more than 40 lines, that have been limited.");
|
||||
DisplayFormat.sendWarning(sender, "The file is too long, only the first 40 lines will be used.");
|
||||
linesAmount = 40;
|
||||
}
|
||||
|
||||
@ -87,11 +89,11 @@ public class ReadtextCommand extends LineEditingCommand {
|
||||
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
|
||||
|
||||
if (FileUtils.hasFileExtension(fileToRead, "jpg", "png", "jpeg", "gif")) {
|
||||
DisplayFormat.sendWarning(sender, "The read file has an image's extension."
|
||||
+ " If it is an image, you should use /" + context.getRootLabel() + " readimage.");
|
||||
DisplayFormat.sendWarning(sender, "It looks like the file is an image."
|
||||
+ " If it is, you should use instead /" + context.getRootLabel() + " readimage.");
|
||||
}
|
||||
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "The lines were pasted into the hologram.");
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Hologram content replaced with " + linesAmount + " lines from the file.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class ReloadCommand extends HologramSubCommand {
|
||||
|
||||
public ReloadCommand(HolographicDisplays holographicDisplays) {
|
||||
super("reload");
|
||||
setDescription("Reloads the holograms from the database.");
|
||||
setDescription("Reloads the plugin, including the configuration and the holograms.");
|
||||
|
||||
this.holographicDisplays = holographicDisplays;
|
||||
}
|
||||
@ -32,7 +32,7 @@ public class ReloadCommand extends HologramSubCommand {
|
||||
holographicDisplays.load(errorCollector);
|
||||
|
||||
if (!errorCollector.hasErrors()) {
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Configuration reloaded successfully.");
|
||||
sender.sendMessage(ColorScheme.PRIMARY + "Plugin reloaded successfully.");
|
||||
} else {
|
||||
errorCollector.logToConsole();
|
||||
sender.sendMessage(ColorScheme.ERROR + "Plugin reloaded with " + errorCollector.getErrorsCount() + " error(s).");
|
||||
|
@ -41,8 +41,8 @@ public class RemovelineCommand extends LineEditingCommand implements QuickEditCo
|
||||
"The line number must be between 1 and " + linesAmount + ".");
|
||||
int index = lineNumber - 1;
|
||||
|
||||
CommandValidate.check(linesAmount > 1,
|
||||
"The hologram should have at least 1 line. If you want to delete it, use /" + context.getRootLabel() + " delete.");
|
||||
CommandValidate.check(linesAmount >= 2,
|
||||
"A hologram must always have at least 1 line. If you want to delete it, use /" + context.getRootLabel() + " delete.");
|
||||
|
||||
hologram.getLines().remove(index);
|
||||
hologramEditor.saveChanges(hologram, ChangeType.EDIT_LINES);
|
||||
|
@ -24,7 +24,7 @@ public class TeleportCommand extends HologramSubCommand {
|
||||
super("teleport", "tp");
|
||||
setMinArgs(1);
|
||||
setUsageArgs("<hologram>");
|
||||
setDescription("Teleports you to the given hologram.");
|
||||
setDescription("Teleports to a hologram.");
|
||||
|
||||
this.hologramEditor = hologramEditor;
|
||||
}
|
||||
@ -35,7 +35,7 @@ public class TeleportCommand extends HologramSubCommand {
|
||||
InternalHologram hologram = hologramEditor.getExistingHologram(args[0]);
|
||||
|
||||
hologramEditor.teleportLookingDown(player, hologram.getBasePosition().toLocation());
|
||||
player.sendMessage(ColorScheme.PRIMARY + "You were teleported to the hologram named \"" + hologram.getName() + "\".");
|
||||
player.sendMessage(ColorScheme.PRIMARY + "Teleported to the hologram \"" + hologram.getName() + "\".");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user