mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 11:13:45 +01:00 
			
		
		
		
	Several more progress
This commit is contained in:
		@@ -194,16 +194,6 @@ public class PlotSquared {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            this.captionMaps = new HashMap<>();
 | 
					            this.captionMaps = new HashMap<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Setup localization
 | 
					 | 
				
			||||||
            CaptionMap captionMap;
 | 
					 | 
				
			||||||
            if (Settings.Enabled_Components.PER_USER_LOCALE) {
 | 
					 | 
				
			||||||
                captionMap = CaptionLoader.loadAll(Paths.get("lang"));
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                String fileName = "messages_" + Settings.Enabled_Components.DEFAULT_LOCALE + ".json";
 | 
					 | 
				
			||||||
                captionMap = CaptionLoader.loadSingle(Paths.get("lang", fileName));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            this.captionMaps.put(TranslatableCaption.DEFAULT_NAMESPACE, captionMap);
 | 
					 | 
				
			||||||
            this.worldedit = WorldEdit.getInstance();
 | 
					            this.worldedit = WorldEdit.getInstance();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Create Event utility class
 | 
					            // Create Event utility class
 | 
				
			||||||
@@ -236,6 +226,18 @@ public class PlotSquared {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void loadCaptionMap() throws IOException {
 | 
				
			||||||
 | 
					        // Setup localization
 | 
				
			||||||
 | 
					        CaptionMap captionMap;
 | 
				
			||||||
 | 
					        if (Settings.Enabled_Components.PER_USER_LOCALE) {
 | 
				
			||||||
 | 
					            captionMap = CaptionLoader.loadAll(Paths.get("lang"));
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            String fileName = "messages_" + Settings.Enabled_Components.DEFAULT_LOCALE + ".json";
 | 
				
			||||||
 | 
					            captionMap = CaptionLoader.loadSingle(Paths.get("lang", fileName));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        this.captionMaps.put(TranslatableCaption.DEFAULT_NAMESPACE, captionMap);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Get the platform specific {@link PlotAreaManager} instance
 | 
					     * Get the platform specific {@link PlotAreaManager} instance
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,7 @@ import com.plotsquared.core.PlotSquared;
 | 
				
			|||||||
import com.plotsquared.core.configuration.Captions;
 | 
					import com.plotsquared.core.configuration.Captions;
 | 
				
			||||||
import com.plotsquared.core.configuration.ConfigurationSection;
 | 
					import com.plotsquared.core.configuration.ConfigurationSection;
 | 
				
			||||||
import com.plotsquared.core.configuration.ConfigurationUtil;
 | 
					import com.plotsquared.core.configuration.ConfigurationUtil;
 | 
				
			||||||
 | 
					import com.plotsquared.core.configuration.caption.Caption;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.Templates;
 | 
					import com.plotsquared.core.configuration.caption.Templates;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
					import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
				
			||||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
 | 
					import com.plotsquared.core.configuration.file.YamlConfiguration;
 | 
				
			||||||
@@ -58,6 +59,7 @@ import com.plotsquared.core.util.SetupUtils;
 | 
				
			|||||||
import com.plotsquared.core.util.StringMan;
 | 
					import com.plotsquared.core.util.StringMan;
 | 
				
			||||||
import com.plotsquared.core.util.WorldUtil;
 | 
					import com.plotsquared.core.util.WorldUtil;
 | 
				
			||||||
import com.plotsquared.core.util.task.RunnableVal;
 | 
					import com.plotsquared.core.util.task.RunnableVal;
 | 
				
			||||||
 | 
					import com.plotsquared.core.util.task.RunnableVal3;
 | 
				
			||||||
import com.sk89q.worldedit.EditSession;
 | 
					import com.sk89q.worldedit.EditSession;
 | 
				
			||||||
import com.sk89q.worldedit.LocalSession;
 | 
					import com.sk89q.worldedit.LocalSession;
 | 
				
			||||||
import com.sk89q.worldedit.WorldEdit;
 | 
					import com.sk89q.worldedit.WorldEdit;
 | 
				
			||||||
@@ -584,14 +586,18 @@ public class Area extends SubCommand {
 | 
				
			|||||||
                    percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE;
 | 
					                    percent = claimed == 0 ? 0 : 100d * claimed / Integer.MAX_VALUE;
 | 
				
			||||||
                    region = "N/A";
 | 
					                    region = "N/A";
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                String value =
 | 
					                Template headerTemplate = Template.of("header", TranslatableCaption.of("info.plot_info_header").getComponent(player));
 | 
				
			||||||
                    "&r$1NAME: " + name + "\n$1Type: $2" + area.getType() + "\n$1Terrain: $2" + area
 | 
					                Template nameTemplate = Template.of("name", name);
 | 
				
			||||||
                        .getTerrain() + "\n$1Usage: $2" + String.format("%.2f", percent) + '%'
 | 
					                Template typeTemplate = Template.of("type", area.getType().name());
 | 
				
			||||||
                        + "\n$1Claimed: $2" + claimed + "\n$1Clusters: $2" + clusters
 | 
					                Template terrainTemplate = Template.of("terrain", area.getTerrain().name());
 | 
				
			||||||
                        + "\n$1Region: $2" + region + "\n$1Generator: $2" + generator;
 | 
					                Template usageTemplate = Template.of("usage", String.format("%.2f", percent));
 | 
				
			||||||
                MainUtil.sendMessage(player,
 | 
					                Template claimedTemplate = Template.of("name", String.valueOf(claimed));
 | 
				
			||||||
                    Captions.PLOT_INFO_HEADER.getTranslated() + '\n' + value + '\n'
 | 
					                Template clustersTemplate = Template.of("name", String.valueOf(clusters));
 | 
				
			||||||
                        + Captions.PLOT_INFO_FOOTER.getTranslated(), false);
 | 
					                Template regionTemplate = Template.of("name", region);
 | 
				
			||||||
 | 
					                Template generatorTemplate = Template.of("name", generator);
 | 
				
			||||||
 | 
					                Template footerTemplate = Template.of("name", TranslatableCaption.of("info.plot_info_footer").getComponent(player));
 | 
				
			||||||
 | 
					                player.sendMessage(TranslatableCaption.of("info.area_format"), headerTemplate, nameTemplate, typeTemplate, terrainTemplate,
 | 
				
			||||||
 | 
					                    usageTemplate, claimedTemplate, clustersTemplate, regionTemplate, generatorTemplate, footerTemplate);
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            case "l":
 | 
					            case "l":
 | 
				
			||||||
@@ -621,8 +627,8 @@ public class Area extends SubCommand {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                final List<PlotArea> areas = new ArrayList<>(Arrays.asList(this.plotAreaManager.getAllPlotAreas()));
 | 
					                final List<PlotArea> areas = new ArrayList<>(Arrays.asList(this.plotAreaManager.getAllPlotAreas()));
 | 
				
			||||||
                paginate(player, areas, 8, page,
 | 
					                paginate(player, areas, 8, page,
 | 
				
			||||||
                    new RunnableVal3<Integer, PlotArea, PlotMessage>() {
 | 
					                    new RunnableVal3<Integer, PlotArea, Caption>() {
 | 
				
			||||||
                        @Override public void run(Integer i, PlotArea area, PlotMessage message) {
 | 
					                        @Override public void run(Integer i, PlotArea area, Caption message) {
 | 
				
			||||||
                            String name;
 | 
					                            String name;
 | 
				
			||||||
                            double percent;
 | 
					                            double percent;
 | 
				
			||||||
                            int claimed = area.getPlotCount();
 | 
					                            int claimed = area.getPlotCount();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,7 @@ package com.plotsquared.core.command;
 | 
				
			|||||||
import com.plotsquared.core.PlotSquared;
 | 
					import com.plotsquared.core.PlotSquared;
 | 
				
			||||||
import com.plotsquared.core.configuration.Captions;
 | 
					import com.plotsquared.core.configuration.Captions;
 | 
				
			||||||
import com.plotsquared.core.configuration.Settings;
 | 
					import com.plotsquared.core.configuration.Settings;
 | 
				
			||||||
 | 
					import com.plotsquared.core.configuration.caption.Caption;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.StaticCaption;
 | 
					import com.plotsquared.core.configuration.caption.StaticCaption;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
					import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
				
			||||||
import com.plotsquared.core.database.DBFunc;
 | 
					import com.plotsquared.core.database.DBFunc;
 | 
				
			||||||
@@ -759,13 +760,13 @@ public class Cluster extends SubCommand {
 | 
				
			|||||||
                            String size = (cluster.getP2().getX() - cluster.getP1().getX() + 1) + "x" + (
 | 
					                            String size = (cluster.getP2().getX() - cluster.getP1().getX() + 1) + "x" + (
 | 
				
			||||||
                                cluster.getP2().getY() - cluster.getP1().getY() + 1);
 | 
					                                cluster.getP2().getY() - cluster.getP1().getY() + 1);
 | 
				
			||||||
                            String rights = cluster.isAdded(player.getUUID()) + "";
 | 
					                            String rights = cluster.isAdded(player.getUUID()) + "";
 | 
				
			||||||
                            String message = Captions.CLUSTER_INFO.getTranslated();
 | 
					                            Caption message = TranslatableCaption.of("cluster.cluster_info");
 | 
				
			||||||
                            message = message.replaceAll("%id%", id);
 | 
					                            Template idTemplate = Template.of("id", id);
 | 
				
			||||||
                            message = message.replaceAll("%owner%", owner);
 | 
					                            Template ownerTemplate = Template.of("owner", owner);
 | 
				
			||||||
                            message = message.replaceAll("%name%", name);
 | 
					                            Template nameTemplate = Template.of("name", name);
 | 
				
			||||||
                            message = message.replaceAll("%size%", size);
 | 
					                            Template sizeTemplate = Template.of("size", size);
 | 
				
			||||||
                            message = message.replaceAll("%rights%", rights);
 | 
					                            Template rightsTemplate = Template.of("rights", rights);
 | 
				
			||||||
                            player.sendMessage(StaticCaption.of(message));
 | 
					                            player.sendMessage(message, idTemplate, ownerTemplate, nameTemplate, sizeTemplate, rightsTemplate);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -217,6 +217,7 @@ public class DatabaseCommand extends SubCommand {
 | 
				
			|||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                default:
 | 
					                default:
 | 
				
			||||||
                    player.sendMessage(StaticCaption.of("/plot database [sqlite/mysql]"));
 | 
					                    player.sendMessage(StaticCaption.of("/plot database [sqlite/mysql]"));
 | 
				
			||||||
 | 
					                    return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                SQLManager manager = new SQLManager(implementation, prefix, this.eventDispatcher, this.plotListener, this.worldConfiguration);
 | 
					                SQLManager manager = new SQLManager(implementation, prefix, this.eventDispatcher, this.plotListener, this.worldConfiguration);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,6 +42,7 @@ import com.plotsquared.core.util.EventDispatcher;
 | 
				
			|||||||
import com.plotsquared.core.util.Expression;
 | 
					import com.plotsquared.core.util.Expression;
 | 
				
			||||||
import com.plotsquared.core.util.Permissions;
 | 
					import com.plotsquared.core.util.Permissions;
 | 
				
			||||||
import com.plotsquared.core.util.StringMan;
 | 
					import com.plotsquared.core.util.StringMan;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
				
			||||||
import net.kyori.adventure.text.minimessage.Template;
 | 
					import net.kyori.adventure.text.minimessage.Template;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.annotation.Nonnull;
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
@@ -60,6 +61,7 @@ public class Merge extends SubCommand {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public static final String[] values = new String[] {"north", "east", "south", "west"};
 | 
					    public static final String[] values = new String[] {"north", "east", "south", "west"};
 | 
				
			||||||
    public static final String[] aliases = new String[] {"n", "e", "s", "w"};
 | 
					    public static final String[] aliases = new String[] {"n", "e", "s", "w"};
 | 
				
			||||||
 | 
					    private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final EventDispatcher eventDispatcher;
 | 
					    private final EventDispatcher eventDispatcher;
 | 
				
			||||||
    private final EconHandler econHandler;
 | 
					    private final EconHandler econHandler;
 | 
				
			||||||
@@ -283,8 +285,9 @@ public class Merge extends SubCommand {
 | 
				
			|||||||
                player.sendMessage(TranslatableCaption.of("merge.success_merge"));
 | 
					                player.sendMessage(TranslatableCaption.of("merge.success_merge"));
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
            if (!force && hasConfirmation(player)) {
 | 
					            if (!force && hasConfirmation(player)) {
 | 
				
			||||||
                CmdConfirm.addPending(accepter, Captions.MERGE_REQUEST_CONFIRM.getTranslated()
 | 
					                CmdConfirm.addPending(accepter, MINI_MESSAGE.serialize(MINI_MESSAGE
 | 
				
			||||||
                    .replaceAll("%s", player.getName()), run);
 | 
					                        .parse(TranslatableCaption.of("merge.merge_request_confirm").getComponent(player), Template.of("player", player.getName()))),
 | 
				
			||||||
 | 
					                    run);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                run.run();
 | 
					                run.run();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,7 +68,7 @@ public class Reload extends SubCommand {
 | 
				
			|||||||
            // The following won't affect world generation, as that has to be
 | 
					            // The following won't affect world generation, as that has to be
 | 
				
			||||||
            // loaded during startup unfortunately.
 | 
					            // loaded during startup unfortunately.
 | 
				
			||||||
            PlotSquared.get().setupConfigs();
 | 
					            PlotSquared.get().setupConfigs();
 | 
				
			||||||
            Captions.load(PlotSquared.get().translationFile);
 | 
					            PlotSquared.get().loadCaptionMap();
 | 
				
			||||||
            this.plotAreaManager.forEachPlotArea(area -> {
 | 
					            this.plotAreaManager.forEachPlotArea(area -> {
 | 
				
			||||||
                ConfigurationSection worldSection = this.worldConfiguration
 | 
					                ConfigurationSection worldSection = this.worldConfiguration
 | 
				
			||||||
                    .getConfigurationSection("worlds." + area.getWorldName());
 | 
					                    .getConfigurationSection("worlds." + area.getWorldName());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,6 +26,7 @@
 | 
				
			|||||||
package com.plotsquared.core.configuration.caption;
 | 
					package com.plotsquared.core.configuration.caption;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.plotsquared.core.plot.PlotArea;
 | 
					import com.plotsquared.core.plot.PlotArea;
 | 
				
			||||||
 | 
					import com.plotsquared.core.util.PlayerManager;
 | 
				
			||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
					import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
				
			||||||
import net.kyori.adventure.text.minimessage.Template;
 | 
					import net.kyori.adventure.text.minimessage.Template;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -67,7 +68,7 @@ public final class Templates {
 | 
				
			|||||||
     * @return Generated template
 | 
					     * @return Generated template
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Nonnull public static Template of(@Nonnull final String key, @Nonnull final UUID uuid) {
 | 
					    @Nonnull public static Template of(@Nonnull final String key, @Nonnull final UUID uuid) {
 | 
				
			||||||
        final String username = MainUtil.getName(uuid);
 | 
					        final String username = PlayerManager.getName(uuid);
 | 
				
			||||||
        return Template.of(key, username);
 | 
					        return Template.of(key, username);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,11 +28,13 @@ package com.plotsquared.core.listener;
 | 
				
			|||||||
import com.plotsquared.core.PlotSquared;
 | 
					import com.plotsquared.core.PlotSquared;
 | 
				
			||||||
import com.plotsquared.core.configuration.Captions;
 | 
					import com.plotsquared.core.configuration.Captions;
 | 
				
			||||||
import com.plotsquared.core.configuration.Settings;
 | 
					import com.plotsquared.core.configuration.Settings;
 | 
				
			||||||
 | 
					import com.plotsquared.core.configuration.caption.StaticCaption;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.Templates;
 | 
					import com.plotsquared.core.configuration.caption.Templates;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
					import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
				
			||||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
 | 
					import com.plotsquared.core.events.PlotFlagRemoveEvent;
 | 
				
			||||||
import com.plotsquared.core.events.Result;
 | 
					import com.plotsquared.core.events.Result;
 | 
				
			||||||
import com.plotsquared.core.location.Location;
 | 
					import com.plotsquared.core.location.Location;
 | 
				
			||||||
 | 
					import com.plotsquared.core.player.ConsolePlayer;
 | 
				
			||||||
import com.plotsquared.core.player.MetaDataAccess;
 | 
					import com.plotsquared.core.player.MetaDataAccess;
 | 
				
			||||||
import com.plotsquared.core.player.PlayerMetaDataKeys;
 | 
					import com.plotsquared.core.player.PlayerMetaDataKeys;
 | 
				
			||||||
import com.plotsquared.core.player.PlotPlayer;
 | 
					import com.plotsquared.core.player.PlotPlayer;
 | 
				
			||||||
@@ -159,7 +161,7 @@ public class PlotListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            final String greeting = plot.getFlag(GreetingFlag.class);
 | 
					            final String greeting = plot.getFlag(GreetingFlag.class);
 | 
				
			||||||
            if (!greeting.isEmpty()) {
 | 
					            if (!greeting.isEmpty()) {
 | 
				
			||||||
                plot.format(greeting, player, false).thenAcceptAsync(player::sendMessage);
 | 
					                plot.format(StaticCaption.of(greeting), player, false).thenAcceptAsync(player::sendMessage);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (plot.getFlag(NotifyEnterFlag.class)) {
 | 
					            if (plot.getFlag(NotifyEnterFlag.class)) {
 | 
				
			||||||
@@ -270,8 +272,8 @@ public class PlotListener {
 | 
				
			|||||||
            CommentManager.sendTitle(player, plot);
 | 
					            CommentManager.sendTitle(player, plot);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (titles && !player.getAttribute("disabletitles")) {
 | 
					            if (titles && !player.getAttribute("disabletitles")) {
 | 
				
			||||||
                if (!Captions.TITLE_ENTERED_PLOT.getTranslated().isEmpty()
 | 
					                if (!TranslatableCaption.of("titles.title_entered_plot").getComponent(ConsolePlayer.getConsole()).isEmpty()
 | 
				
			||||||
                    || !Captions.TITLE_ENTERED_PLOT_SUB.getTranslated().isEmpty()) {
 | 
					                    || !TranslatableCaption.of("titles.title_entered_plot_sub").getComponent(ConsolePlayer.getConsole()).isEmpty()) {
 | 
				
			||||||
                    TaskManager.runTaskLaterAsync(() -> {
 | 
					                    TaskManager.runTaskLaterAsync(() -> {
 | 
				
			||||||
                        Plot lastPlot = null;
 | 
					                        Plot lastPlot = null;
 | 
				
			||||||
                        try (final MetaDataAccess<Plot> lastPlotAccess =
 | 
					                        try (final MetaDataAccess<Plot> lastPlotAccess =
 | 
				
			||||||
@@ -346,7 +348,7 @@ public class PlotListener {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                final String farewell = plot.getFlag(FarewellFlag.class);
 | 
					                final String farewell = plot.getFlag(FarewellFlag.class);
 | 
				
			||||||
                if (!farewell.isEmpty()) {
 | 
					                if (!farewell.isEmpty()) {
 | 
				
			||||||
                    plot.format(farewell, player, false).thenAcceptAsync(player::sendMessage);
 | 
					                    plot.format(StaticCaption.of(farewell), player, false).thenAcceptAsync(player::sendMessage);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (plot.getFlag(NotifyLeaveFlag.class)) {
 | 
					                if (plot.getFlag(NotifyLeaveFlag.class)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,6 +70,7 @@ import net.kyori.adventure.text.Component;
 | 
				
			|||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
					import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
				
			||||||
import net.kyori.adventure.text.minimessage.Template;
 | 
					import net.kyori.adventure.text.minimessage.Template;
 | 
				
			||||||
import net.kyori.adventure.title.Title;
 | 
					import net.kyori.adventure.title.Title;
 | 
				
			||||||
 | 
					import org.jetbrains.annotations.NotNull;
 | 
				
			||||||
import org.slf4j.Logger;
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
import org.slf4j.LoggerFactory;
 | 
					import org.slf4j.LoggerFactory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -866,6 +867,11 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Redefine from PermissionHolder as it's required from CommandCaller
 | 
				
			||||||
 | 
					    @Override public boolean hasPermission(@NotNull String permission) {
 | 
				
			||||||
 | 
					        return hasPermission(null, permission);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    boolean hasPersistentMeta(String key) {
 | 
					    boolean hasPersistentMeta(String key) {
 | 
				
			||||||
        return this.metaMap.containsKey(key);
 | 
					        return this.metaMap.containsKey(key);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -884,7 +890,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override public void setLocale(@Nonnull final Locale locale) {
 | 
					    @Override public void setLocale(@Nonnull final Locale locale) {
 | 
				
			||||||
        if (!PlotSquared.get().getCaptionMap().supportsLocale(locale)) {
 | 
					        if (!PlotSquared.get().getCaptionMap(TranslatableCaption.DEFAULT_NAMESPACE).supportsLocale(locale)) {
 | 
				
			||||||
            this.locale = Locale.forLanguageTag(Settings.Enabled_Components.DEFAULT_LOCALE);
 | 
					            this.locale = Locale.forLanguageTag(Settings.Enabled_Components.DEFAULT_LOCALE);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            this.locale = locale;
 | 
					            this.locale = locale;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -142,13 +142,12 @@ public class Plot {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private static final Logger logger = LoggerFactory.getLogger("P2/" + Plot.class.getSimpleName());
 | 
					    private static final Logger logger = LoggerFactory.getLogger("P2/" + Plot.class.getSimpleName());
 | 
				
			||||||
    private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
 | 
					    private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
 | 
				
			||||||
 | 
					 | 
				
			||||||
    private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    static {
 | 
					    static {
 | 
				
			||||||
        FLAG_DECIMAL_FORMAT.setMaximumFractionDigits(340);
 | 
					        FLAG_DECIMAL_FORMAT.setMaximumFractionDigits(340);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static Set<Plot> connected_cache;
 | 
					    private static Set<Plot> connected_cache;
 | 
				
			||||||
    private static Set<CuboidRegion> regions_cache;
 | 
					    private static Set<CuboidRegion> regions_cache;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1893,6 +1892,7 @@ public class Plot {
 | 
				
			|||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Register a plot and create it in the database<br>
 | 
					     * Register a plot and create it in the database<br>
 | 
				
			||||||
     * - The plot will not be created if the owner is null<br>
 | 
					     * - The plot will not be created if the owner is null<br>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,12 +29,13 @@ import com.google.common.collect.ImmutableMap;
 | 
				
			|||||||
import com.google.common.collect.ImmutableSet;
 | 
					import com.google.common.collect.ImmutableSet;
 | 
				
			||||||
import com.google.common.collect.Lists;
 | 
					import com.google.common.collect.Lists;
 | 
				
			||||||
import com.plotsquared.core.collection.QuadMap;
 | 
					import com.plotsquared.core.collection.QuadMap;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.CaptionUtility;
 | 
					 | 
				
			||||||
import com.plotsquared.core.configuration.Captions;
 | 
					 | 
				
			||||||
import com.plotsquared.core.configuration.ConfigurationNode;
 | 
					import com.plotsquared.core.configuration.ConfigurationNode;
 | 
				
			||||||
import com.plotsquared.core.configuration.ConfigurationSection;
 | 
					import com.plotsquared.core.configuration.ConfigurationSection;
 | 
				
			||||||
import com.plotsquared.core.configuration.ConfigurationUtil;
 | 
					import com.plotsquared.core.configuration.ConfigurationUtil;
 | 
				
			||||||
import com.plotsquared.core.configuration.Settings;
 | 
					import com.plotsquared.core.configuration.Settings;
 | 
				
			||||||
 | 
					import com.plotsquared.core.configuration.caption.CaptionUtility;
 | 
				
			||||||
 | 
					import com.plotsquared.core.configuration.caption.LocaleHolder;
 | 
				
			||||||
 | 
					import com.plotsquared.core.configuration.caption.StaticCaption;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
					import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
				
			||||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
 | 
					import com.plotsquared.core.configuration.file.YamlConfiguration;
 | 
				
			||||||
import com.plotsquared.core.generator.GridPlotWorld;
 | 
					import com.plotsquared.core.generator.GridPlotWorld;
 | 
				
			||||||
@@ -43,6 +44,7 @@ import com.plotsquared.core.inject.annotations.WorldConfig;
 | 
				
			|||||||
import com.plotsquared.core.location.Direction;
 | 
					import com.plotsquared.core.location.Direction;
 | 
				
			||||||
import com.plotsquared.core.location.Location;
 | 
					import com.plotsquared.core.location.Location;
 | 
				
			||||||
import com.plotsquared.core.location.PlotLoc;
 | 
					import com.plotsquared.core.location.PlotLoc;
 | 
				
			||||||
 | 
					import com.plotsquared.core.player.ConsolePlayer;
 | 
				
			||||||
import com.plotsquared.core.player.MetaDataAccess;
 | 
					import com.plotsquared.core.player.MetaDataAccess;
 | 
				
			||||||
import com.plotsquared.core.player.PlayerMetaDataKeys;
 | 
					import com.plotsquared.core.player.PlayerMetaDataKeys;
 | 
				
			||||||
import com.plotsquared.core.player.PlotPlayer;
 | 
					import com.plotsquared.core.player.PlotPlayer;
 | 
				
			||||||
@@ -51,6 +53,7 @@ import com.plotsquared.core.plot.flag.FlagParseException;
 | 
				
			|||||||
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
 | 
					import com.plotsquared.core.plot.flag.GlobalFlagContainer;
 | 
				
			||||||
import com.plotsquared.core.plot.flag.PlotFlag;
 | 
					import com.plotsquared.core.plot.flag.PlotFlag;
 | 
				
			||||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
 | 
					import com.plotsquared.core.plot.flag.implementations.DoneFlag;
 | 
				
			||||||
 | 
					import com.plotsquared.core.plot.flag.types.DoubleFlag;
 | 
				
			||||||
import com.plotsquared.core.queue.GlobalBlockQueue;
 | 
					import com.plotsquared.core.queue.GlobalBlockQueue;
 | 
				
			||||||
import com.plotsquared.core.queue.LocalBlockQueue;
 | 
					import com.plotsquared.core.queue.LocalBlockQueue;
 | 
				
			||||||
import com.plotsquared.core.util.EconHandler;
 | 
					import com.plotsquared.core.util.EconHandler;
 | 
				
			||||||
@@ -65,11 +68,15 @@ import com.sk89q.worldedit.world.biome.BiomeType;
 | 
				
			|||||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
 | 
					import com.sk89q.worldedit.world.biome.BiomeTypes;
 | 
				
			||||||
import com.sk89q.worldedit.world.gamemode.GameMode;
 | 
					import com.sk89q.worldedit.world.gamemode.GameMode;
 | 
				
			||||||
import com.sk89q.worldedit.world.gamemode.GameModes;
 | 
					import com.sk89q.worldedit.world.gamemode.GameModes;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.Component;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.minimessage.Template;
 | 
				
			||||||
import org.slf4j.Logger;
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
import org.slf4j.LoggerFactory;
 | 
					import org.slf4j.LoggerFactory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.annotation.Nonnull;
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
import javax.annotation.Nullable;
 | 
					import javax.annotation.Nullable;
 | 
				
			||||||
 | 
					import java.text.DecimalFormat;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.Collection;
 | 
					import java.util.Collection;
 | 
				
			||||||
import java.util.Collections;
 | 
					import java.util.Collections;
 | 
				
			||||||
@@ -89,6 +96,11 @@ import java.util.function.Consumer;
 | 
				
			|||||||
public abstract class PlotArea {
 | 
					public abstract class PlotArea {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotArea.class.getSimpleName());
 | 
					    private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotArea.class.getSimpleName());
 | 
				
			||||||
 | 
					    private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
 | 
				
			||||||
 | 
					    private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
 | 
				
			||||||
 | 
					    static {
 | 
				
			||||||
 | 
					        FLAG_DECIMAL_FORMAT.setMaximumFractionDigits(340);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected final ConcurrentHashMap<PlotId, Plot> plots = new ConcurrentHashMap<>();
 | 
					    protected final ConcurrentHashMap<PlotId, Plot> plots = new ConcurrentHashMap<>();
 | 
				
			||||||
    @Nonnull private final String worldName;
 | 
					    @Nonnull private final String worldName;
 | 
				
			||||||
@@ -369,20 +381,10 @@ public abstract class PlotArea {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        this.getFlagContainer().addAll(parseFlags(flags));
 | 
					        this.getFlagContainer().addAll(parseFlags(flags));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        StringBuilder flagBuilder = new StringBuilder();
 | 
					        Component flagsComponent = null;
 | 
				
			||||||
        Collection<PlotFlag<?, ?>> flagCollection = this.getFlagContainer().getFlagMap().values();
 | 
					        Collection<PlotFlag<?, ?>> flagCollection = this.getFlagContainer().getFlagMap().values();
 | 
				
			||||||
        if (flagCollection.isEmpty()) {
 | 
					        flagsComponent = getFlagsComponent(flagsComponent, flagCollection);
 | 
				
			||||||
            flagBuilder.append(TranslatableCaption.of("info.none"));
 | 
					        ConsolePlayer.getConsole().sendMessage(StaticCaption.of("[P2] - area flags: <flags>"), Template.of("flags", flagsComponent));
 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            String prefix = " ";
 | 
					 | 
				
			||||||
            for (final PlotFlag<?, ?> flag : flagCollection) {
 | 
					 | 
				
			||||||
                Object value = flag.toString();
 | 
					 | 
				
			||||||
                flagBuilder.append(prefix).append(CaptionUtility
 | 
					 | 
				
			||||||
                    .format(null, Captions.PLOT_FLAG_LIST.getTranslated(), flag.getName(),
 | 
					 | 
				
			||||||
                        CaptionUtility.formatRaw(null, value.toString(), "")));
 | 
					 | 
				
			||||||
                prefix = ", ";
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.spawnEggs = config.getBoolean("event.spawn.egg");
 | 
					        this.spawnEggs = config.getBoolean("event.spawn.egg");
 | 
				
			||||||
        this.spawnCustom = config.getBoolean("event.spawn.custom");
 | 
					        this.spawnCustom = config.getBoolean("event.spawn.custom");
 | 
				
			||||||
@@ -404,25 +406,39 @@ public abstract class PlotArea {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        this.getRoadFlagContainer().addAll(parseFlags(roadflags));
 | 
					        this.getRoadFlagContainer().addAll(parseFlags(roadflags));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        StringBuilder roadFlagBuilder = new StringBuilder();
 | 
					        Component roadFlagsComponent = null;
 | 
				
			||||||
        Collection<PlotFlag<?, ?>> roadFlagCollection = this.getFlagContainer().getFlagMap().values();
 | 
					        Collection<PlotFlag<?, ?>> roadFlagCollection = this.getRoadFlagContainer().getFlagMap().values();
 | 
				
			||||||
        if (roadFlagCollection.isEmpty()) {
 | 
					        roadFlagsComponent = getFlagsComponent(roadFlagsComponent, roadFlagCollection);
 | 
				
			||||||
            roadFlagBuilder.append(TranslatableCaption.of("info.none"));
 | 
					        ConsolePlayer.getConsole().sendMessage(StaticCaption.of("[P2] - road flags: <flags>"), Template.of("flags", roadFlagsComponent));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        loadConfiguration(config);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Component getFlagsComponent(Component flagsComponent, Collection<PlotFlag<?, ?>> flagCollection) {
 | 
				
			||||||
 | 
					        if (flagCollection.isEmpty()) {
 | 
				
			||||||
 | 
					            flagsComponent = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(LocaleHolder.console()));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            roadFlags = true;
 | 
					 | 
				
			||||||
            String prefix = " ";
 | 
					            String prefix = " ";
 | 
				
			||||||
            for (final PlotFlag<?, ?> flag : roadFlagCollection) {
 | 
					            for (final PlotFlag<?, ?> flag : flagCollection) {
 | 
				
			||||||
                Object value = flag.toString();
 | 
					                Object value;
 | 
				
			||||||
                roadFlagBuilder.append(prefix).append(CaptionUtility
 | 
					                if (flag instanceof DoubleFlag && !Settings.General.SCIENTIFIC) {
 | 
				
			||||||
                    .format(null, Captions.PLOT_FLAG_LIST.getTranslated(), flag.getName(),
 | 
					                    value = FLAG_DECIMAL_FORMAT.format(flag.getValue());
 | 
				
			||||||
                        CaptionUtility.formatRaw(null, value.toString(), "")));
 | 
					                } else {
 | 
				
			||||||
 | 
					                    value = flag.toString();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                Component snip = MINI_MESSAGE.parse(prefix + CaptionUtility
 | 
				
			||||||
 | 
					                        .format(ConsolePlayer.getConsole(), TranslatableCaption.of("info.plot_flag_list").getComponent(LocaleHolder.console())),
 | 
				
			||||||
 | 
					                    Template.of("flag", flag.getName()),
 | 
				
			||||||
 | 
					                    Template.of("value", CaptionUtility.formatRaw(ConsolePlayer.getConsole(), value.toString())));
 | 
				
			||||||
 | 
					                if (flagsComponent != null) {
 | 
				
			||||||
 | 
					                    flagsComponent.append(snip);
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    flagsComponent = snip;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                prefix = ", ";
 | 
					                prefix = ", ";
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        return flagsComponent;
 | 
				
			||||||
        logger.info("[P2] - road flags: {}", roadFlagBuilder.toString());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        loadConfiguration(config);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public abstract void loadConfiguration(ConfigurationSection config);
 | 
					    public abstract void loadConfiguration(ConfigurationSection config);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,7 +59,7 @@ public abstract class BooleanFlag<F extends PlotFlag<Boolean, F>> extends PlotFl
 | 
				
			|||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param description Flag description
 | 
					     * @param description Flag description
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    protected BooleanFlag(final Captions description) {
 | 
					    protected BooleanFlag(final Caption description) {
 | 
				
			||||||
        this(false, description);
 | 
					        this(false, description);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,7 @@ import java.util.List;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public abstract class ListFlag<V, F extends PlotFlag<List<V>, F>> extends PlotFlag<List<V>, F> {
 | 
					public abstract class ListFlag<V, F extends PlotFlag<List<V>, F>> extends PlotFlag<List<V>, F> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ListFlag(final List<V> valueList, final Captions category, final Caption description) {
 | 
					    public ListFlag(final List<V> valueList, final Caption category, final Caption description) {
 | 
				
			||||||
        super(Collections.unmodifiableList(valueList), category, description);
 | 
					        super(Collections.unmodifiableList(valueList), category, description);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,9 +30,13 @@ import com.plotsquared.core.configuration.Captions;
 | 
				
			|||||||
import com.plotsquared.core.configuration.Settings;
 | 
					import com.plotsquared.core.configuration.Settings;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
					import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
				
			||||||
import com.plotsquared.core.database.DBFunc;
 | 
					import com.plotsquared.core.database.DBFunc;
 | 
				
			||||||
 | 
					import com.plotsquared.core.player.ConsolePlayer;
 | 
				
			||||||
import com.plotsquared.core.player.OfflinePlotPlayer;
 | 
					import com.plotsquared.core.player.OfflinePlotPlayer;
 | 
				
			||||||
import com.plotsquared.core.player.PlotPlayer;
 | 
					import com.plotsquared.core.player.PlotPlayer;
 | 
				
			||||||
import com.plotsquared.core.uuid.UUIDMapping;
 | 
					import com.plotsquared.core.uuid.UUIDMapping;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.Component;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.minimessage.Template;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.annotation.Nonnull;
 | 
					import javax.annotation.Nonnull;
 | 
				
			||||||
import javax.annotation.Nullable;
 | 
					import javax.annotation.Nullable;
 | 
				
			||||||
@@ -54,6 +58,8 @@ import java.util.function.BiConsumer;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
 | 
					public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final Map<UUID, P> playerMap = new HashMap<>();
 | 
					    private final Map<UUID, P> playerMap = new HashMap<>();
 | 
				
			||||||
    private final Object playerLock = new Object();
 | 
					    private final Object playerLock = new Object();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -116,11 +122,11 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
 | 
				
			|||||||
        final List<String> users = new LinkedList<>();
 | 
					        final List<String> users = new LinkedList<>();
 | 
				
			||||||
        for (final UUID uuid : uuids) {
 | 
					        for (final UUID uuid : uuids) {
 | 
				
			||||||
            if (uuid == null) {
 | 
					            if (uuid == null) {
 | 
				
			||||||
                users.add(Captions.NONE.getTranslated());
 | 
					                users.add(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.none").getComponent(ConsolePlayer.getConsole())));
 | 
				
			||||||
            } else if (DBFunc.EVERYONE.equals(uuid)) {
 | 
					            } else if (DBFunc.EVERYONE.equals(uuid)) {
 | 
				
			||||||
                users.add(Captions.EVERYONE.getTranslated());
 | 
					                users.add(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.everyone").getComponent(ConsolePlayer.getConsole())));
 | 
				
			||||||
            } else if (DBFunc.SERVER.equals(uuid)) {
 | 
					            } else if (DBFunc.SERVER.equals(uuid)) {
 | 
				
			||||||
                users.add(Captions.SERVER.getTranslated());
 | 
					                users.add(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.console").getComponent(ConsolePlayer.getConsole())));
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                players.add(uuid);
 | 
					                players.add(uuid);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -135,13 +141,13 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
 | 
				
			|||||||
            e.printStackTrace();
 | 
					            e.printStackTrace();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String c = Captions.PLOT_USER_LIST.getTranslated();
 | 
					        String c = TranslatableCaption.of("info.plot_user_list").getComponent(ConsolePlayer.getConsole());
 | 
				
			||||||
        StringBuilder list = new StringBuilder();
 | 
					        Component list = MINI_MESSAGE.deserialize("");
 | 
				
			||||||
        for (int x = 0; x < users.size(); x++) {
 | 
					        for (int x = 0; x < users.size(); x++) {
 | 
				
			||||||
            if (x + 1 == uuids.size()) {
 | 
					            if (x + 1 == uuids.size()) {
 | 
				
			||||||
                list.append(c.replace("%user%", users.get(x)).replace(",", ""));
 | 
					                list.append(MINI_MESSAGE.parse(c, Template.of("user", users.get(x))));
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                list.append(c.replace("%user%", users.get(x)));
 | 
					                list.append(MINI_MESSAGE.parse(c + ", ", Template.of("user", users.get(x))));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return list.toString();
 | 
					        return list.toString();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,11 +26,11 @@
 | 
				
			|||||||
package com.plotsquared.core.util.helpmenu;
 | 
					package com.plotsquared.core.util.helpmenu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.plotsquared.core.command.CommandCategory;
 | 
					import com.plotsquared.core.command.CommandCategory;
 | 
				
			||||||
import com.plotsquared.core.configuration.Captions;
 | 
					 | 
				
			||||||
import com.plotsquared.core.configuration.caption.StaticCaption;
 | 
					import com.plotsquared.core.configuration.caption.StaticCaption;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
					import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
				
			||||||
import com.plotsquared.core.player.PlotPlayer;
 | 
					import com.plotsquared.core.player.PlotPlayer;
 | 
				
			||||||
import com.plotsquared.core.util.StringMan;
 | 
					import com.plotsquared.core.util.StringMan;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
				
			||||||
import net.kyori.adventure.text.minimessage.Template;
 | 
					import net.kyori.adventure.text.minimessage.Template;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
@@ -38,27 +38,29 @@ import java.util.List;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class HelpPage {
 | 
					public class HelpPage {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
 | 
				
			||||||
    private final List<HelpObject> helpObjects;
 | 
					    private final List<HelpObject> helpObjects;
 | 
				
			||||||
    private final String header;
 | 
					    private final Template catTemplate;
 | 
				
			||||||
 | 
					    private final Template curTemplate;
 | 
				
			||||||
 | 
					    private final Template maxTemplate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public HelpPage(CommandCategory category, int currentPage, int maxPages) {
 | 
					    public HelpPage(CommandCategory category, int currentPage, int maxPages) {
 | 
				
			||||||
        this.helpObjects = new ArrayList<>();
 | 
					        this.helpObjects = new ArrayList<>();
 | 
				
			||||||
        this.header = Captions.HELP_PAGE_HEADER.getTranslated()
 | 
					        this.catTemplate = Template.of("category", category == null ? "ALL" : category.name());
 | 
				
			||||||
            .replace("%category%", category == null ? "ALL" : category.toString())
 | 
					        this.curTemplate = Template.of("current", String.valueOf(currentPage + 1));
 | 
				
			||||||
            .replace("%current%", (currentPage + 1) + "").replace("%max%", (maxPages + 1) + "");
 | 
					        this.maxTemplate = Template.of("max", String.valueOf(maxPages + 1));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void render(PlotPlayer player) {
 | 
					    public void render(PlotPlayer player) {
 | 
				
			||||||
        if (this.helpObjects.size() < 1) {
 | 
					        if (this.helpObjects.size() < 1) {
 | 
				
			||||||
            player.sendMessage(
 | 
					            player.sendMessage(TranslatableCaption.of("invalid.not_valid_number"), Template.of("value", "(0)"));
 | 
				
			||||||
                    TranslatableCaption.of("invalid.not_valid_number"),
 | 
					 | 
				
			||||||
                    Template.of("value", "(0)")
 | 
					 | 
				
			||||||
            );
 | 
					 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            String message =
 | 
					            Template header = Template.of("header", TranslatableCaption.of("help.help_header").getComponent(player));
 | 
				
			||||||
                Captions.HELP_HEADER.getTranslated() + "\n" + this.header + "\n" + StringMan
 | 
					            Template page_header = Template.of("page_header",
 | 
				
			||||||
                    .join(this.helpObjects, "\n") + "\n" + Captions.HELP_FOOTER.getTranslated();
 | 
					                MINI_MESSAGE.parse(TranslatableCaption.of("help.help_page_header").getComponent(player), catTemplate, curTemplate, maxTemplate));
 | 
				
			||||||
            player.sendMessage(StaticCaption.of(message));
 | 
					            Template help_objects = Template.of("help_objects", StringMan.join(this.helpObjects, "\n"));
 | 
				
			||||||
 | 
					            Template footer = Template.of("footer", TranslatableCaption.of("help.help_footer").getComponent(player));
 | 
				
			||||||
 | 
					            player.sendMessage(StaticCaption.of("<header>\n<page_header>\n<help_objects>\n<footer>"), header, page_header, help_objects, footer);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,11 +27,12 @@ package com.plotsquared.core.uuid;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.google.common.collect.Lists;
 | 
					import com.google.common.collect.Lists;
 | 
				
			||||||
import com.plotsquared.core.PlotSquared;
 | 
					import com.plotsquared.core.PlotSquared;
 | 
				
			||||||
import com.plotsquared.core.configuration.Captions;
 | 
					 | 
				
			||||||
import com.plotsquared.core.configuration.Settings;
 | 
					import com.plotsquared.core.configuration.Settings;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
					import com.plotsquared.core.configuration.caption.TranslatableCaption;
 | 
				
			||||||
 | 
					import com.plotsquared.core.player.ConsolePlayer;
 | 
				
			||||||
import com.plotsquared.core.util.ThreadUtils;
 | 
					import com.plotsquared.core.util.ThreadUtils;
 | 
				
			||||||
import com.plotsquared.core.util.task.TaskManager;
 | 
					import com.plotsquared.core.util.task.TaskManager;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
				
			||||||
import org.slf4j.Logger;
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
import org.slf4j.LoggerFactory;
 | 
					import org.slf4j.LoggerFactory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -66,6 +67,7 @@ import java.util.function.Function;
 | 
				
			|||||||
public class UUIDPipeline {
 | 
					public class UUIDPipeline {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final Logger logger = LoggerFactory.getLogger("P2/" + UUIDPipeline.class.getSimpleName());
 | 
					    private static final Logger logger = LoggerFactory.getLogger("P2/" + UUIDPipeline.class.getSimpleName());
 | 
				
			||||||
 | 
					    private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final Executor executor;
 | 
					    private final Executor executor;
 | 
				
			||||||
    private final List<UUIDService> serviceList;
 | 
					    private final List<UUIDService> serviceList;
 | 
				
			||||||
@@ -331,7 +333,8 @@ public class UUIDPipeline {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (Settings.UUID.UNKNOWN_AS_DEFAULT) {
 | 
					            if (Settings.UUID.UNKNOWN_AS_DEFAULT) {
 | 
				
			||||||
                for (final UUID uuid : remainingRequests) {
 | 
					                for (final UUID uuid : remainingRequests) {
 | 
				
			||||||
                    mappings.add(new UUIDMapping(uuid, TranslatableCaption.of("info.unknown")));
 | 
					                    mappings.add(new UUIDMapping(uuid,
 | 
				
			||||||
 | 
					                        MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.unknown").getComponent(ConsolePlayer.getConsole()))));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                return mappings;
 | 
					                return mappings;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -375,6 +375,7 @@
 | 
				
			|||||||
  "info.plot_no_description": "<prefix><gray>No description set.</gray>",
 | 
					  "info.plot_no_description": "<prefix><gray>No description set.</gray>",
 | 
				
			||||||
  "info.plot_caps_header": "<dark_gray><strikethrough>--------- <reset><gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
 | 
					  "info.plot_caps_header": "<dark_gray><strikethrough>--------- <reset><gold>CAPS </gold><dark_gray><strikethrough>---------<reset>",
 | 
				
			||||||
  "info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
 | 
					  "info.plot_caps_format": "<prefix><gray>- Cap Type: </gray><gold><cap> </gold><gray>| Status: </gray><gold><current></gold><gray>/</gray><gold><limit> </gold><gray>(</gray><gold><percentage>%</gold><gray>)</gray>",
 | 
				
			||||||
 | 
					  "info.area_format": "<header>\n<reset><gold>NAME: </gold><grey><name></grey>\n<gold>Type: </gold><grey><type></grey>\n<gold>Terrain: </gold><grey><terrain></grey>\n<gold>Usage: </gold><grey><usage>%</grey>\n<gold>Claimed: </gold><grey><claimed></grey>\n<gold>Clusters: </gold><grey><clusters></grey>\n<gold>Region: </gold><grey><region></grey>\n<gold>Generator: </gold><grey><generator></grey>\n<footer>",
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  "working.generating_component": "<prefix><gold>Started generating component from your settings.</gold>",
 | 
					  "working.generating_component": "<prefix><gold>Started generating component from your settings.</gold>",
 | 
				
			||||||
  "working.clearing_done": "<prefix><dark_aqua>Clear completed! Took <amount>ms.</dark_aqua>",
 | 
					  "working.clearing_done": "<prefix><dark_aqua>Clear completed! Took <amount>ms.</dark_aqua>",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user