mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-27 17:45:27 +02:00
Compare commits
1 Commits
main
...
feat/v7/pa
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d6469e2429 |
@@ -49,10 +49,12 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registry that contains {@link Placeholder placeholders}
|
* Registry that contains {@link Placeholder placeholders}
|
||||||
@@ -127,6 +129,22 @@ public final class PlaceholderRegistry {
|
|||||||
}
|
}
|
||||||
return legacyComponent(TranslatableCaption.of("info.unknown"), player);
|
return legacyComponent(TranslatableCaption.of("info.unknown"), player);
|
||||||
});
|
});
|
||||||
|
this.createPlaceholder("currentplot_owners", (player, plot) -> {
|
||||||
|
if (plot.getFlag(ServerPlotFlag.class)) {
|
||||||
|
return legacyComponent(TranslatableCaption.of("info.server"), player);
|
||||||
|
}
|
||||||
|
final Set<UUID> plotOwners = plot.getOwners();
|
||||||
|
if (plotOwners.isEmpty()) {
|
||||||
|
return legacyComponent(TranslatableCaption.of("generic.generic_unowned"), player);
|
||||||
|
}
|
||||||
|
return plotOwners.stream().map(PlotSquared.platform().playerManager()::getUsernameCaption).map(f -> {
|
||||||
|
try {
|
||||||
|
return f.get(Settings.UUID.BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS).getComponent(player);
|
||||||
|
} catch (final Exception ignored) {
|
||||||
|
return legacyComponent(TranslatableCaption.of("info.unknown"), player);
|
||||||
|
}
|
||||||
|
}).collect(Collectors.joining(", "));
|
||||||
|
});
|
||||||
this.createPlaceholder("currentplot_members", (player, plot) -> {
|
this.createPlaceholder("currentplot_members", (player, plot) -> {
|
||||||
if (plot.getMembers().isEmpty() && plot.getTrusted().isEmpty()) {
|
if (plot.getMembers().isEmpty() && plot.getTrusted().isEmpty()) {
|
||||||
return legacyComponent(TranslatableCaption.of("info.none"), player);
|
return legacyComponent(TranslatableCaption.of("info.none"), player);
|
||||||
|
Reference in New Issue
Block a user