Wrote a program to print all placeholders for easy wiki updates.

This commit is contained in:
Aurora Lahtela 2022-05-28 11:29:43 +03:00
parent f047f4389a
commit b76ee7c358
1 changed files with 28 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import utilities.TestConstants;
import utilities.dagger.PlanPluginComponent;
import utilities.mocks.PluginMockComponent;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Collections;
@ -57,6 +58,33 @@ class PlanPlaceholdersTest {
storeSomeData();
}
// Print all placeholders to console
public static void main(String[] args) throws Exception {
prepareSystem(Files.createTempDirectory("temp-plan-"));
System.out.println("Player placeholders:\n\n```");
underTest.getRegisteredPlayerPlaceholders()
.stream()
.map(placeholder -> placeholder.replaceAll("\\d+", "{n}"))
.distinct()
.forEach(System.out::println);
System.out.println("```");
System.out.println();
System.out.println("Server placeholders:\n\n```");
underTest.getRegisteredServerPlaceholders()
.stream()
.map(placeholder -> placeholder.replaceAll("\\d+", "{n}"))
.distinct()
.forEach(System.out::println);
System.out.println("```");
component.system().disable();
System.exit(0);
}
private static void storeSomeData() {
Database database = component.system().getDatabaseSystem().getDatabase();
database.executeTransaction(new PlayerServerRegisterTransaction(