mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
parent
a77a51b6f2
commit
eb334b3aac
@ -57,7 +57,8 @@ public class Info extends SubCommand {
|
|||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
arg = args[0];
|
arg = args[0];
|
||||||
switch (arg) {
|
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);
|
.getPlotFromString(player, null, false);
|
||||||
default -> {
|
default -> {
|
||||||
plot = Plot.getPlotFromString(player, arg, false);
|
plot = Plot.getPlotFromString(player, arg, false);
|
||||||
|
@ -2928,14 +2928,21 @@ public class Plot {
|
|||||||
Template flagsTemplate = Template.of("flags", flags);
|
Template flagsTemplate = Template.of("flags", flags);
|
||||||
Template creationTemplate = Template.of("creationdate", newDate);
|
Template creationTemplate = Template.of("creationdate", newDate);
|
||||||
Template buildTemplate = Template.of("build", String.valueOf(build));
|
Template buildTemplate = Template.of("build", String.valueOf(build));
|
||||||
if (iInfo.getComponent(player).contains("<rating>")) {
|
Template sizeTemplate = Template.of("size", String.valueOf(getConnectedPlots().size()));
|
||||||
|
String component = iInfo.getComponent(player);
|
||||||
|
if (component.contains("<rating>") || component.contains("<likes>")) {
|
||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
Template ratingTemplate;
|
Template ratingTemplate;
|
||||||
|
Template likesTemplate;
|
||||||
if (Settings.Ratings.USE_LIKES) {
|
if (Settings.Ratings.USE_LIKES) {
|
||||||
ratingTemplate = Template.of(
|
ratingTemplate = Template.of(
|
||||||
"rating",
|
"rating",
|
||||||
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
|
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
|
||||||
);
|
);
|
||||||
|
likesTemplate = Template.of(
|
||||||
|
"likes",
|
||||||
|
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
int max = 10;
|
int max = 10;
|
||||||
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
|
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
|
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
|
||||||
.parse(
|
.parse(
|
||||||
@ -2984,6 +2992,8 @@ public class Plot {
|
|||||||
buildTemplate,
|
buildTemplate,
|
||||||
ratingTemplate,
|
ratingTemplate,
|
||||||
creationTemplate,
|
creationTemplate,
|
||||||
|
sizeTemplate,
|
||||||
|
likesTemplate,
|
||||||
footerTemplate
|
footerTemplate
|
||||||
))));
|
))));
|
||||||
});
|
});
|
||||||
@ -3008,6 +3018,8 @@ public class Plot {
|
|||||||
seenTemplate,
|
seenTemplate,
|
||||||
flagsTemplate,
|
flagsTemplate,
|
||||||
buildTemplate,
|
buildTemplate,
|
||||||
|
creationTemplate,
|
||||||
|
sizeTemplate,
|
||||||
footerTemplate
|
footerTemplate
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user