Commit d30daf52 authored by Nico Eckes's avatar Nico Eckes

Renamed package to lowercase equivalent to conform to JavaFX. Added first editor code

parent 447e4727
Pipeline #741 passed with stage
in 3 minutes and 1 second
......@@ -10,8 +10,8 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'
version = "${mcVersion}-${modVersion}-" + (System.getenv("CI_PIPELINE_ID") as Integer ?: 0)
group = "com.unitedworldminers.PermIO"
archivesBaseName = "PermIO"
group = "com.unitedworldminers.permio"
archivesBaseName = "permio"
minecraft {
version = project.property("mcVersion") + "-" + project.property("forgeVersion")
......
package com.unitedworldminers.PermIO.api;
package com.unitedworldminers.permio.api;
import com.unitedworldminers.PermIO.api.exceptions.InheritanceLoopException;
import com.unitedworldminers.permio.api.exceptions.InheritanceLoopException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
......
package com.unitedworldminers.PermIO.api;
package com.unitedworldminers.permio.api;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
......
package com.unitedworldminers.PermIO.api;
package com.unitedworldminers.permio.api;
import net.minecraft.command.ICommandSender;
import org.jetbrains.annotations.NotNull;
......@@ -11,7 +11,7 @@ import java.util.function.Supplier;
public interface IPermissions {
IPermissions INSTANCE = ((Supplier<IPermissions>) () ->{
try {
Class<?> permio = Class.forName("com.unitedworldminers.PermIO.permissions.Permissions");
Class<?> permio = Class.forName("com.unitedworldminers.permio.permissions.Permissions");
return (IPermissions) permio.getEnumConstants()[0];
} catch (Exception e) {
return null;
......
package com.unitedworldminers.PermIO.api;
package com.unitedworldminers.permio.api;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
......
package com.unitedworldminers.PermIO.api.exceptions;
package com.unitedworldminers.permio.api.exceptions;
public class InheritanceLoopException extends Exception {
}
@API(owner = "permio", provides = "permio-api", apiVersion = "0.1")
package com.unitedworldminers.PermIO.api.exceptions;
package com.unitedworldminers.permio.api.exceptions;
import net.minecraftforge.fml.common.API;
\ No newline at end of file
@API(owner = "permio", provides = "permio-api", apiVersion = "0.1")
package com.unitedworldminers.PermIO.api;
package com.unitedworldminers.permio.api;
import net.minecraftforge.fml.common.API;
\ No newline at end of file
package com.unitedworldminers.PermIO;
package com.unitedworldminers.permio;
import net.minecraftforge.common.config.Configuration;
......
package com.unitedworldminers.PermIO;
package com.unitedworldminers.permio;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
......
package com.unitedworldminers.PermIO;
package com.unitedworldminers.permio;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.CommandEvent;
import net.minecraftforge.event.world.WorldEvent;
......
package com.unitedworldminers.PermIO.commands;
package com.unitedworldminers.permio.commands;
import com.unitedworldminers.BaseIO.util.CommandNode;
import com.unitedworldminers.PermIO.commands.group.*;
import com.unitedworldminers.permio.commands.group.*;
import net.minecraft.command.ICommand;
import org.jetbrains.annotations.NotNull;
......
package com.unitedworldminers.PermIO.commands;
package com.unitedworldminers.permio.commands;
import com.unitedworldminers.BaseIO.util.CommandNode;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.PlayerUtils;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.api.IPermissionHolder;
import com.unitedworldminers.PermIO.api.IPlayer;
import com.unitedworldminers.PermIO.commands.general.*;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.api.IPermissionHolder;
import com.unitedworldminers.permio.api.IPlayer;
import com.unitedworldminers.permio.commands.general.*;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import org.jetbrains.annotations.NotNull;
......
package com.unitedworldminers.PermIO.commands;
package com.unitedworldminers.permio.commands;
import com.unitedworldminers.BaseIO.util.CommandNode;
import com.unitedworldminers.PermIO.commands.player.CmdAddgroup;
import com.unitedworldminers.PermIO.commands.player.CmdRemovegroup;
import com.unitedworldminers.permio.commands.player.CmdAddgroup;
import com.unitedworldminers.permio.commands.player.CmdRemovegroup;
import net.minecraft.command.ICommand;
import org.jetbrains.annotations.NotNull;
......
package com.unitedworldminers.PermIO.commands.general;
package com.unitedworldminers.permio.commands.general;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.api.IPermissionHolder;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.api.IPermissionHolder;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -29,7 +29,7 @@ public class CmdAddperm extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length < 2) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.general;
package com.unitedworldminers.permio.commands.general;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -26,7 +26,7 @@ public class CmdDebug extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
logRequests = !logRequests;
MessageUtils.messageToSender(sender, "debugging " + (logRequests ? "enabled" : "disabled"));
}
......
package com.unitedworldminers.PermIO.commands.general;
package com.unitedworldminers.permio.commands.general;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.BaseIO.util.Utils;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.api.IPermissionHolder;
import com.unitedworldminers.PermIO.api.IPlayer;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.api.IPermissionHolder;
import com.unitedworldminers.permio.api.IPlayer;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -31,7 +31,7 @@ public class CmdInfo extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length == 0) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.general;
package com.unitedworldminers.permio.commands.general;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.api.IPermissionHolder;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.api.IPermissionHolder;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -29,7 +29,7 @@ public class CmdPrefix extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length == 0) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.general;
package com.unitedworldminers.permio.commands.general;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.Config;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.Config;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -25,7 +25,7 @@ public class CmdReload extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
Config.loadConfiguration();
MessageUtils.messageToSender(sender, "commands.reload.groups." + (Permissions.INSTANCE.loadGroups() ? "success" : "failed"));
MessageUtils.messageToSender(sender, "commands.reload.players." + (Permissions.INSTANCE.loadPlayers() ? "success" : "failed"));
......
package com.unitedworldminers.PermIO.commands.general;
package com.unitedworldminers.permio.commands.general;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.api.IPermissionHolder;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.api.IPermissionHolder;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -29,7 +29,7 @@ public class CmdRemovePerm extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length < 2) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.general;
package com.unitedworldminers.permio.commands.general;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.api.IPermissionHolder;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.api.IPermissionHolder;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......
package com.unitedworldminers.PermIO.commands.group;
package com.unitedworldminers.permio.commands.group;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.api.exceptions.InheritanceLoopException;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.api.exceptions.InheritanceLoopException;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -29,7 +29,7 @@ public class CmdAddinheritance extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length < 2) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.group;
package com.unitedworldminers.permio.commands.group;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -24,7 +24,7 @@ public class CmdCreate extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length == 0) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.group;
package com.unitedworldminers.permio.commands.group;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -24,7 +24,7 @@ public class CmdList extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
Permissions.INSTANCE.getGroups().forEach(g-> MessageUtils.messageToSender(sender, "commands.list.entry", g.getGroupId()));
}
......
package com.unitedworldminers.PermIO.commands.group;
package com.unitedworldminers.permio.commands.group;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -28,7 +28,7 @@ public class CmdRemove extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length == 0) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.group;
package com.unitedworldminers.permio.commands.group;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -28,7 +28,7 @@ public class CmdRemoveinheritance extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length < 2) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.group;
package com.unitedworldminers.permio.commands.group;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -28,7 +28,7 @@ public class CmdRename extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length < 2) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.player;
package com.unitedworldminers.permio.commands.player;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.api.IPlayer;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.api.IPlayer;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -29,7 +29,7 @@ public class CmdAddgroup extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length < 2) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.PermIO.commands.player;
package com.unitedworldminers.permio.commands.player;
import com.unitedworldminers.BaseIO.util.MessageUtils;
import com.unitedworldminers.BaseIO.util.SimpleCommand;
import com.unitedworldminers.PermIO.api.IGroup;
import com.unitedworldminers.PermIO.api.IPlayer;
import com.unitedworldminers.PermIO.commands.CmdPermission;
import com.unitedworldminers.PermIO.permissions.Permissions;
import com.unitedworldminers.permio.api.IGroup;
import com.unitedworldminers.permio.api.IPlayer;
import com.unitedworldminers.permio.commands.CmdPermission;
import com.unitedworldminers.permio.permissions.Permissions;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
......@@ -29,7 +29,7 @@ public class CmdRemovegroup extends SimpleCommand {
}
@Override
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) throws CommandException {
public void run(ICommandSender sender, String[] args, Map<String, String[]> options) {
if (args.length < 2) {
MessageUtils.messageToSender(sender, getCommandUsage(sender));
return;
......
package com.unitedworldminers.permio.editor;
import com.unitedworldminers.permio.permissions.Permissions;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import java.util.stream.Collectors;
public class EditorMain extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("EditorMain.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 1000, 500));
primaryStage.show();
for (Menu m: ((MenuBar) root.lookup("#menuBar")).getMenus()) {
m.getItems().add(new MenuItem());
m.addEventHandler(Menu.ON_SHOWN, event -> m.hide());
m.addEventHandler(Menu.ON_SHOWING, event -> m.fire());
}
((SplitPane) root.lookup("#content")).getItems().addAll(
new AddRemoveList<Label>("Groups") {
@Override
public Label elementAdded(String element) {
Permissions.INSTANCE.createGroup(element);
return new Label(element);
}
@Override
public String toString(Label element) {
return element.getText();
}
@Override
public void elementRemoved(Label element) {
Permissions.INSTANCE.deleteGroup(element.getText());
}
},
new AddRemoveList<PermissionLabel>("Permissions") {
@Override
public PermissionLabel elementAdded(String element) {
return new PermissionLabel(element);
}
@Override
public String toString(PermissionLabel element) {
return element.getChildren().stream().map(n-> ((Text) n).getText()).collect(Collectors.joining());
}
@Override
public void elementRemoved(PermissionLabel element) {
}
},
new AddRemoveList<PlayerLabel>("Players") {
@Override
public PlayerLabel elementAdded(String element) {
return new PlayerLabel(element);
}
@Override
public String toString(PlayerLabel element) {
return element.toString();
}
@Override
public void elementRemoved(PlayerLabel element) {
}
});
}
public void openFileDialog(ActionEvent actionEvent) {
}
}
package com.unitedworldminers.permio.editor;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.util.Pair;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.Random;
import java.util.stream.Stream;
public class PermissionLabel extends TextFlow {
private static final Random random = new Random();
private static final ColorMap colors = new ColorMap();
public PermissionLabel(String text) {
final ColorMap[] map = new ColorMap[]{colors};
String[] parts = text.split("\\.");
if (parts.length == 0) {
getChildren().add(new Text(text));
} else {
getChildren().addAll(Stream.of(parts).flatMap(s -> {
Text t = new Text(s);
Pair<Color, ColorMap> data = map[0].computeIfAbsent(s, s1 -> new Pair<>(nextColor(), new ColorMap()));
map[0] = data.getValue();
t.setFill(data.getKey());
return Stream.of(t, new Text("."));
}).limit(parts.length * 2 - 1).toArray(Text[]::new));
}
}
@NotNull
private static Color nextColor() {
return Color.rgb(random.nextInt(256), random.nextInt(256), random.nextInt(256));
}