Files
MiraiMC/patches/api/0004-Sugarcane-Add-GameProfileLookupEvent.patch
2021-09-27 17:09:53 +02:00

79 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 5 Aug 2020 14:25:50 -0500
Subject: [PATCH] (Sugarcane) 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 3c9bdac53115cb6222706b8d72f36a337938e4a0..bbc678a85f581e8285920554526051493b3ae50f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -47,6 +47,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