1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-25 02:18:50 +00:00

fix: 修复获取在线玩家错误的问题

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-07-28 13:53:27 +08:00
parent 1bf555bea4
commit 96f266d430

View File

@ -39,7 +39,11 @@ public class C {
// getOnlinePlayers start // getOnlinePlayers start
getOnlinePlayers = Bukkit.class.getDeclaredMethod("getOnlinePlayers"); getOnlinePlayers = Bukkit.class.getDeclaredMethod("getOnlinePlayers");
if (getOnlinePlayers.getReturnType() != Player[].class) { if (getOnlinePlayers.getReturnType() != Player[].class) {
getOnlinePlayers = Bukkit.class.getDeclaredMethod("_INVALID_getOnlinePlayers"); for (final Method method : Bukkit.class.getDeclaredMethods()) {
if (method.getReturnType() == Player[].class && method.getName().endsWith("getOnlinePlayers")) {
getOnlinePlayers = method;
}
}
} }
// getOnlinePlayers end // getOnlinePlayers end
// getOfflinePlayer start // getOfflinePlayer start
@ -60,6 +64,7 @@ public class C {
// getOfflinePlayer end // getOfflinePlayer end
} catch (NoSuchMethodException | SecurityException | ClassNotFoundException e) { } catch (NoSuchMethodException | SecurityException | ClassNotFoundException e) {
Log.warning(Player.class.getSimpleName() + "兼容性工具初始化失败 可能造成部分功能不可用!"); Log.warning(Player.class.getSimpleName() + "兼容性工具初始化失败 可能造成部分功能不可用!");
e.printStackTrace();
} }
} }