org.spongepowered.api.profile.GameProfileProvider Maven / Gradle / Ivy
Show all versions of spongeapi Show documentation
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.profile;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.time.Instant;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
/**
* A provider which can be used to lookup {@link GameProfile}s.
*/
public interface GameProfileProvider {
/**
* Attempts to get a basic {@link GameProfile} for the given unique id.
*
* Basic game profiles don't include any profile properties.
*
* The {@link CompletableFuture} can fail with a
* {@link ProfileNotFoundException} if no profile was found with the
* given unique id.
*
* @param uniqueId The unique id
* @return The profile found for the given unique id
*/
CompletableFuture basicProfile(UUID uniqueId);
/**
* Attempts to get a basic {@link GameProfile} for the given name.
*
* Basic game profiles don't include any profile properties.
*
* The {@link CompletableFuture} can fail with a
* {@link ProfileNotFoundException} if no profile was found with the
* given name.
*
* The requested name is matched case insensitively, the corrected
* name will be present in the {@link GameProfile}.
*
* @param name The name
* @return The profile found for the given name
*/
default CompletableFuture basicProfile(final String name) {
return this.basicProfile(name, null);
}
/**
* Attempts to get a basic {@link GameProfile} for the given name.
*
* Basic game profiles don't include any profile properties.
*
* The {@link CompletableFuture} can fail with a
* {@link ProfileNotFoundException} if no profile was found with the
* given name.
*
* The requested name is matched case insensitively, the corrected
* name will be present in the {@link GameProfile}.
*
* @param name The name
* @param time The time at which the name was assigned to a specific profile, or null if current
* @return The profile found for the given name
*/
CompletableFuture basicProfile(String name, @Nullable Instant time);
/**
* Attempts to get a basic {@link GameProfile}s for the given names.
*
* Basic game profiles don't include any profile properties.
*
* The requested names are matched case insensitively, the corrected
* names will be present in the {@link GameProfile}s.
*
* @param names The names
* @return The profiles found for the given names
*/
default CompletableFuture