From eb334b3aacdd20a26b9af4f1f55750231c402426 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 30 Dec 2021 14:41:31 +0000 Subject: [PATCH] Fix: add missing placeholders for plot info Fixes #3339 --- .../java/com/plotsquared/core/command/Info.java | 3 ++- .../main/java/com/plotsquared/core/plot/Plot.java | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/Info.java b/Core/src/main/java/com/plotsquared/core/command/Info.java index 1b7196d14..f8470579f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Info.java +++ b/Core/src/main/java/com/plotsquared/core/command/Info.java @@ -57,7 +57,8 @@ public class Info extends SubCommand { if (args.length > 0) { arg = args[0]; switch (arg) { - case "trusted", "alias", "inv", "biome", "denied", "flags", "id", "size", "members", "creationdate", "seen", "owner", "rating", "likes" -> plot = Plot + // TODO: (re?)implement /plot info inv. (it was never properly implemented) + case "trusted", "alias", "biome", "denied", "flags", "id", "size", "members", "creationdate", "seen", "owner", "rating", "likes" -> plot = Plot .getPlotFromString(player, null, false); default -> { plot = Plot.getPlotFromString(player, arg, false); diff --git a/Core/src/main/java/com/plotsquared/core/plot/Plot.java b/Core/src/main/java/com/plotsquared/core/plot/Plot.java index 1758923a0..5f232a819 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/Plot.java +++ b/Core/src/main/java/com/plotsquared/core/plot/Plot.java @@ -2928,14 +2928,21 @@ public class Plot { Template flagsTemplate = Template.of("flags", flags); Template creationTemplate = Template.of("creationdate", newDate); Template buildTemplate = Template.of("build", String.valueOf(build)); - if (iInfo.getComponent(player).contains("")) { + Template sizeTemplate = Template.of("size", String.valueOf(getConnectedPlots().size())); + String component = iInfo.getComponent(player); + if (component.contains("") || component.contains("")) { TaskManager.runTaskAsync(() -> { Template ratingTemplate; + Template likesTemplate; if (Settings.Ratings.USE_LIKES) { ratingTemplate = Template.of( "rating", String.format("%.0f%%", Like.getLikesPercentage(this) * 100D) ); + likesTemplate = Template.of( + "likes", + String.format("%.0f%%", Like.getLikesPercentage(this) * 100D) + ); } else { int max = 10; if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) { @@ -2962,6 +2969,7 @@ public class Plot { ); } } + likesTemplate = Template.of("likes", "N/A"); } future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE .parse( @@ -2984,6 +2992,8 @@ public class Plot { buildTemplate, ratingTemplate, creationTemplate, + sizeTemplate, + likesTemplate, footerTemplate )))); }); @@ -3008,6 +3018,8 @@ public class Plot { seenTemplate, flagsTemplate, buildTemplate, + creationTemplate, + sizeTemplate, footerTemplate )))); }