Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
ad9c58e103
Since 1.21.2, vanilla split relative teleportation flags into position and delta/velocity flags into separate enum entries. This highlighted a design flaw in the paper api addition for teleport flags, which just simply mirrored internals while also only being able to apply the delta/velocity part of a flag, given the teleport target is always absolute in the API. This patch proposes to simply no longer expose the non-velocity related flags to the API, instead marking the entire Relative enum as being purely velocity related, as non-velocity related flags are not useful to callers. This was done over simply exposing all internal flags, as another vanilla change to the internal enum would result in the same breakage. The newly proposed API *only* promises that the passed flags prevent the loss of velocity in the specific axis/context, which should be independent enough of vanillas specific implementation of this feature.
43 Zeilen
1.7 KiB
Diff
43 Zeilen
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aeltumn <daniel@goossens.ch>
|
|
Date: Thu, 24 Aug 2023 13:05:30 +0200
|
|
Subject: [PATCH] Implement OfflinePlayer#isConnected
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
|
index 2c2c4db31a746b4eb853dc04c6b3e5631bbfa034..4f4e3ee18d586f61706504218cddc06a38ca5580 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
|
|
@@ -54,6 +54,13 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
|
return this.getPlayer() != null;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public boolean isConnected() {
|
|
+ return false;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public String getName() {
|
|
Player player = this.getPlayer();
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 334303fbb2cf0086ad133bdc07b27e833162f71a..de97ca0a25d70de50dfcc6b092f5e58facfb5a3a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -261,6 +261,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
return this.server.getPlayer(this.getUniqueId()) != null;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public boolean isConnected() {
|
|
+ return !this.getHandle().hasDisconnected();
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public InetSocketAddress getAddress() {
|
|
if (this.getHandle().connection.protocol() == null) return null;
|