mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-03 18:53:43 +01:00 
			
		
		
		
	Fix plot info, sign usage in Plot.class
This commit is contained in:
		@@ -116,7 +116,7 @@ import java.util.stream.Stream;
 | 
				
			|||||||
    private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitUtil.class.getSimpleName());
 | 
					    private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitUtil.class.getSimpleName());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static final BukkitAudiences BUKKIT_AUDIENCES = BukkitAudiences.create(BukkitPlatform.getPlugin(BukkitPlatform.class));
 | 
					    public static final BukkitAudiences BUKKIT_AUDIENCES = BukkitAudiences.create(BukkitPlatform.getPlugin(BukkitPlatform.class));
 | 
				
			||||||
    public static final LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER = LegacyComponentSerializer.legacy();
 | 
					    public static final LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER = LegacyComponentSerializer.legacyAmpersand();
 | 
				
			||||||
    public static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
 | 
					    public static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final Collection<BlockType> tileEntityTypes = new HashSet<>();
 | 
					    private final Collection<BlockType> tileEntityTypes = new HashSet<>();
 | 
				
			||||||
@@ -322,13 +322,11 @@ import java.util.stream.Stream;
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override @SuppressWarnings("deprecation")
 | 
					    @Override @SuppressWarnings("deprecation")
 | 
				
			||||||
    public void setSign(@Nonull final Location location, @Nonnull final Caption[] lines,
 | 
					    public void setSign(@Nonnull final Location location, @Nonnull final Caption[] lines,
 | 
				
			||||||
        @Nonnull final Template ... replacements) {
 | 
					        @Nonnull final Template ... replacements) {
 | 
				
			||||||
        ensureLoaded(location.getWorld(), location.getX(), location.getZ(), chunk -> {
 | 
					        ensureLoaded(location.getWorldName(), location.getX(), location.getZ(), chunk -> {
 | 
				
			||||||
            final World world = getWorld(location.getWorld());
 | 
					            final World world = getWorld(location.getWorldName());
 | 
				
			||||||
            final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ());
 | 
					            final Block block = world.getBlockAt(location.getX(), location.getY(), location.getZ());
 | 
				
			||||||
            final World world = getWorld(worldName);
 | 
					 | 
				
			||||||
            final Block block = world.getBlockAt(x, y, z);
 | 
					 | 
				
			||||||
            //        block.setType(Material.AIR);
 | 
					            //        block.setType(Material.AIR);
 | 
				
			||||||
            final Material type = block.getType();
 | 
					            final Material type = block.getType();
 | 
				
			||||||
            if (type != Material.LEGACY_SIGN && type != Material.LEGACY_WALL_SIGN) {
 | 
					            if (type != Material.LEGACY_SIGN && type != Material.LEGACY_WALL_SIGN) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,6 +27,7 @@ package com.plotsquared.core.command;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
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;
 | 
				
			||||||
@@ -98,7 +99,7 @@ public class Info extends SubCommand {
 | 
				
			|||||||
            for (final String argument : args) {
 | 
					            for (final String argument : args) {
 | 
				
			||||||
                if (argument.equalsIgnoreCase("-f")) {
 | 
					                if (argument.equalsIgnoreCase("-f")) {
 | 
				
			||||||
                    if (!player
 | 
					                    if (!player
 | 
				
			||||||
                        .hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.getTranslated())) {
 | 
					                        .hasPermission(Captions.PERMISSION_AREA_INFO_FORCE.toString())) {
 | 
				
			||||||
                        player.sendMessage(
 | 
					                        player.sendMessage(
 | 
				
			||||||
                                TranslatableCaption.of("permission.no_permission"),
 | 
					                                TranslatableCaption.of("permission.no_permission"),
 | 
				
			||||||
                                Template.of("node", "plots.area.info.force")
 | 
					                                Template.of("node", "plots.area.info.force")
 | 
				
			||||||
@@ -127,7 +128,7 @@ public class Info extends SubCommand {
 | 
				
			|||||||
            );
 | 
					            );
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        String info = Captions.PLOT_INFO_FORMAT.getTranslated();
 | 
					        Caption info = TranslatableCaption.of("info.plot_info_format");
 | 
				
			||||||
        boolean full;
 | 
					        boolean full;
 | 
				
			||||||
        if (arg != null) {
 | 
					        if (arg != null) {
 | 
				
			||||||
            info = getCaption(arg);
 | 
					            info = getCaption(arg);
 | 
				
			||||||
@@ -145,38 +146,36 @@ public class Info extends SubCommand {
 | 
				
			|||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            full = false;
 | 
					            full = false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        plot.format(info, player, full).thenAcceptAsync(value ->
 | 
					        plot.format(info, player, full).thenAcceptAsync(player::sendMessage);
 | 
				
			||||||
            player.sendMessage(Captions.PLOT_INFO_HEADER.getTranslated() + '\n' + value + '\n'
 | 
					 | 
				
			||||||
            + Captions.PLOT_INFO_FOOTER.getTranslated()));
 | 
					 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private String getCaption(String string) {
 | 
					    private Caption getCaption(String string) {
 | 
				
			||||||
        switch (string) {
 | 
					        switch (string) {
 | 
				
			||||||
            case "trusted":
 | 
					            case "trusted":
 | 
				
			||||||
                return Captions.PLOT_INFO_TRUSTED.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_trusted");
 | 
				
			||||||
            case "alias":
 | 
					            case "alias":
 | 
				
			||||||
                return Captions.PLOT_INFO_ALIAS.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_alias");
 | 
				
			||||||
            case "biome":
 | 
					            case "biome":
 | 
				
			||||||
                return Captions.PLOT_INFO_BIOME.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_biome");
 | 
				
			||||||
            case "denied":
 | 
					            case "denied":
 | 
				
			||||||
                return Captions.PLOT_INFO_DENIED.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_denied");
 | 
				
			||||||
            case "flags":
 | 
					            case "flags":
 | 
				
			||||||
                return Captions.PLOT_INFO_FLAGS.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_flags");
 | 
				
			||||||
            case "id":
 | 
					            case "id":
 | 
				
			||||||
                return Captions.PLOT_INFO_ID.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_id");
 | 
				
			||||||
            case "size":
 | 
					            case "size":
 | 
				
			||||||
                return Captions.PLOT_INFO_SIZE.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_size");
 | 
				
			||||||
            case "members":
 | 
					            case "members":
 | 
				
			||||||
                return Captions.PLOT_INFO_MEMBERS.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_members");
 | 
				
			||||||
            case "owner":
 | 
					            case "owner":
 | 
				
			||||||
                return Captions.PLOT_INFO_OWNER.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_owner");
 | 
				
			||||||
            case "rating":
 | 
					            case "rating":
 | 
				
			||||||
                return Captions.PLOT_INFO_RATING.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_rating");
 | 
				
			||||||
            case "likes":
 | 
					            case "likes":
 | 
				
			||||||
                return Captions.PLOT_INFO_LIKES.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_likes");
 | 
				
			||||||
            case "seen":
 | 
					            case "seen":
 | 
				
			||||||
                return Captions.PLOT_INFO_SEEN.getTranslated();
 | 
					                return TranslatableCaption.of("info.plot_info_seen");
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
                return null;
 | 
					                return null;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,10 +31,11 @@ import com.google.common.collect.Sets;
 | 
				
			|||||||
import com.google.inject.Inject;
 | 
					import com.google.inject.Inject;
 | 
				
			||||||
import com.plotsquared.core.PlotSquared;
 | 
					import com.plotsquared.core.PlotSquared;
 | 
				
			||||||
import com.plotsquared.core.command.Like;
 | 
					import com.plotsquared.core.command.Like;
 | 
				
			||||||
import com.plotsquared.core.configuration.caption.CaptionUtility;
 | 
					 | 
				
			||||||
import com.plotsquared.core.configuration.Captions;
 | 
					import com.plotsquared.core.configuration.Captions;
 | 
				
			||||||
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.Caption;
 | 
				
			||||||
 | 
					import com.plotsquared.core.configuration.caption.CaptionUtility;
 | 
				
			||||||
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;
 | 
				
			||||||
@@ -87,6 +88,8 @@ import com.sk89q.worldedit.math.BlockVector3;
 | 
				
			|||||||
import com.sk89q.worldedit.regions.CuboidRegion;
 | 
					import com.sk89q.worldedit.regions.CuboidRegion;
 | 
				
			||||||
import com.sk89q.worldedit.world.biome.BiomeType;
 | 
					import com.sk89q.worldedit.world.biome.BiomeType;
 | 
				
			||||||
import com.sk89q.worldedit.world.block.BlockTypes;
 | 
					import com.sk89q.worldedit.world.block.BlockTypes;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.Component;
 | 
				
			||||||
 | 
					import net.kyori.adventure.text.minimessage.MiniMessage;
 | 
				
			||||||
import net.kyori.adventure.text.minimessage.Template;
 | 
					import net.kyori.adventure.text.minimessage.Template;
 | 
				
			||||||
import org.slf4j.Logger;
 | 
					import org.slf4j.Logger;
 | 
				
			||||||
import org.slf4j.LoggerFactory;
 | 
					import org.slf4j.LoggerFactory;
 | 
				
			||||||
@@ -140,6 +143,8 @@ 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);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -1189,16 +1194,12 @@ public class Plot {
 | 
				
			|||||||
        if (this.area.allowSigns()) {
 | 
					        if (this.area.allowSigns()) {
 | 
				
			||||||
            Location location = manager.getSignLoc(this);
 | 
					            Location location = manager.getSignLoc(this);
 | 
				
			||||||
            String id = this.id.toString();
 | 
					            String id = this.id.toString();
 | 
				
			||||||
            String[] lines =
 | 
					            Caption[] lines =
 | 
				
			||||||
                new String[] {Captions.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id),
 | 
					                new Caption[] {TranslatableCaption.of("signs.owner_sign_line_1"),
 | 
				
			||||||
                    Captions.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll(
 | 
					                    TranslatableCaption.of("signs.owner_sign_line_2"),
 | 
				
			||||||
                        "%plr%", name),
 | 
					                    TranslatableCaption.of("signs.owner_sign_line_3"),
 | 
				
			||||||
                    Captions.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll(
 | 
					                    TranslatableCaption.of("signs.owner_sign_line_4")};
 | 
				
			||||||
                        "%plr%", name),
 | 
					            this.worldUtil.setSign(location, lines, Template.of("id", id), Template.of("owner", name));
 | 
				
			||||||
                    Captions.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll(
 | 
					 | 
				
			||||||
                        "%plr%", name)};
 | 
					 | 
				
			||||||
            this.worldUtil.setSign(this.getWorldName(), location.getX(), location.getY(), location.getZ(),
 | 
					 | 
				
			||||||
                    lines);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -3005,11 +3006,12 @@ public class Plot {
 | 
				
			|||||||
            if (players.isEmpty()) {
 | 
					            if (players.isEmpty()) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            final String string =
 | 
					            Caption caption = TranslatableCaption.of("debug.plot_debug");
 | 
				
			||||||
                Captions.PLOT_DEBUG.getTranslated().replace("%plot%", this.toString()).replace("%message%", message);
 | 
					            Template plotTemplate = Template.of("plot", this.toString());
 | 
				
			||||||
 | 
					            Template messageTemplate = Template.of("message", message);
 | 
				
			||||||
            for (final PlotPlayer<?> player : players) {
 | 
					            for (final PlotPlayer<?> player : players) {
 | 
				
			||||||
                if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_DEBUG_OTHER)) {
 | 
					                if (isOwner(player.getUUID()) || Permissions.hasPermission(player, Captions.PERMISSION_ADMIN_DEBUG_OTHER)) {
 | 
				
			||||||
                    player.sendMessage(StaticCaption.of(string));
 | 
					                    player.sendMessage(caption, plotTemplate, messageTemplate);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } catch (final Exception ignored) {}
 | 
					        } catch (final Exception ignored) {}
 | 
				
			||||||
@@ -3489,42 +3491,40 @@ public class Plot {
 | 
				
			|||||||
        return FlagContainer.<T, V>castUnsafe(flagInstance).getValue();
 | 
					        return FlagContainer.<T, V>castUnsafe(flagInstance).getValue();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public CompletableFuture<String> format(final String iInfo, PlotPlayer<?> player, final boolean full) {
 | 
					    public CompletableFuture<Caption> format(final Caption iInfo, PlotPlayer<?> player, final boolean full) {
 | 
				
			||||||
        final CompletableFuture<String> future = new CompletableFuture<>();
 | 
					        final CompletableFuture<Caption> future = new CompletableFuture<>();
 | 
				
			||||||
        int num = this.getConnectedPlots().size();
 | 
					        int num = this.getConnectedPlots().size();
 | 
				
			||||||
        String alias = !this.getAlias().isEmpty() ? this.getAlias() : Captions.NONE.getTranslated();
 | 
					        String alias = !this.getAlias().isEmpty() ? this.getAlias() : TranslatableCaption.of("info.none").getComponent(player);
 | 
				
			||||||
        Location bot = this.getCorners()[0];
 | 
					        Location bot = this.getCorners()[0];
 | 
				
			||||||
        PlotSquared.platform().getWorldUtil()
 | 
					        PlotSquared.platform().getWorldUtil().getBiome(this.getWorldName(), bot.getX(), bot.getZ(), biome -> {
 | 
				
			||||||
            .getBiome(this.getWorldName(), bot.getX(), bot.getZ(), biome -> {
 | 
					 | 
				
			||||||
                String info = iInfo;
 | 
					 | 
				
			||||||
            String trusted = PlayerManager.getPlayerList(this.getTrusted());
 | 
					            String trusted = PlayerManager.getPlayerList(this.getTrusted());
 | 
				
			||||||
            String members = PlayerManager.getPlayerList(this.getMembers());
 | 
					            String members = PlayerManager.getPlayerList(this.getMembers());
 | 
				
			||||||
            String denied = PlayerManager.getPlayerList(this.getDenied());
 | 
					            String denied = PlayerManager.getPlayerList(this.getDenied());
 | 
				
			||||||
            String seen;
 | 
					            String seen;
 | 
				
			||||||
            if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) {
 | 
					            if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) {
 | 
				
			||||||
                if (this.isOnline()) {
 | 
					                if (this.isOnline()) {
 | 
				
			||||||
                        seen = Captions.NOW.getTranslated();
 | 
					                    seen = TranslatableCaption.of("info.now").getComponent(player);
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    int time = (int) (ExpireManager.IMP.getAge(this) / 1000);
 | 
					                    int time = (int) (ExpireManager.IMP.getAge(this) / 1000);
 | 
				
			||||||
                    if (time != 0) {
 | 
					                    if (time != 0) {
 | 
				
			||||||
                        seen = TimeUtil.secToTime(time);
 | 
					                        seen = TimeUtil.secToTime(time);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                            seen = Captions.UNKNOWN.getTranslated();
 | 
					                        seen = TranslatableCaption.of("info.known").getComponent(player);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                    seen = Captions.NEVER.getTranslated();
 | 
					                seen = TranslatableCaption.of("info.never").getComponent(player);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            String description = this.getFlag(DescriptionFlag.class);
 | 
					            String description = this.getFlag(DescriptionFlag.class);
 | 
				
			||||||
            if (description.isEmpty()) {
 | 
					            if (description.isEmpty()) {
 | 
				
			||||||
                    description = Captions.PLOT_NO_DESCRIPTION.getTranslated();
 | 
					                description = TranslatableCaption.of("info.plot_no_description").getComponent(player);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                StringBuilder flags = new StringBuilder();
 | 
					            Component flags = null;
 | 
				
			||||||
            Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true);
 | 
					            Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true);
 | 
				
			||||||
            if (flagCollection.isEmpty()) {
 | 
					            if (flagCollection.isEmpty()) {
 | 
				
			||||||
                    flags.append(Captions.NONE.getTranslated());
 | 
					                flags = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(player));
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                String prefix = " ";
 | 
					                String prefix = " ";
 | 
				
			||||||
                for (final PlotFlag<?, ?> flag : flagCollection) {
 | 
					                for (final PlotFlag<?, ?> flag : flagCollection) {
 | 
				
			||||||
@@ -3534,71 +3534,76 @@ public class Plot {
 | 
				
			|||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        value = flag.toString();
 | 
					                        value = flag.toString();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                        flags.append(prefix).append(CaptionUtility
 | 
					                    Component snip = MINI_MESSAGE
 | 
				
			||||||
                            .format(player, Captions.PLOT_FLAG_LIST.getTranslated(), flag.getName(),
 | 
					                        .parse(prefix + CaptionUtility.format(player, TranslatableCaption.of("info.plot_flag_list").getComponent(player)),
 | 
				
			||||||
                                CaptionUtility.formatRaw(player, value.toString(), "")));
 | 
					                            Template.of("flag", flag.getName()), Template.of("value", CaptionUtility.formatRaw(player, value.toString())));
 | 
				
			||||||
 | 
					                    if (flags != null) {
 | 
				
			||||||
 | 
					                        flags.append(snip);
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        flags = snip;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                    prefix = ", ";
 | 
					                    prefix = ", ";
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            boolean build = this.isAdded(player.getUUID());
 | 
					            boolean build = this.isAdded(player.getUUID());
 | 
				
			||||||
            String owner = this.getOwners().isEmpty() ? "unowned" : PlayerManager.getPlayerList(this.getOwners());
 | 
					            String owner = this.getOwners().isEmpty() ? "unowned" : PlayerManager.getPlayerList(this.getOwners());
 | 
				
			||||||
 | 
					            Template headerTemplate = Template.of("header", TranslatableCaption.of("info.plot_info_header").getComponent(player));
 | 
				
			||||||
 | 
					            Template footerTemplate = Template.of("footer", TranslatableCaption.of("info.plot_info_footer").getComponent(player));
 | 
				
			||||||
 | 
					            Template areaTemplate;
 | 
				
			||||||
            if (this.getArea() != null) {
 | 
					            if (this.getArea() != null) {
 | 
				
			||||||
                    info = info.replace("%area%",
 | 
					                areaTemplate =
 | 
				
			||||||
                        this.getArea().getWorldName() + (this.getArea().getId() == null ?
 | 
					                    Template.of("area", this.getArea().getWorldName() + (this.getArea().getId() == null ? "" : "(" + this.getArea().getId() + ")"));
 | 
				
			||||||
                            "" :
 | 
					 | 
				
			||||||
                            "(" + this.getArea().getId() + ")"));
 | 
					 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                    info = info.replace("%area%", Captions.NONE.getTranslated());
 | 
					                areaTemplate = Template.of("area", TranslatableCaption.of("info.none").getComponent(player));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                info = info.replace("%id%", this.getId().toString());
 | 
					            Template idTemplate = Template.of("id", this.getId().toString());
 | 
				
			||||||
                info = info.replace("%alias%", alias);
 | 
					            Template aliasTemplate = Template.of("alias", alias);
 | 
				
			||||||
                info = info.replace("%num%", String.valueOf(num));
 | 
					            Template numTemplate = Template.of("num", String.valueOf(num));
 | 
				
			||||||
                info = info.replace("%desc%", description);
 | 
					            Template descTemplate = Template.of("desc", description);
 | 
				
			||||||
                info = info.replace("%biome%", biome.toString().toLowerCase());
 | 
					            Template biomeTemplate = Template.of("biome", biome.toString().toLowerCase());
 | 
				
			||||||
                info = info.replace("%owner%", owner);
 | 
					            Template ownerTemplate = Template.of("owner", owner);
 | 
				
			||||||
                info = info.replace("%members%", members);
 | 
					            Template membersTemplate = Template.of("members", members);
 | 
				
			||||||
                info = info.replace("%player%", player.getName());
 | 
					            Template playerTemplate = Template.of("player", player.getName());
 | 
				
			||||||
                info = info.replace("%trusted%", trusted);
 | 
					            Template trustedTemplate = Template.of("trusted", trusted);
 | 
				
			||||||
                info = info.replace("%helpers%", members);
 | 
					            Template helpersTemplate = Template.of("helpers", members);
 | 
				
			||||||
                info = info.replace("%denied%", denied);
 | 
					            Template deniedTemplate = Template.of("denied", denied);
 | 
				
			||||||
                info = info.replace("%seen%", seen);
 | 
					            Template seenTemplate = Template.of("seen", seen);
 | 
				
			||||||
                info = info.replace("%flags%", flags);
 | 
					            Template flagsTemplate = Template.of("flags", flags);
 | 
				
			||||||
                info = info.replace("%build%", String.valueOf(build));
 | 
					            Template buildTemplate = Template.of("build", String.valueOf(build));
 | 
				
			||||||
                if (info.contains("%rating%")) {
 | 
					            if (iInfo.getComponent(player).contains("<rating>")) {
 | 
				
			||||||
                    final String newInfo = info;
 | 
					 | 
				
			||||||
                TaskManager.runTaskAsync(() -> {
 | 
					                TaskManager.runTaskAsync(() -> {
 | 
				
			||||||
                        String info1;
 | 
					                    Template ratingTemplate;
 | 
				
			||||||
                    if (Settings.Ratings.USE_LIKES) {
 | 
					                    if (Settings.Ratings.USE_LIKES) {
 | 
				
			||||||
                            info1 = newInfo.replaceAll("%rating%",
 | 
					                        ratingTemplate = Template.of("rating", String.format("%.0f%%", Like.getLikesPercentage(this) * 100D));
 | 
				
			||||||
                                String.format("%.0f%%", Like.getLikesPercentage(this) * 100D));
 | 
					 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        int max = 10;
 | 
					                        int max = 10;
 | 
				
			||||||
                            if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES
 | 
					                        if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
 | 
				
			||||||
                                .isEmpty()) {
 | 
					 | 
				
			||||||
                            max = 8;
 | 
					                            max = 8;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                            if (full && Settings.Ratings.CATEGORIES != null
 | 
					                        if (full && Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) {
 | 
				
			||||||
                                && Settings.Ratings.CATEGORIES.size() > 1) {
 | 
					 | 
				
			||||||
                            double[] ratings = this.getAverageRatings();
 | 
					                            double[] ratings = this.getAverageRatings();
 | 
				
			||||||
                            String rating = "";
 | 
					                            String rating = "";
 | 
				
			||||||
                            String prefix = "";
 | 
					                            String prefix = "";
 | 
				
			||||||
                            for (int i = 0; i < ratings.length; i++) {
 | 
					                            for (int i = 0; i < ratings.length; i++) {
 | 
				
			||||||
                                    rating +=
 | 
					                                rating += prefix + Settings.Ratings.CATEGORIES.get(i) + '=' + String.format("%.1f", ratings[i]);
 | 
				
			||||||
                                        prefix + Settings.Ratings.CATEGORIES.get(i) + '=' + String
 | 
					 | 
				
			||||||
                                            .format("%.1f", ratings[i]);
 | 
					 | 
				
			||||||
                                prefix = ",";
 | 
					                                prefix = ",";
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                                info1 = newInfo.replaceAll("%rating%", rating);
 | 
					                            ratingTemplate = Template.of("rating", rating);
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
                                info1 = newInfo.replaceAll("%rating%",
 | 
					                            ratingTemplate = Template.of("rating", String.format("%.1f", this.getAverageRating()) + '/' + max);
 | 
				
			||||||
                                    String.format("%.1f", this.getAverageRating()) + '/' + max);
 | 
					 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                        future.complete(info1);
 | 
					                    future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
 | 
				
			||||||
 | 
					                        .parse(iInfo.getComponent(player), headerTemplate, areaTemplate, idTemplate, aliasTemplate, numTemplate, descTemplate,
 | 
				
			||||||
 | 
					                            biomeTemplate, ownerTemplate, membersTemplate, playerTemplate, trustedTemplate, helpersTemplate, deniedTemplate,
 | 
				
			||||||
 | 
					                            seenTemplate, flagsTemplate, buildTemplate, ratingTemplate, footerTemplate))));
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                future.complete(info);
 | 
					            future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
 | 
				
			||||||
 | 
					                .parse(iInfo.getComponent(player), headerTemplate, areaTemplate, idTemplate, aliasTemplate, numTemplate, descTemplate, biomeTemplate,
 | 
				
			||||||
 | 
					                    ownerTemplate, membersTemplate, playerTemplate, trustedTemplate, helpersTemplate, deniedTemplate, seenTemplate, flagsTemplate,
 | 
				
			||||||
 | 
					                    buildTemplate, footerTemplate))));
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return future;
 | 
					        return future;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -348,6 +348,7 @@
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  "info.none": "<gray>None</gray>",
 | 
					  "info.none": "<gray>None</gray>",
 | 
				
			||||||
  "info.now": "<gray>Now</gray>",
 | 
					  "info.now": "<gray>Now</gray>",
 | 
				
			||||||
 | 
					  "info.never": "<gray>Never</gray>",
 | 
				
			||||||
  "info.unknown": "<gray>Unknown</gray>",
 | 
					  "info.unknown": "<gray>Unknown</gray>",
 | 
				
			||||||
  "info.server": "<gray>Server</gray>",
 | 
					  "info.server": "<gray>Server</gray>",
 | 
				
			||||||
  "info.everyone": "<gray>Everyone</gray>",
 | 
					  "info.everyone": "<gray>Everyone</gray>",
 | 
				
			||||||
@@ -355,7 +356,7 @@
 | 
				
			|||||||
  "info.plot_info_unclaimed": "<prefix><gray>Plot <gold><plot></gold> is not yet claimed.</gray>",
 | 
					  "info.plot_info_unclaimed": "<prefix><gray>Plot <gold><plot></gold> is not yet claimed.</gray>",
 | 
				
			||||||
  "info.plot_info_header": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------</dark_gray>",
 | 
					  "info.plot_info_header": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------</dark_gray>",
 | 
				
			||||||
  "info.plot_info_hidden": "<prefix><red>You cannot view the information about this plot.</red>",
 | 
					  "info.plot_info_hidden": "<prefix><red>You cannot view the information about this plot.</red>",
 | 
				
			||||||
  "info.plot_info_format": "<gold>ID: <gray><id></gray>\nArea: <gray><area></gray>\nAlias:<gray><alias></gray>\nOwner:<gray><owner></gray>\nBiome: <gray><biome></gray>\nCan Build: <gray><build></gray>\nRating: <gray><rating></gray>\nSeen: <gray><seen></gray>\nTrusted:<gray><trusted></gray>\nMembers:<gray><members></gray>\nDenied:<gray><denied></gray>\nFlags:<gray><flags></gray>\nDescription: <gray><desc></gray></gold>",
 | 
					  "info.plot_info_format": "<header>\n<gold>ID: <gray><id></gray>\nArea: <gray><area></gray>\nAlias:<gray><alias></gray>\nOwner:<gray><owner></gray>\nBiome: <gray><biome></gray>\nCan Build: <gray><build></gray>\nRating: <gray><rating></gray>\nSeen: <gray><seen></gray>\nTrusted:<gray><trusted></gray>\nMembers:<gray><members></gray>\nDenied:<gray><denied></gray>\nFlags:<gray><flags></gray>\nDescription: <gray><desc></gray></gold>\n<footer>",
 | 
				
			||||||
  "info.plot_info_footer": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------<reset>",
 | 
					  "info.plot_info_footer": "<dark_gray><strikethrough>--------- <reset><gold>INFO </gold><dark_gray><strikethrough>---------<reset>",
 | 
				
			||||||
  "info.plot_info_trusted": "<gold>Trusted:</gold><gray><trusted></gray>",
 | 
					  "info.plot_info_trusted": "<gold>Trusted:</gold><gray><trusted></gray>",
 | 
				
			||||||
  "info.plot_info_members": "<gold>Members:</gold><gray><members></gray>",
 | 
					  "info.plot_info_members": "<gold>Members:</gold><gray><members></gray>",
 | 
				
			||||||
@@ -415,8 +416,8 @@
 | 
				
			|||||||
  "owner.now_owner": "<prefix><dark_aqua>You are now the plot owner of plot <plot>.</dark_aqua>",
 | 
					  "owner.now_owner": "<prefix><dark_aqua>You are now the plot owner of plot <plot>.</dark_aqua>",
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  "signs.owner_sign_line_1": "<gold>ID: </gold><gray><id></gray>",
 | 
					  "signs.owner_sign_line_1": "<gold>ID: </gold><gray><id></gray>",
 | 
				
			||||||
  "signs.owner_sign_line_2": "<gold>Owner: </gold><gray><owner></gray>",
 | 
					  "signs.owner_sign_line_2": "<gold>Owner:",
 | 
				
			||||||
  "signs.owner_sign_line_3": "<gray><plr></gray>",
 | 
					  "signs.owner_sign_line_3": "<gray><owner></gray>",
 | 
				
			||||||
  "signs.owner_sign_line_4": "<dark_gray>Claimed</dark_gray>",
 | 
					  "signs.owner_sign_line_4": "<dark_gray>Claimed</dark_gray>",
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  "help.help_header": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Help </gold><dark_gray><strikethrough>---------<reset>",
 | 
					  "help.help_header": "<dark_gray><strikethrough>---------<reset> <gold>PlotSquared Help </gold><dark_gray><strikethrough>---------<reset>",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user