Files
MiraiMC/patches/api/0004-Sugarcane-Add-GameProfileLookupEvent.patch
2021-09-19 15:45:54 +02:00

77 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Sun, 19 Sep 2021 15:20:40 +0200
Subject: [PATCH] (Sugarcane) Add GameProfileLookupEvent
diff --git a/build.gradle.kts b/build.gradle.kts
index d347663e7610f6ec7d4566b6e75e0ae5a6ee98f5..ad4a140ac7e5622a600c5413642a11857050e48f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -48,6 +48,7 @@ dependencies {
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.0")
compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper
+ compileOnly("com.mojang:authlib:2.3.31") // Sugarcane
val annotations = "org.jetbrains:annotations:21.0.1" // Paper - we don't want Java 5 annotations...
compileOnly(annotations)
diff --git a/src/main/java/xyz/arthurb/mirai/api/events/GameProfileLookupEvent.java b/src/main/java/xyz/arthurb/mirai/api/events/GameProfileLookupEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..916c92c9add6ec0ca28346d4bcbd8dff6f51dcfb
--- /dev/null
+++ b/src/main/java/xyz/arthurb/mirai/api/events/GameProfileLookupEvent.java
@@ -0,0 +1,51 @@
+package xyz.arthurb.mirai.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