Yatopia/patches/api/0002-Add-GameProfileLookupEvent.patch
2021-06-16 19:58:18 +02:00

76 lines
2.3 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
diff --git a/build.gradle.kts b/build.gradle.kts
index 6d04816e22f44a33c001d2b7e080402fba6af86c..dffd42fa0862a04fbb63dbc2c378d41eac2aafb5 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -27,6 +27,7 @@ dependencies {
api("org.ow2.asm:asm:9.0")
api("org.ow2.asm:asm-commons:9.0")
api("org.apache.logging.log4j:log4j-api:2.14.1") // Paper
+ api("com.mojang:authlib:2.3.31") // Yatopia
compileOnly("org.apache.maven:maven-resolver-provider:3.8.1")
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
diff --git a/src/main/java/org/yatopiamc/yatopia/server/events/GameProfileLookupEvent.java b/src/main/java/org/yatopiamc/yatopia/server/events/GameProfileLookupEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..f96afc8f1b04f4bf46a2acbca95ebcfebfa01182
--- /dev/null
+++ b/src/main/java/org/yatopiamc/yatopia/server/events/GameProfileLookupEvent.java
@@ -0,0 +1,51 @@
+package org.yatopiamc.yatopia.server.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;
+ }
+}