mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-29 14:15:43 +01:00
347ab2bae2
Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: e36359e Merge branch 'master' of https://github.com/Spottedleaf/Tuinity into ver/1.16.2 0b86de3 Fix several issues with Regions not recalculating correctly 36b43ee Automatically defrag IteratorSafeOrderedReferenceSet on element remove Purpur Changes: 36672d6 remove unnecessary copying of BlockPosition 88ae09d fix the raid cooldown so that players can't just loop through the farm until the cooldown is over de30a3e Updated Upstream (Paper & Tuinity)
127 lines
3.7 KiB
Diff
127 lines
3.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
|
Date: Wed, 9 Sep 2020 16:14:00 +0300
|
|
Subject: [PATCH] ProxyForwardDataEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/yatopia/api/event/ProxyForwardDataEvent.java b/src/main/java/net/yatopia/api/event/ProxyForwardDataEvent.java
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..22775d2d03ccd4c7decebc3e26b453efd44d865b
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/yatopia/api/event/ProxyForwardDataEvent.java
|
|
@@ -0,0 +1,114 @@
|
|
+package net.yatopia.api.event;
|
|
+
|
|
+import com.google.common.collect.ImmutableList;
|
|
+import com.mojang.authlib.properties.Property;
|
|
+import java.util.List;
|
|
+import java.util.UUID;
|
|
+import org.bukkit.event.Event;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Called when a proxy such as BungeeCord or Velocity forwards player data to the server.
|
|
+ */
|
|
+public class ProxyForwardDataEvent extends Event {
|
|
+
|
|
+ private final UUID uuid;
|
|
+ private final String name;
|
|
+ private List<Property> properties;
|
|
+
|
|
+ public ProxyForwardDataEvent(boolean async, UUID uuid, String name, List<Property> properties) {
|
|
+ super(async);
|
|
+ this.uuid = uuid;
|
|
+ this.name = name;
|
|
+ this.properties = properties;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns the unique id of the profile forwarded.
|
|
+ *
|
|
+ * @return unique id
|
|
+ */
|
|
+ public UUID getUuid() {
|
|
+ return uuid;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns the name of the profile forwarded.
|
|
+ *
|
|
+ * @return name
|
|
+ */
|
|
+ public String getName() {
|
|
+ return name;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns an immutable copy of the forwarded properties.
|
|
+ *
|
|
+ * @return properties
|
|
+ */
|
|
+ public List<Property> getProperties() {
|
|
+ return ImmutableList.copyOf(properties);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Adds a property to this game profile. If the property already exists, it overrides it.
|
|
+ *
|
|
+ * @param property property
|
|
+ */
|
|
+ public void addProperty(Property property) {
|
|
+ if (hasProperty(property.getName())) {
|
|
+ removeProperty(property.getName());
|
|
+ }
|
|
+ properties.add(property);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns the property with the specified name.
|
|
+ *
|
|
+ * @param property the property's name you want to get
|
|
+ * @return property if present
|
|
+ */
|
|
+ public Property getProperty(String property) {
|
|
+ for (Property prop : properties) {
|
|
+ if (prop.getName().toLowerCase().equalsIgnoreCase(property.toLowerCase())) {
|
|
+ return prop;
|
|
+ }
|
|
+ }
|
|
+ return null;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns whether or not there's a property with the specified name.
|
|
+ *
|
|
+ * @param property the name of the property you want to check if exists
|
|
+ * @return boolean value
|
|
+ */
|
|
+ public boolean hasProperty(String property) {
|
|
+ return getProperty(property) != null;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Removes the specified property if present
|
|
+ *
|
|
+ * @param property the property's name you want to remove
|
|
+ */
|
|
+ public void removeProperty(String property) {
|
|
+ properties.removeIf(prop -> prop.getName().toLowerCase().equalsIgnoreCase(property.toLowerCase()));
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Removes the specified property if present
|
|
+ *
|
|
+ * @param property the property you want to remove
|
|
+ */
|
|
+ public void removeProperty(Property property) {
|
|
+ properties.remove(property);
|
|
+ }
|
|
+
|
|
+ //
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ @NotNull @Override public HandlerList getHandlers() { return handlers; }
|
|
+ public static HandlerList getHandlerList() { return handlers; }
|
|
+ //
|
|
+}
|