Commits

retrooper authored and md_5 committed 15f0fe23ae5
#606: Add Player#getPing to access the player's ping
No tags

src/main/java/org/bukkit/entity/Player.java

Modified
1214 1214 /**
1215 1215 * Get the player's current client side view distance.
1216 1216 * <br>
1217 1217 * Will default to the server view distance if the client has not yet
1218 1218 * communicated this information,
1219 1219 *
1220 1220 * @return client view distance as above
1221 1221 */
1222 1222 public int getClientViewDistance();
1223 1223
1224 + /**
1225 + * Gets the player's estimated ping in milliseconds.
1226 + *
1227 + * In Vanilla this value represents the average of the response time to the
1228 + * last four application layer ping packets sent. This value does not
1229 + * represent the network round trip time and as such may have less
1230 + * granularity and be impacted by other sources. For these reasons it
1231 + * <b>should not</b> be used for anti-cheat purposes. Its recommended use is
1232 + * only as a <b>qualitative</b> indicator of connection quality (Vanilla
1233 + * uses it for this purpose in the tab list).
1234 + *
1235 + * @return player ping
1236 + */
1237 + public int getPing();
1238 +
1224 1239 /**
1225 1240 * Gets the player's current locale.
1226 1241 *
1227 1242 * The value of the locale String is not defined properly.
1228 1243 * <br>
1229 1244 * The vanilla Minecraft client will use lowercase language / country pairs
1230 1245 * separated by an underscore, but custom resource packs may use any format
1231 1246 * they wish.
1232 1247 *
1233 1248 * @return the player's locale

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut