Added /sethome suggestion to jump message
This commit is contained in:
parent
3cfb3ad192
commit
8d4fd1e327
9 changed files with 39 additions and 28 deletions
|
@ -248,10 +248,6 @@ public class Commons {
|
|||
|
||||
public static void addChatMessage(final ICommandSender commandSender, @Nonnull final ITextComponent textComponent) {
|
||||
final String message = textComponent.getFormattedText();
|
||||
addChatMessage(commandSender, message);
|
||||
}
|
||||
|
||||
public static void addChatMessage(final ICommandSender commandSender, @Nonnull final String message) {
|
||||
if (commandSender == null) {
|
||||
WarpDrive.logger.error(String.format("Unable to send message to NULL sender: %s",
|
||||
message));
|
||||
|
@ -264,6 +260,10 @@ public class Commons {
|
|||
}
|
||||
|
||||
final String[] lines = updateEscapeCodes(message).split("\n");
|
||||
if (lines.length == 1) {
|
||||
commandSender.sendMessage(textComponent);
|
||||
|
||||
} else {
|
||||
String formatNextLine = "";
|
||||
for (final String line : lines) {
|
||||
commandSender.sendMessage(new TextComponentString(formatNextLine + line));
|
||||
|
@ -283,6 +283,7 @@ public class Commons {
|
|||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// logger.info(message);
|
||||
}
|
||||
|
|
|
@ -28,11 +28,21 @@ public class WarpDriveText extends TextComponentString {
|
|||
super("");
|
||||
|
||||
final ITextComponent textComponent = new TextComponentTranslation(translationKey, args);
|
||||
final String textRaw = textComponent.getUnformattedText();
|
||||
if (textRaw.startsWith("[") && textRaw.endsWith("]")) {
|
||||
final ITextComponent textComponentNested = ITextComponent.Serializer.jsonToComponent(textRaw);
|
||||
if (textComponentNested != null) {
|
||||
append(textComponentNested);
|
||||
} else {
|
||||
append(textComponent);
|
||||
}
|
||||
} else {
|
||||
if (style != null) {
|
||||
textComponent.setStyle(style);
|
||||
}
|
||||
append(textComponent);
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
|
|
|
@ -947,7 +947,7 @@ warpdrive.ship.guide.not_enough_space_after_adjustment=Not enough space after ad
|
|||
warpdrive.ship.guide.entering_hyperspace=Entering hyperspace...
|
||||
warpdrive.ship.guide.leaving_hyperspace=Leaving hyperspace...
|
||||
warpdrive.ship.guide.engaging_jumpgate_x=Engaging jumpgate towards %1$s!
|
||||
warpdrive.ship.guide.jumping_xyz=Jumping of %1$d blocks (XYZ %2$d %3$d %4$d)
|
||||
warpdrive.ship.guide.jumping_xyz=[{"text": "Jumping of %1$d blocks (XYZ %2$d %3$d %4$d). "}, {"text": "Click to update home.", "color": "blue", "clickEvent": { "action": "run_command", "value": "/sethome -o" }}]
|
||||
warpdrive.ship.guide.turning_right=Turning to the right
|
||||
warpdrive.ship.guide.turning_back=Turning back
|
||||
warpdrive.ship.guide.turning_left=Turning to the left
|
||||
|
|
|
@ -953,7 +953,7 @@ warpdrive.ship.guide.not_enough_space_after_adjustment=Not enough space after ad
|
|||
warpdrive.ship.guide.entering_hyperspace=Entering hyperspace...
|
||||
warpdrive.ship.guide.leaving_hyperspace=Leaving hyperspace...
|
||||
warpdrive.ship.guide.engaging_jumpgate_x=Engaging jumpgate towards %1$s!
|
||||
warpdrive.ship.guide.jumping_xyz=Jumping of %1$d blocks (XYZ %2$d %3$d %4$d)
|
||||
warpdrive.ship.guide.jumping_xyz=[{"text": "Jumping of %1$d blocks (XYZ %2$d %3$d %4$d). "}, {"text": "Click to update home.", "color": "blue", "clickEvent": { "action": "run_command", "value": "/sethome -o" }}]
|
||||
warpdrive.ship.guide.turning_right=Turning to the right
|
||||
warpdrive.ship.guide.turning_back=Turning back
|
||||
warpdrive.ship.guide.turning_left=Turning to the left
|
||||
|
|
|
@ -953,7 +953,7 @@ warpdrive.ship.guide.not_enough_space_after_adjustment=Not enough space after ad
|
|||
warpdrive.ship.guide.entering_hyperspace=Entering hyperspace...
|
||||
warpdrive.ship.guide.leaving_hyperspace=Leaving hyperspace...
|
||||
warpdrive.ship.guide.engaging_jumpgate_x=Engaging jumpgate towards %1$s!
|
||||
warpdrive.ship.guide.jumping_xyz=Jumping of %1$d blocks (XYZ %2$d %3$d %4$d)
|
||||
warpdrive.ship.guide.jumping_xyz=[{"text": "Jumping of %1$d blocks (XYZ %2$d %3$d %4$d). "}, {"text": "Click to update home.", "color": "blue", "clickEvent": { "action": "run_command", "value": "/sethome -o" }}]
|
||||
warpdrive.ship.guide.turning_right=Turning to the right
|
||||
warpdrive.ship.guide.turning_back=Turning back
|
||||
warpdrive.ship.guide.turning_left=Turning to the left
|
||||
|
|
|
@ -952,7 +952,7 @@ warpdrive.ship.guide.not_enough_space_after_adjustment=Not enough space after ad
|
|||
warpdrive.ship.guide.entering_hyperspace=Entering hyperspace...
|
||||
warpdrive.ship.guide.leaving_hyperspace=Leaving hyperspace...
|
||||
warpdrive.ship.guide.engaging_jumpgate_x=Engaging jumpgate towards %1$s!
|
||||
warpdrive.ship.guide.jumping_xyz=Jumping of %1$d blocks (XYZ %2$d %3$d %4$d)
|
||||
warpdrive.ship.guide.jumping_xyz=[{"text": "Jumping of %1$d blocks (XYZ %2$d %3$d %4$d). "}, {"text": "Click to update home.", "color": "blue", "clickEvent": { "action": "run_command", "value": "/sethome -o" }}]
|
||||
warpdrive.ship.guide.turning_right=Turning to the right
|
||||
warpdrive.ship.guide.turning_back=Turning back
|
||||
warpdrive.ship.guide.turning_left=Turning to the left
|
||||
|
|
|
@ -953,7 +953,7 @@ warpdrive.ship.guide.not_enough_space_after_adjustment=Not enough space after ad
|
|||
warpdrive.ship.guide.entering_hyperspace=Entering hyperspace...
|
||||
warpdrive.ship.guide.leaving_hyperspace=Leaving hyperspace...
|
||||
warpdrive.ship.guide.engaging_jumpgate_x=Engaging jumpgate towards %1$s!
|
||||
warpdrive.ship.guide.jumping_xyz=Jumping of %1$d blocks (XYZ %2$d %3$d %4$d)
|
||||
warpdrive.ship.guide.jumping_xyz=[{"text": "Jumping of %1$d blocks (XYZ %2$d %3$d %4$d). "}, {"text": "Click to update home.", "color": "blue", "clickEvent": { "action": "run_command", "value": "/sethome -o" }}]
|
||||
warpdrive.ship.guide.turning_right=Turning to the right
|
||||
warpdrive.ship.guide.turning_back=Turning back
|
||||
warpdrive.ship.guide.turning_left=Turning to the left
|
||||
|
|
|
@ -953,7 +953,7 @@ warpdrive.ship.guide.not_enough_space_after_adjustment=调整后空间不足。
|
|||
warpdrive.ship.guide.entering_hyperspace=正在进入超空间……
|
||||
warpdrive.ship.guide.leaving_hyperspace=正在离开超空间……
|
||||
warpdrive.ship.guide.engaging_jumpgate_x=向 %1$s 启动跃迁门!
|
||||
warpdrive.ship.guide.jumping_xyz=正在跃迁 %1$d 格 (XYZ %2$d %3$d %4$d)
|
||||
warpdrive.ship.guide.jumping_xyz=[{"text": "正在跃迁 %1$d 格 (XYZ %2$d %3$d %4$d). "}, {"text": "Click to update home.", "color": "blue", "clickEvent": { "action": "run_command", "value": "/sethome -o" }}]
|
||||
warpdrive.ship.guide.turning_right=右转
|
||||
warpdrive.ship.guide.turning_back=向后转
|
||||
warpdrive.ship.guide.turning_left=左转
|
||||
|
|
|
@ -952,7 +952,7 @@ warpdrive.ship.guide.not_enough_space_after_adjustment=Not enough space after ad
|
|||
warpdrive.ship.guide.entering_hyperspace=Entering hyperspace...
|
||||
warpdrive.ship.guide.leaving_hyperspace=Leaving hyperspace...
|
||||
warpdrive.ship.guide.engaging_jumpgate_x=Engaging jumpgate towards %1$s!
|
||||
warpdrive.ship.guide.jumping_xyz=Jumping of %1$d blocks (XYZ %2$d %3$d %4$d)
|
||||
warpdrive.ship.guide.jumping_xyz=[{"text": "Jumping of %1$d blocks (XYZ %2$d %3$d %4$d). "}, {"text": "Click to update home.", "color": "blue", "clickEvent": { "action": "run_command", "value": "/sethome -o" }}]
|
||||
warpdrive.ship.guide.turning_right=Turning to the right
|
||||
warpdrive.ship.guide.turning_back=Turning back
|
||||
warpdrive.ship.guide.turning_left=Turning to the left
|
||||
|
|
Loading…
Reference in a new issue