work and compile errors
This commit is contained in:
@@ -16,22 +16,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+import com.destroystokyo.paper.event.profile.LookupProfileEvent;
|
||||
+import com.destroystokyo.paper.event.profile.PreLookupProfileEvent;
|
||||
+import com.google.common.collect.Sets;
|
||||
import com.mojang.authlib.Agent;
|
||||
import com.mojang.authlib.Environment;
|
||||
+import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.ProfileLookupCallback;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
|
||||
|
||||
import java.net.Proxy;
|
||||
+import java.util.Set;
|
||||
|
||||
public class PaperGameProfileRepository extends YggdrasilGameProfileRepository {
|
||||
public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) {
|
||||
super(authenticationService, environment);
|
||||
public PaperGameProfileRepository(Proxy proxy, Environment environment) {
|
||||
@@ -0,0 +0,0 @@ public class PaperGameProfileRepository extends YggdrasilGameProfileRepository {
|
||||
|
||||
@Override
|
||||
public void findProfilesByNames(String[] names, Agent agent, ProfileLookupCallback callback) {
|
||||
- super.findProfilesByNames(names, agent, callback);
|
||||
public void findProfilesByNames(String[] names, ProfileLookupCallback callback) {
|
||||
- super.findProfilesByNames(names, callback);
|
||||
+ Set<String> unfoundNames = Sets.newHashSet();
|
||||
+ for (String name : names) {
|
||||
+ PreLookupProfileEvent event = new PreLookupProfileEvent(name);
|
||||
@@ -55,27 +53,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Some things were not found.... Proceed to look up.
|
||||
+ if (!unfoundNames.isEmpty()) {
|
||||
+ String[] namesArr = unfoundNames.toArray(new String[unfoundNames.size()]);
|
||||
+ super.findProfilesByNames(namesArr, agent, new PreProfileLookupCallback(callback));
|
||||
+ super.findProfilesByNames(namesArr, new PreProfileLookupCallback(callback));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static class PreProfileLookupCallback implements ProfileLookupCallback {
|
||||
+ private final ProfileLookupCallback callback;
|
||||
+
|
||||
+ PreProfileLookupCallback(ProfileLookupCallback callback) {
|
||||
+ this.callback = callback;
|
||||
+ }
|
||||
+
|
||||
+ private record PreProfileLookupCallback(ProfileLookupCallback callback) implements ProfileLookupCallback {
|
||||
+ @Override
|
||||
+ public void onProfileLookupSucceeded(GameProfile gameProfile) {
|
||||
+ PlayerProfile from = CraftPlayerProfile.asBukkitMirror(gameProfile);
|
||||
+ new LookupProfileEvent(from).callEvent();
|
||||
+ callback.onProfileLookupSucceeded(gameProfile);
|
||||
+ this.callback.onProfileLookupSucceeded(gameProfile);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onProfileLookupFailed(GameProfile gameProfile, Exception e) {
|
||||
+ callback.onProfileLookupFailed(gameProfile, e);
|
||||
+ public void onProfileLookupFailed(final String profileName, final Exception exception) {
|
||||
+ this.callback.onProfileLookupFailed(profileName, exception);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user