Use the OfflinePlayer$getPlayer method instead of casting to Player class

You should use this to avoid a class cast exception if some other plugins uses an own Implementation of the offline player.
This commit is contained in:
Ricardo Borutta 2024-01-29 10:21:24 +01:00
parent 1cd4d93f7f
commit 403622d205

View File

@ -29,7 +29,7 @@ public abstract class PlaceholderHook {
@Nullable
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
if (player != null && player.isOnline()) {
return onPlaceholderRequest((Player) player, params);
return onPlaceholderRequest(player.getPlayer(), params);
}
return onPlaceholderRequest(null, params);