mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-20 01:15:15 +01:00
Fix holograms not saving with readImage
or readText
commands
This commit is contained in:
parent
88f230485f
commit
a41be09ef3
@ -40,6 +40,7 @@ import com.gmail.filoghost.holographicdisplays.exception.TooWideException;
|
||||
import com.gmail.filoghost.holographicdisplays.exception.UnreadableImageException;
|
||||
import com.gmail.filoghost.holographicdisplays.image.ImageMessage;
|
||||
import com.gmail.filoghost.holographicdisplays.object.NamedHologram;
|
||||
import com.gmail.filoghost.holographicdisplays.object.line.CraftTextLine;
|
||||
import com.gmail.filoghost.holographicdisplays.util.FileUtils;
|
||||
|
||||
public class ReadimageCommand extends HologramSubCommand {
|
||||
@ -113,7 +114,9 @@ public class ReadimageCommand extends HologramSubCommand {
|
||||
ImageMessage imageMessage = new ImageMessage(image, width);
|
||||
String[] newLines = imageMessage.getLines();
|
||||
for (int i = 0; i < newLines.length; i++) {
|
||||
hologram.appendTextLine(newLines[i]);
|
||||
CraftTextLine line = new CraftTextLine(hologram, newLines[i]);
|
||||
line.setSerializedConfigValue(newLines[i]);
|
||||
hologram.getLinesUnsafe().add(line);
|
||||
}
|
||||
|
||||
hologram.refreshAll();
|
||||
|
@ -30,7 +30,6 @@ import com.gmail.filoghost.holographicdisplays.commands.CommandValidator;
|
||||
import com.gmail.filoghost.holographicdisplays.commands.Strings;
|
||||
import com.gmail.filoghost.holographicdisplays.commands.main.HologramSubCommand;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.HologramDatabase;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.StringConverter;
|
||||
import com.gmail.filoghost.holographicdisplays.event.NamedHologramEditedEvent;
|
||||
import com.gmail.filoghost.holographicdisplays.exception.CommandException;
|
||||
import com.gmail.filoghost.holographicdisplays.object.NamedHologram;
|
||||
@ -64,7 +63,6 @@ public class ReadtextCommand extends HologramSubCommand {
|
||||
CommandValidator.isTrue(!HolographicDisplays.isConfigFile(targetFile), "Cannot read default configuration files.");
|
||||
|
||||
List<String> lines = FileUtils.readLines(targetFile);
|
||||
hologram.clearLines();
|
||||
|
||||
int linesAmount = lines.size();
|
||||
if (linesAmount > 40) {
|
||||
@ -72,10 +70,10 @@ public class ReadtextCommand extends HologramSubCommand {
|
||||
linesAmount = 40;
|
||||
}
|
||||
|
||||
hologram.clearLines();
|
||||
for (int i = 0; i < linesAmount; i++) {
|
||||
hologram.appendTextLine(StringConverter.toReadableFormat(lines.get(i)));
|
||||
hologram.getLinesUnsafe().add(HologramDatabase.deserializeHologramLine(lines.get(i), hologram));
|
||||
}
|
||||
|
||||
hologram.refreshAll();
|
||||
|
||||
HologramDatabase.saveHologram(hologram);
|
||||
|
Loading…
Reference in New Issue
Block a user