Files
MiraiMC/patches/api/0002-Add-GameProfileLookupEvent.patch
2022-06-13 16:14:55 +02:00

79 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Sat, 1 Aug 2020 15:52:50 -0500
Subject: [PATCH] Add GameProfileLookupEvent
Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/build.gradle.kts b/build.gradle.kts
index 9d7bd0f965c7dc3a60246310688aa5f93a4594a4..3a1c5a4aa8d512d50565b22a383e44b73b276ee5 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -51,6 +51,7 @@ dependencies {
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.2")
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.2")
compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper
+ compileOnly("com.mojang:authlib:3.2.38") // Yatopia
val annotations = "org.jetbrains:annotations:23.0.0" // Paper - we don't want Java 5 annotations...
compileOnly(annotations)
diff --git a/src/main/java/org/yatopiamc/yatopia/api/events/GameProfileLookupEvent.java b/src/main/java/org/yatopiamc/yatopia/api/events/GameProfileLookupEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..d7db9c87dc82c883004a906e024d2f6de3e40961
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/api/events/GameProfileLookupEvent.java
@@ -0,0 +1,51 @@
+package org.yatopiamc.yatopia.api.events;
+
+import com.mojang.authlib.GameProfile;
+import java.util.UUID;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class GameProfileLookupEvent extends Event {
+ private static final HandlerList handlers = new HandlerList();
+ private GameProfile gameProfile = null;
+ private final UUID uuid;
+ private final String name;
+
+ public GameProfileLookupEvent(boolean async, @NotNull UUID uuid, @NotNull String name) {
+ super(async);
+ this.uuid = uuid;
+ this.name = name;
+ }
+
+ @Nullable
+ public GameProfile getGameProfile() {
+ return gameProfile;
+ }
+
+ public void setGameProfile(@Nullable GameProfile gameProfile) {
+ this.gameProfile = gameProfile;
+ }
+
+ @NotNull
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ @NotNull
+ public String getName() {
+ return name;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
\ No newline at end of file