mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Fix plot info, sign usage in Plot.class
This commit is contained in:
parent
3fd3baaa47
commit
d3fe1d3b2b
@ -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,117 +3491,120 @@ 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 trusted = PlayerManager.getPlayerList(this.getTrusted());
|
||||||
String info = iInfo;
|
String members = PlayerManager.getPlayerList(this.getMembers());
|
||||||
String trusted = PlayerManager.getPlayerList(this.getTrusted());
|
String denied = PlayerManager.getPlayerList(this.getDenied());
|
||||||
String members = PlayerManager.getPlayerList(this.getMembers());
|
String seen;
|
||||||
String denied = PlayerManager.getPlayerList(this.getDenied());
|
if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) {
|
||||||
String seen;
|
if (this.isOnline()) {
|
||||||
if (Settings.Enabled_Components.PLOT_EXPIRY && ExpireManager.IMP != null) {
|
seen = TranslatableCaption.of("info.now").getComponent(player);
|
||||||
if (this.isOnline()) {
|
} else {
|
||||||
seen = Captions.NOW.getTranslated();
|
int time = (int) (ExpireManager.IMP.getAge(this) / 1000);
|
||||||
|
if (time != 0) {
|
||||||
|
seen = TimeUtil.secToTime(time);
|
||||||
} else {
|
} else {
|
||||||
int time = (int) (ExpireManager.IMP.getAge(this) / 1000);
|
seen = TranslatableCaption.of("info.known").getComponent(player);
|
||||||
if (time != 0) {
|
|
||||||
seen = TimeUtil.secToTime(time);
|
|
||||||
} else {
|
|
||||||
seen = Captions.UNKNOWN.getTranslated();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
seen = Captions.NEVER.getTranslated();
|
|
||||||
}
|
|
||||||
|
|
||||||
String description = this.getFlag(DescriptionFlag.class);
|
|
||||||
if (description.isEmpty()) {
|
|
||||||
description = Captions.PLOT_NO_DESCRIPTION.getTranslated();
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder flags = new StringBuilder();
|
|
||||||
Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true);
|
|
||||||
if (flagCollection.isEmpty()) {
|
|
||||||
flags.append(Captions.NONE.getTranslated());
|
|
||||||
} else {
|
|
||||||
String prefix = " ";
|
|
||||||
for (final PlotFlag<?, ?> flag : flagCollection) {
|
|
||||||
Object value;
|
|
||||||
if (flag instanceof DoubleFlag && !Settings.General.SCIENTIFIC) {
|
|
||||||
value = FLAG_DECIMAL_FORMAT.format(flag.getValue());
|
|
||||||
} else {
|
|
||||||
value = flag.toString();
|
|
||||||
}
|
|
||||||
flags.append(prefix).append(CaptionUtility
|
|
||||||
.format(player, Captions.PLOT_FLAG_LIST.getTranslated(), flag.getName(),
|
|
||||||
CaptionUtility.formatRaw(player, value.toString(), "")));
|
|
||||||
prefix = ", ";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean build = this.isAdded(player.getUUID());
|
} else {
|
||||||
String owner = this.getOwners().isEmpty() ? "unowned" : PlayerManager.getPlayerList(this.getOwners());
|
seen = TranslatableCaption.of("info.never").getComponent(player);
|
||||||
if (this.getArea() != null) {
|
}
|
||||||
info = info.replace("%area%",
|
|
||||||
this.getArea().getWorldName() + (this.getArea().getId() == null ?
|
String description = this.getFlag(DescriptionFlag.class);
|
||||||
"" :
|
if (description.isEmpty()) {
|
||||||
"(" + this.getArea().getId() + ")"));
|
description = TranslatableCaption.of("info.plot_no_description").getComponent(player);
|
||||||
} else {
|
}
|
||||||
info = info.replace("%area%", Captions.NONE.getTranslated());
|
|
||||||
|
Component flags = null;
|
||||||
|
Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true);
|
||||||
|
if (flagCollection.isEmpty()) {
|
||||||
|
flags = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(player));
|
||||||
|
} else {
|
||||||
|
String prefix = " ";
|
||||||
|
for (final PlotFlag<?, ?> flag : flagCollection) {
|
||||||
|
Object value;
|
||||||
|
if (flag instanceof DoubleFlag && !Settings.General.SCIENTIFIC) {
|
||||||
|
value = FLAG_DECIMAL_FORMAT.format(flag.getValue());
|
||||||
|
} else {
|
||||||
|
value = flag.toString();
|
||||||
|
}
|
||||||
|
Component snip = MINI_MESSAGE
|
||||||
|
.parse(prefix + CaptionUtility.format(player, TranslatableCaption.of("info.plot_flag_list").getComponent(player)),
|
||||||
|
Template.of("flag", flag.getName()), Template.of("value", CaptionUtility.formatRaw(player, value.toString())));
|
||||||
|
if (flags != null) {
|
||||||
|
flags.append(snip);
|
||||||
|
} else {
|
||||||
|
flags = snip;
|
||||||
|
}
|
||||||
|
prefix = ", ";
|
||||||
}
|
}
|
||||||
info = info.replace("%id%", this.getId().toString());
|
}
|
||||||
info = info.replace("%alias%", alias);
|
boolean build = this.isAdded(player.getUUID());
|
||||||
info = info.replace("%num%", String.valueOf(num));
|
String owner = this.getOwners().isEmpty() ? "unowned" : PlayerManager.getPlayerList(this.getOwners());
|
||||||
info = info.replace("%desc%", description);
|
Template headerTemplate = Template.of("header", TranslatableCaption.of("info.plot_info_header").getComponent(player));
|
||||||
info = info.replace("%biome%", biome.toString().toLowerCase());
|
Template footerTemplate = Template.of("footer", TranslatableCaption.of("info.plot_info_footer").getComponent(player));
|
||||||
info = info.replace("%owner%", owner);
|
Template areaTemplate;
|
||||||
info = info.replace("%members%", members);
|
if (this.getArea() != null) {
|
||||||
info = info.replace("%player%", player.getName());
|
areaTemplate =
|
||||||
info = info.replace("%trusted%", trusted);
|
Template.of("area", this.getArea().getWorldName() + (this.getArea().getId() == null ? "" : "(" + this.getArea().getId() + ")"));
|
||||||
info = info.replace("%helpers%", members);
|
} else {
|
||||||
info = info.replace("%denied%", denied);
|
areaTemplate = Template.of("area", TranslatableCaption.of("info.none").getComponent(player));
|
||||||
info = info.replace("%seen%", seen);
|
}
|
||||||
info = info.replace("%flags%", flags);
|
Template idTemplate = Template.of("id", this.getId().toString());
|
||||||
info = info.replace("%build%", String.valueOf(build));
|
Template aliasTemplate = Template.of("alias", alias);
|
||||||
if (info.contains("%rating%")) {
|
Template numTemplate = Template.of("num", String.valueOf(num));
|
||||||
final String newInfo = info;
|
Template descTemplate = Template.of("desc", description);
|
||||||
TaskManager.runTaskAsync(() -> {
|
Template biomeTemplate = Template.of("biome", biome.toString().toLowerCase());
|
||||||
String info1;
|
Template ownerTemplate = Template.of("owner", owner);
|
||||||
if (Settings.Ratings.USE_LIKES) {
|
Template membersTemplate = Template.of("members", members);
|
||||||
info1 = newInfo.replaceAll("%rating%",
|
Template playerTemplate = Template.of("player", player.getName());
|
||||||
String.format("%.0f%%", Like.getLikesPercentage(this) * 100D));
|
Template trustedTemplate = Template.of("trusted", trusted);
|
||||||
} else {
|
Template helpersTemplate = Template.of("helpers", members);
|
||||||
int max = 10;
|
Template deniedTemplate = Template.of("denied", denied);
|
||||||
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES
|
Template seenTemplate = Template.of("seen", seen);
|
||||||
.isEmpty()) {
|
Template flagsTemplate = Template.of("flags", flags);
|
||||||
max = 8;
|
Template buildTemplate = Template.of("build", String.valueOf(build));
|
||||||
}
|
if (iInfo.getComponent(player).contains("<rating>")) {
|
||||||
if (full && Settings.Ratings.CATEGORIES != null
|
TaskManager.runTaskAsync(() -> {
|
||||||
&& Settings.Ratings.CATEGORIES.size() > 1) {
|
Template ratingTemplate;
|
||||||
double[] ratings = this.getAverageRatings();
|
if (Settings.Ratings.USE_LIKES) {
|
||||||
String rating = "";
|
ratingTemplate = Template.of("rating", String.format("%.0f%%", Like.getLikesPercentage(this) * 100D));
|
||||||
String prefix = "";
|
} else {
|
||||||
for (int i = 0; i < ratings.length; i++) {
|
int max = 10;
|
||||||
rating +=
|
if (Settings.Ratings.CATEGORIES != null && !Settings.Ratings.CATEGORIES.isEmpty()) {
|
||||||
prefix + Settings.Ratings.CATEGORIES.get(i) + '=' + String
|
max = 8;
|
||||||
.format("%.1f", ratings[i]);
|
|
||||||
prefix = ",";
|
|
||||||
}
|
|
||||||
info1 = newInfo.replaceAll("%rating%", rating);
|
|
||||||
} else {
|
|
||||||
info1 = newInfo.replaceAll("%rating%",
|
|
||||||
String.format("%.1f", this.getAverageRating()) + '/' + max);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
future.complete(info1);
|
if (full && Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) {
|
||||||
});
|
double[] ratings = this.getAverageRatings();
|
||||||
return;
|
String rating = "";
|
||||||
}
|
String prefix = "";
|
||||||
future.complete(info);
|
for (int i = 0; i < ratings.length; i++) {
|
||||||
});
|
rating += prefix + Settings.Ratings.CATEGORIES.get(i) + '=' + String.format("%.1f", ratings[i]);
|
||||||
|
prefix = ",";
|
||||||
|
}
|
||||||
|
ratingTemplate = Template.of("rating", rating);
|
||||||
|
} else {
|
||||||
|
ratingTemplate = Template.of("rating", String.format("%.1f", this.getAverageRating()) + '/' + max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
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>",
|
||||||
|
Loading…
Reference in New Issue
Block a user