Java 类net.minecraft.server.management.UserListOps 实例源码

项目:MyEssentials-Core    文件:PlayerUtils.java   
@SuppressWarnings("unchecked")
public static boolean isOp(GameProfile gameProfile) {
    UserListOps ops = MinecraftServer.getServer().getConfigurationManager().func_152603_m();
    try {
        Class clazz = Class.forName("net.minecraft.server.management.UserList");
        Method method = clazz.getDeclaredMethod("func_152692_d", Object.class);
        method.setAccessible(true);
        return (Boolean) method.invoke(ops, gameProfile);
    } catch (Exception e) {
        for (Method mt : UserList.class.getMethods()) {
            MyEssentialsCore.instance.LOG.info(mt.getName());
        }
        MyEssentialsCore.instance.LOG.error(ExceptionUtils.getStackTrace(e));
    }

    return false;
}