mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@bd2fd61 [ci skip] Fixup a few bad comments PaperMC/Paper@fe53b0e Updated Upstream (Bukkit/CraftBukkit/Spigot) PaperMC/Paper@1ed50da Fix javadoc errors, remove unused classes
This commit is contained in:
@@ -5,10 +5,52 @@ Subject: [PATCH] Extended OfflinePlayer API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
index 2bbc39c257965ad91ee360cdfcd3538a0f041c7e..91fbc0cfc84045e32a4ee16fba8164de7901c7e6 100644
|
||||
index 4a875bce9563f3b9351ebecde9b0eb1287beb50e..42d83cfd9318d6ebe9a5392edef3b667c9e4dac0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
||||
@@ -567,4 +567,213 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
@@ -335,14 +335,26 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
+ // Purpur start
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().getLocation();
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
CompoundTag data = this.getData();
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
- if (data.contains("Pos") && data.contains("Rotation")) {
|
||||
- ListTag position = (ListTag) data.get("Pos");
|
||||
- ListTag rotation = (ListTag) data.get("Rotation");
|
||||
+ // Purpur start - OfflinePlayer API
|
||||
+ //if (data.contains("Pos") && data.contains("Rotation")) {
|
||||
+ ListTag position = data.getList("Pos", net.minecraft.nbt.Tag.TAG_DOUBLE);
|
||||
+ ListTag rotation = data.getList("Rotation", net.minecraft.nbt.Tag.TAG_FLOAT);
|
||||
+
|
||||
+ if (position.isEmpty() && rotation.isEmpty()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Purpur end - OfflinePlayer API
|
||||
|
||||
UUID uuid = new UUID(data.getLong("WorldUUIDMost"), data.getLong("WorldUUIDLeast"));
|
||||
|
||||
@@ -353,9 +365,9 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
rotation.getFloat(0),
|
||||
rotation.getFloat(1)
|
||||
);
|
||||
- }
|
||||
+ //} // Purpur - OfflinePlayer API
|
||||
|
||||
- return null;
|
||||
+ //return null; // Purpur - OfflinePlayer API
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -598,4 +610,191 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
manager.save();
|
||||
}
|
||||
}
|
||||
@@ -129,28 +171,6 @@ index 2bbc39c257965ad91ee360cdfcd3538a0f041c7e..91fbc0cfc84045e32a4ee16fba8164de
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Location getLocation() {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().getLocation();
|
||||
+ } else {
|
||||
+ CompoundTag data = this.getData();
|
||||
+ if (data == null) return null;
|
||||
+ long worldUUIDMost = data.getLong("WorldUUIDMost");
|
||||
+ long worldUUIDLeast = data.getLong("WorldUUIDLeast");
|
||||
+ net.minecraft.nbt.ListTag position = data.getList("Pos", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_DOUBLE);
|
||||
+ net.minecraft.nbt.ListTag rotation = data.getList("Rotation", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_FLOAT);
|
||||
+ UUID worldUuid = new UUID(worldUUIDMost, worldUUIDLeast);
|
||||
+ org.bukkit.World world = server.getWorld(worldUuid);
|
||||
+ double x = position.getDouble(0);
|
||||
+ double y = position.getDouble(1);
|
||||
+ double z = position.getDouble(2);
|
||||
+ float yaw = rotation.getFloat(0);
|
||||
+ float pitch = rotation.getFloat(1);
|
||||
+ return new Location(world, x, y, z, yaw, pitch);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean teleportOffline(Location destination) {
|
||||
+ if (this.isOnline()) {
|
||||
+ return this.getPlayer().teleport(destination);
|
||||
@@ -223,10 +243,10 @@ index 2bbc39c257965ad91ee360cdfcd3538a0f041c7e..91fbc0cfc84045e32a4ee16fba8164de
|
||||
+ // Purpur end - OfflinePlayer API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 4efb8e47a29249cbca52b637d6f721cf2a9afcfb..b2b000ab47897f9d8f47840ae95ef2db478f808c 100644
|
||||
index 75944838d5527f624c843f3c181cee06edaf08d8..5d5e05ef09f79c78cfac127e8bf161f4f2afc25c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2604,6 +2604,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2619,6 +2619,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return this.getHandle().getAbilities().walkingSpeed * 2f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user