Merge pull request #81 from PlaceholderAPI/feat/1.20
feat: add support for player ping in 1.20
This commit is contained in:
4 files changed
+16
-5
No files matched your search
@@ -3,7 +3,7 @@
|
||||
|
||||
<groupId>com.extendedclip.papi.expansion.player</groupId>
|
||||
<artifactId>player-expansion</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<version>2.0.5</version>
|
||||
|
||||
<name>PAPI-Expansion-Player</name>
|
||||
<description>PlaceholderAPI expansion for player placeholders</description>
|
||||
@@ -30,13 +30,13 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.19.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.20-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.11.2</version>
|
||||
<version>2.11.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class PlayerExpansion extends PlaceholderExpansion implements Confi
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return "2.0.4";
|
||||
return "2.0.5";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -77,7 +77,16 @@ public final class PlayerUtil {
|
||||
|
||||
final Object entityPlayer = getHandle.invoke(player);
|
||||
|
||||
ping = entityPlayer.getClass().getDeclaredField(VersionHelper.IS_1_17_OR_NEWER ? "e" : "ping");
|
||||
String pingFieldName;
|
||||
if (VersionHelper.IS_1_20_OR_NEWER) {
|
||||
pingFieldName = "f";
|
||||
} else if (VersionHelper.IS_1_17_OR_NEWER) {
|
||||
pingFieldName = "e";
|
||||
} else {
|
||||
pingFieldName = "ping";
|
||||
}
|
||||
|
||||
ping = entityPlayer.getClass().getDeclaredField(pingFieldName);
|
||||
ping.setAccessible(true);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,6 +22,8 @@ public final class VersionHelper {
|
||||
|
||||
public static final boolean IS_1_17_OR_NEWER = VERSION >= 1_17_0;
|
||||
|
||||
public static final boolean IS_1_20_OR_NEWER = VERSION >= 1_20_0;
|
||||
|
||||
private VersionHelper() { }
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user