|
33 | 33 | import java.io.IOException; |
34 | 34 | import java.nio.file.Files; |
35 | 35 | import java.nio.file.Path; |
| 36 | +import java.util.List; |
36 | 37 | import java.util.Locale; |
37 | 38 | import java.util.Objects; |
38 | 39 | import java.util.Set; |
@@ -122,20 +123,22 @@ private void registerServices() { |
122 | 123 | } |
123 | 124 |
|
124 | 125 | private void scheduleDelayedInitTask() { |
125 | | - final var pluginsFolder = getServer().getPluginsFolder().toPath(); |
126 | 126 | if (!groupsExist || config().migrateToGroup == null) |
127 | 127 | getServer().getGlobalRegionScheduler().execute(this, this::setupNotice); |
128 | | - final var importers = this.importers.stream().filter(Importer::isAvailable).map(Importer::getName).toList(); |
129 | | - for (final var importer : importers) { |
130 | | - getServer().getGlobalRegionScheduler().execute(this, () -> importNotice(importer)); |
131 | | - } |
| 128 | + getServer().getGlobalRegionScheduler().execute(this, () -> { |
| 129 | + this.importers.stream().filter(Importer::isAvailable).forEach(this::importNotice); |
| 130 | + }); |
132 | 131 | } |
133 | 132 |
|
134 | | - private void importNotice(final String pluginName) { |
135 | | - final var separator = "-".repeat(86); |
| 133 | + private void importNotice(final Importer importer) { |
| 134 | + final var notice = List.of( |
| 135 | + "It appears you have been using " + importer.getName() + " before!", |
| 136 | + "To migrate your data to PerWorlds, run '/world group import " + importer.getName() + "'", |
| 137 | + "This message will disappear as soon as you delete the folder '" + importer.getDataPath() + "'" |
| 138 | + ); |
| 139 | + final var separator = "-".repeat(notice.stream().mapToInt(String::length).max().orElse(0)); |
136 | 140 | getComponentLogger().info(separator); |
137 | | - getComponentLogger().info("It appears you have been using {} before!", pluginName); |
138 | | - getComponentLogger().info("To migrate your data to PerWorlds, run '/world group import {}'", pluginName); |
| 141 | + notice.forEach(getComponentLogger()::info); |
139 | 142 | getComponentLogger().info(separator); |
140 | 143 | } |
141 | 144 |
|
@@ -215,7 +218,7 @@ private void registerCommands() { |
215 | 218 | event.registrar().register(command, "The main command to interact with this plugin"); |
216 | 219 | }); |
217 | 220 | } |
218 | | - |
| 221 | + |
219 | 222 | public Set<Importer> importers() { |
220 | 223 | return importers; |
221 | 224 | } |
|
0 commit comments