1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-22 01:48:50 +00:00

feat: 忽略getOfflinePlayer的报错

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-09-12 10:35:55 +08:00
parent dfefaf53bd
commit aaf3fa1e08

View File

@ -144,8 +144,7 @@ public class C {
} while (time > 0); } while (time > 0);
} }
}).start(); }).start();;
;
} }
/** /**
@ -226,13 +225,17 @@ public class C {
} }
} }
// getOnlinePlayers end // getOnlinePlayers end
} catch (NoSuchMethodException | SecurityException e) {
Log.warning(Player.class.getSimpleName() + "兼容性工具初始化失败 可能造成部分功能不可用!");
}
try {
// getOfflinePlayer start // getOfflinePlayer start
try { try {
gameProfileClass = Class.forName("net.minecraft.util.com.mojang.authlib.GameProfile"); gameProfileClass = Class.forName("net.minecraft.util.com.mojang.authlib.GameProfile");
} catch (final ClassNotFoundException e) { } catch (final Exception e) {
try { try {
gameProfileClass = Class.forName("com.mojang.authlib.GameProfile"); gameProfileClass = Class.forName("com.mojang.authlib.GameProfile");
} catch (final ClassNotFoundException e1) { } catch (final Exception e1) {
} }
} }
gameProfileConstructor = gameProfileClass.getDeclaredConstructor(new Class[] { UUID.class, String.class }); gameProfileConstructor = gameProfileClass.getDeclaredConstructor(new Class[] { UUID.class, String.class });
@ -242,8 +245,7 @@ public class C {
craftOfflinePlayerConstructor = craftOfflinePlayer.getDeclaredConstructor(new Class[] { craftServer, gameProfileClass }); craftOfflinePlayerConstructor = craftOfflinePlayer.getDeclaredConstructor(new Class[] { craftServer, gameProfileClass });
craftOfflinePlayerConstructor.setAccessible(true); craftOfflinePlayerConstructor.setAccessible(true);
// getOfflinePlayer end // getOfflinePlayer end
} catch (NoSuchMethodException | SecurityException | ClassNotFoundException e) { } catch (final Exception e) {
Log.warning(Player.class.getSimpleName() + "兼容性工具初始化失败 可能造成部分功能不可用!");
} }
} }
@ -338,11 +340,7 @@ public class C {
Object packet = null; Object packet = null;
// Send if set // Send if set
if ((fadeInTime != -1) && (fadeOutTime != -1) && (stayTime != -1)) { if ((fadeInTime != -1) && (fadeOutTime != -1) && (stayTime != -1)) {
packet = packetTitle.getConstructor(packetActions, nmsIChatBaseComponent, Integer.TYPE, Integer.TYPE, Integer.TYPE).newInstance(actions[2], packet = packetTitle.getConstructor(packetActions, nmsIChatBaseComponent, Integer.TYPE, Integer.TYPE, Integer.TYPE).newInstance(actions[2], null, fadeInTime * 20, stayTime * 20, fadeOutTime * 20);
null,
fadeInTime * 20,
stayTime * 20,
fadeOutTime * 20);
sendPacket.invoke(connection, packet); sendPacket.invoke(connection, packet);
} }
// Send title // Send title