mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 21:56:45 +01:00
refactor: improved List command for server plots
This commit is contained in:
parent
c5d1655868
commit
fed700f0d8
@ -462,6 +462,13 @@ public class ListCmd extends SubCommand {
|
|||||||
String server = TranslatableCaption.of("info.plot_list_player_server").getComponent(player);
|
String server = TranslatableCaption.of("info.plot_list_player_server").getComponent(player);
|
||||||
String everyone = TranslatableCaption.of("info.plot_list_player_everyone").getComponent(player);
|
String everyone = TranslatableCaption.of("info.plot_list_player_everyone").getComponent(player);
|
||||||
TextComponent.Builder builder = Component.text();
|
TextComponent.Builder builder = Component.text();
|
||||||
|
if (plot.getFlag(ServerPlotFlag.class)) {
|
||||||
|
Template serverTemplate = Template.of(
|
||||||
|
"player",
|
||||||
|
TranslatableCaption.of("info.server").getComponent(player)
|
||||||
|
);
|
||||||
|
builder.append(MINI_MESSAGE.parse(server, serverTemplate));
|
||||||
|
} else {
|
||||||
try {
|
try {
|
||||||
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
final List<UUIDMapping> names = PlotSquared.get().getImpromptuUUIDPipeline().getNames(plot.getOwners())
|
||||||
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS);
|
||||||
@ -511,6 +518,7 @@ public class ListCmd extends SubCommand {
|
|||||||
} catch (TimeoutException e) {
|
} catch (TimeoutException e) {
|
||||||
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
player.sendMessage(TranslatableCaption.of("players.fetching_players_timeout"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Template players = Template.of("players", builder.asComponent());
|
Template players = Template.of("players", builder.asComponent());
|
||||||
caption.set(TranslatableCaption.of("info.plot_list_item"));
|
caption.set(TranslatableCaption.of("info.plot_list_item"));
|
||||||
caption.setTemplates(command_tp, command_info, hover_info, numberTemplate, plotTemplate, players);
|
caption.setTemplates(command_tp, command_info, hover_info, numberTemplate, plotTemplate, players);
|
||||||
|
Loading…
Reference in New Issue
Block a user