mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 08:36:45 +01:00
Progress
This commit is contained in:
parent
792fa1f11d
commit
29f2863cf4
@ -31,6 +31,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
implementation("me.clip:placeholderapi:2.10.4")
|
implementation("me.clip:placeholderapi:2.10.4")
|
||||||
compile("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT"){ transitive = false }
|
compile("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT"){ transitive = false }
|
||||||
|
compile 'com.github.pavog:SquirrelID:0.6.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
@ -87,10 +88,12 @@ shadowJar {
|
|||||||
include(dependency("io.papermc:paperlib:1.0.2"))
|
include(dependency("io.papermc:paperlib:1.0.2"))
|
||||||
include(dependency("net.kyori:text-adapter-bukkit:3.0.3"))
|
include(dependency("net.kyori:text-adapter-bukkit:3.0.3"))
|
||||||
include(dependency("org.bstats:bstats-bukkit:1.7"))
|
include(dependency("org.bstats:bstats-bukkit:1.7"))
|
||||||
|
include(dependency("com.github.pavog:SquirrelID:0.6.1"))
|
||||||
}
|
}
|
||||||
relocate('net.kyori.text', 'com.plotsquared.formatting.text')
|
relocate('net.kyori.text', 'com.plotsquared.formatting.text')
|
||||||
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
||||||
relocate("org.bstats", "com.plotsquared.metrics")
|
relocate("org.bstats", "com.plotsquared.metrics")
|
||||||
|
relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid')
|
||||||
archiveFileName = "${project.name}-${parent.version}.jar"
|
archiveFileName = "${project.name}-${parent.version}.jar"
|
||||||
destinationDirectory = file "../target"
|
destinationDirectory = file "../target"
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,12 @@
|
|||||||
<artifactId>Core</artifactId>
|
<artifactId>Core</artifactId>
|
||||||
<version>0.6.0-SNAPSHOT</version>
|
<version>0.6.0-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>*</artifactId>
|
||||||
|
<groupId>*</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q.worldedit</groupId>
|
<groupId>com.sk89q.worldedit</groupId>
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* _____ _ _ _____ _
|
||||||
|
* | __ \| | | | / ____| | |
|
||||||
|
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||||
|
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||||
|
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||||
|
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||||
|
* | |
|
||||||
|
* |_|
|
||||||
|
* PlotSquared plot management system for Minecraft
|
||||||
|
* Copyright (C) 2020 IntellectualSites
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
|
import com.plotsquared.core.uuid.UUIDService;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID service that use {@link org.bukkit.OfflinePlayer offline players}
|
||||||
|
*/
|
||||||
|
public class OfflinePlayerUUIDService implements UUIDService {
|
||||||
|
|
||||||
|
@Override @NotNull public Optional<String> get(@NotNull final UUID uuid) {
|
||||||
|
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);
|
||||||
|
if (offlinePlayer.hasPlayedBefore()) {
|
||||||
|
return Optional.ofNullable(offlinePlayer.getName());
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @NotNull public Optional<UUID> get(@NotNull final String username) {
|
||||||
|
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(username);
|
||||||
|
if (offlinePlayer.hasPlayedBefore()) {
|
||||||
|
return Optional.of(offlinePlayer.getUniqueId());
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* _____ _ _ _____ _
|
||||||
|
* | __ \| | | | / ____| | |
|
||||||
|
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||||
|
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||||
|
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||||
|
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||||
|
* | |
|
||||||
|
* |_|
|
||||||
|
* PlotSquared plot management system for Minecraft
|
||||||
|
* Copyright (C) 2020 IntellectualSites
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.profile.PlayerProfile;
|
||||||
|
import com.plotsquared.core.uuid.UUIDMapping;
|
||||||
|
import com.plotsquared.core.uuid.UUIDService;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID service that uses the Paper profile API
|
||||||
|
*/
|
||||||
|
public class PaperUUIDService implements UUIDService {
|
||||||
|
|
||||||
|
@Override @NotNull public List<UUIDMapping> getNames(@NotNull final List<UUID> uuids) {
|
||||||
|
final List<UUIDMapping> mappings = new ArrayList<>(uuids.size());
|
||||||
|
for (final UUID uuid : uuids) {
|
||||||
|
final PlayerProfile playerProfile = Bukkit.createProfile(uuid);
|
||||||
|
if ((playerProfile.isComplete() || playerProfile.completeFromCache()) && playerProfile.getId() != null) {
|
||||||
|
mappings.add(new UUIDMapping(playerProfile.getId(), playerProfile.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mappings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @NotNull public List<UUIDMapping> getUUIDs(@NotNull final List<String> usernames) {
|
||||||
|
final List<UUIDMapping> mappings = new ArrayList<>(usernames.size());
|
||||||
|
for (final String username : usernames) {
|
||||||
|
final PlayerProfile playerProfile = Bukkit.createProfile(username);
|
||||||
|
if ((playerProfile.isComplete() || playerProfile.completeFromCache()) && playerProfile.getId() != null) {
|
||||||
|
mappings.add(new UUIDMapping(playerProfile.getId(), playerProfile.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mappings;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* _____ _ _ _____ _
|
||||||
|
* | __ \| | | | / ____| | |
|
||||||
|
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||||
|
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||||
|
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||||
|
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||||
|
* | |
|
||||||
|
* |_|
|
||||||
|
* PlotSquared plot management system for Minecraft
|
||||||
|
* Copyright (C) 2020 IntellectualSites
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.uuid;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.RateLimiter;
|
||||||
|
import com.plotsquared.core.uuid.UUIDMapping;
|
||||||
|
import com.plotsquared.core.uuid.UUIDService;
|
||||||
|
import com.sk89q.squirrelid.Profile;
|
||||||
|
import com.sk89q.squirrelid.resolver.HttpRepositoryService;
|
||||||
|
import com.sk89q.squirrelid.resolver.ProfileService;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UUID service using SquirrelID
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
|
public class SquirrelIdUUIDService implements UUIDService {
|
||||||
|
|
||||||
|
private final ProfileService profileService;
|
||||||
|
private final RateLimiter rateLimiter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new SquirrelID UUID service
|
||||||
|
*
|
||||||
|
* @param rateLimit Mojangs rate limit is 600 requests per 10 minutes.
|
||||||
|
* This parameter specifies how many of those requests
|
||||||
|
* we can use before our internal rate limit kicks in.
|
||||||
|
*/
|
||||||
|
public SquirrelIdUUIDService(final int rateLimit) {
|
||||||
|
this.profileService = HttpRepositoryService.forMinecraft();
|
||||||
|
// RateLimiter uses request per seconds. The constructor
|
||||||
|
// parameter rateLimit is requests per 600 seconds
|
||||||
|
this.rateLimiter = RateLimiter.create(rateLimit / 600.0D);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @NotNull public List<UUIDMapping> getNames(@NotNull final List<UUID> uuids) {
|
||||||
|
final List<UUIDMapping> results = new ArrayList<>(uuids.size());
|
||||||
|
this.rateLimiter.acquire(uuids.size());
|
||||||
|
try {
|
||||||
|
for (final Profile profile : this.profileService.findAllById(uuids)) {
|
||||||
|
results.add(new UUIDMapping(profile.getUniqueId(), profile.getName()));
|
||||||
|
}
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override @NotNull public List<UUIDMapping> getUUIDs(@NotNull final List<String> usernames) {
|
||||||
|
final List<UUIDMapping> results = new ArrayList<>(usernames.size());
|
||||||
|
this.rateLimiter.acquire(usernames.size());
|
||||||
|
try {
|
||||||
|
for (final Profile profile : this.profileService.findAllByName(usernames)) {
|
||||||
|
results.add(new UUIDMapping(profile.getUniqueId(), profile.getName()));
|
||||||
|
}
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -32,7 +32,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
@ -92,35 +91,58 @@ public class UUIDPipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronously attempt to fetch the mapping from a given UUID or username
|
* Asynchronously attempt to fetch the mapping from a list of UUIDs
|
||||||
*
|
*
|
||||||
* @param requests UUIDs or usernames
|
* @param requests UUIDs
|
||||||
* @return Future that may complete with the mapping
|
* @return Mappings
|
||||||
*/
|
*/
|
||||||
public CompletableFuture<Collection<UUIDMapping>> get(@NotNull final Collection<Object> requests) {
|
public CompletableFuture<Collection<UUIDMapping>> getNames(@NotNull final Collection<UUID> requests) {
|
||||||
final List<UUIDService> serviceList = this.getServiceListInstance();
|
final List<UUIDService> serviceList = this.getServiceListInstance();
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
final List<UUIDMapping> mappings = new ArrayList<>(requests.size());
|
final List<UUIDMapping> mappings = new ArrayList<>(requests.size());
|
||||||
outer: for (final Object request : requests) {
|
final List<UUID> remainingRequests = new ArrayList<>(requests);
|
||||||
if (!(request instanceof String) && !(request instanceof UUID)) {
|
|
||||||
throw new IllegalArgumentException("Request has to be either a username or UUID");
|
for (final UUIDService service : serviceList) {
|
||||||
|
final List<UUIDMapping> completedRequests = service.getNames(remainingRequests);
|
||||||
|
for (final UUIDMapping mapping : completedRequests) {
|
||||||
|
remainingRequests.remove(mapping.getUuid());
|
||||||
}
|
}
|
||||||
for (final UUIDService service : serviceList) {
|
mappings.addAll(completedRequests);
|
||||||
final Optional<?> result = service.get(request);
|
|
||||||
if (result.isPresent()) {
|
|
||||||
final String username = request instanceof String ? (String) request
|
|
||||||
: (String) result.get();
|
|
||||||
final UUID uuid = request instanceof UUID ? (UUID) request
|
|
||||||
: (UUID) result.get();
|
|
||||||
final UUIDMapping mapping = new UUIDMapping(uuid, username);
|
|
||||||
this.consume(mapping);
|
|
||||||
mappings.add(mapping);
|
|
||||||
continue outer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new ServiceError("End of pipeline");
|
|
||||||
}
|
}
|
||||||
return mappings;
|
|
||||||
|
if (mappings.size() == requests.size()) {
|
||||||
|
return mappings;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ServiceError("End of pipeline");
|
||||||
|
}, this.executor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously attempt to fetch the mapping from a list of names
|
||||||
|
*
|
||||||
|
* @param requests Names
|
||||||
|
* @return Mappings
|
||||||
|
*/
|
||||||
|
public CompletableFuture<Collection<UUIDMapping>> getUUIDs(@NotNull final Collection<String> requests) {
|
||||||
|
final List<UUIDService> serviceList = this.getServiceListInstance();
|
||||||
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
final List<UUIDMapping> mappings = new ArrayList<>(requests.size());
|
||||||
|
final List<String> remainingRequests = new ArrayList<>(requests);
|
||||||
|
|
||||||
|
for (final UUIDService service : serviceList) {
|
||||||
|
final List<UUIDMapping> completedRequests = service.getUUIDs(remainingRequests);
|
||||||
|
for (final UUIDMapping mapping : completedRequests) {
|
||||||
|
remainingRequests.remove(mapping.getUsername());
|
||||||
|
}
|
||||||
|
mappings.addAll(completedRequests);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mappings.size() == requests.size()) {
|
||||||
|
return mappings;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ServiceError("End of pipeline");
|
||||||
}, this.executor);
|
}, this.executor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ package com.plotsquared.core.uuid;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,40 +35,22 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public interface UUIDService {
|
public interface UUIDService {
|
||||||
|
|
||||||
default Optional<?> get(@NotNull final Object request) {
|
/**
|
||||||
if (request instanceof UUID) {
|
* Attempt to complete the given requests. Returns the mappings
|
||||||
return get((UUID) request);
|
* that could be created by this server
|
||||||
} else if (request instanceof String) {
|
*
|
||||||
return get((String) request);
|
* @param uuids Requests
|
||||||
} else {
|
* @return Completed requests
|
||||||
throw new IllegalArgumentException("Request has to be either a username or UUID");
|
*/
|
||||||
}
|
@NotNull List<UUIDMapping> getNames(@NotNull final List<UUID> uuids);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a stored username from the service if it exists.
|
* Attempt to complete the given requests. Returns the mappings
|
||||||
* This should <b>not</b> trigger any fetching of
|
* that could be created by this server
|
||||||
* usernames from other services.
|
|
||||||
* <p>
|
|
||||||
* If the username isn't stored in this service,
|
|
||||||
* this completes with an empty optional.
|
|
||||||
*
|
*
|
||||||
* @param uuid Player UUID
|
* @param usernames Requests
|
||||||
* @return Optional that may contain the username if it exists
|
* @return Completed requests
|
||||||
*/
|
*/
|
||||||
@NotNull Optional<String> get(@NotNull final UUID uuid);
|
@NotNull List<UUIDMapping> getUUIDs(@NotNull final List<String> usernames);
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a stored UUID from the service if it exists.
|
|
||||||
* This should <b>not</b> trigger any fetching of
|
|
||||||
* UUID from other services.
|
|
||||||
* <p>
|
|
||||||
* If the UUID isn't stored in this service,
|
|
||||||
* this completes with an empty optional.
|
|
||||||
*
|
|
||||||
* @param username Player username
|
|
||||||
* @return Optional that may contain the UUID if it exists
|
|
||||||
*/
|
|
||||||
@NotNull Optional<UUID> get(@NotNull final String username);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,14 @@ package com.plotsquared.core.uuid.offline;
|
|||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.plotsquared.core.configuration.Settings;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.uuid.UUIDMapping;
|
||||||
import com.plotsquared.core.uuid.UUIDService;
|
import com.plotsquared.core.uuid.UUIDService;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,12 +49,16 @@ public class OfflineModeUUIDService implements UUIDService {
|
|||||||
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(Charsets.UTF_8));
|
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + username).getBytes(Charsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @NotNull public Optional<String> get(@NotNull final UUID uuid) {
|
@Override @NotNull public List<UUIDMapping> getNames(@NotNull final List<UUID> uuids) {
|
||||||
return Optional.empty();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @NotNull public Optional<UUID> get(@NotNull final String username) {
|
@Override @NotNull public List<UUIDMapping> getUUIDs(@NotNull List<String> usernames) {
|
||||||
return Optional.of(this.getFromUsername(username));
|
final List<UUIDMapping> mappings = new ArrayList<>(usernames.size());
|
||||||
|
for (final String username : usernames) {
|
||||||
|
mappings.add(new UUIDMapping(getFromUsername(username), username));
|
||||||
|
}
|
||||||
|
return mappings;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user