mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Use builder for flags component
This commit is contained in:
parent
7f01f2d716
commit
ffc31f565b
@ -76,6 +76,7 @@ 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 net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.TextComponent;
|
||||||
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 org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -2693,11 +2694,12 @@ public class Plot {
|
|||||||
description = TranslatableCaption.of("info.plot_no_description").getComponent(player);
|
description = TranslatableCaption.of("info.plot_no_description").getComponent(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
Component flags = null;
|
Component flags;
|
||||||
Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true);
|
Collection<PlotFlag<?, ?>> flagCollection = this.getApplicableFlags(true);
|
||||||
if (flagCollection.isEmpty()) {
|
if (flagCollection.isEmpty()) {
|
||||||
flags = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(player));
|
flags = MINI_MESSAGE.parse(TranslatableCaption.of("info.none").getComponent(player));
|
||||||
} else {
|
} else {
|
||||||
|
TextComponent.Builder flagBuilder = Component.text();
|
||||||
String prefix = " ";
|
String prefix = " ";
|
||||||
for (final PlotFlag<?, ?> flag : flagCollection) {
|
for (final PlotFlag<?, ?> flag : flagCollection) {
|
||||||
Object value;
|
Object value;
|
||||||
@ -2708,13 +2710,10 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
Component snip = MINI_MESSAGE.parse(prefix + CaptionUtility.format(player, TranslatableCaption.of("info.plot_flag_list").getComponent(player)),
|
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())));
|
Template.of("flag", flag.getName()), Template.of("value", CaptionUtility.formatRaw(player, value.toString())));
|
||||||
if (flags != null) {
|
flagBuilder.append(snip);
|
||||||
flags.append(snip);
|
|
||||||
} else {
|
|
||||||
flags = snip;
|
|
||||||
}
|
|
||||||
prefix = ", ";
|
prefix = ", ";
|
||||||
}
|
}
|
||||||
|
flags = flagBuilder.build();
|
||||||
}
|
}
|
||||||
boolean build = this.isAdded(player.getUUID());
|
boolean build = this.isAdded(player.getUUID());
|
||||||
Component owner;
|
Component owner;
|
||||||
|
Loading…
Reference in New Issue
Block a user