当前位置: 首页>>代码示例>>Java>>正文


Java PermOverrideManager类代码示例

本文整理汇总了Java中net.dv8tion.jda.core.managers.PermOverrideManager的典型用法代码示例。如果您正苦于以下问题:Java PermOverrideManager类的具体用法?Java PermOverrideManager怎么用?Java PermOverrideManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PermOverrideManager类属于net.dv8tion.jda.core.managers包,在下文中一共展示了PermOverrideManager类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import net.dv8tion.jda.core.managers.PermOverrideManager; //导入依赖的package包/类
@Override
protected void execute(CommandEvent e) {
    if (C.hasRole(e.getMember(), Roles.ADMIN)) {

        try {
            PermissionOverride permissionOverride = e.getTextChannel().getPermissionOverride(Roles.EVERYONE.getRole());
            PermOverrideManager manager = permissionOverride.getManager();
            manager.deny(Permission.MESSAGE_WRITE).queue();
            e.replySuccess(":lock: Channel has been locked!");
        } catch (NullPointerException npe) {
            e.replyError("An error occurred while locking the channel! Please make sure this channel is setup correctly.");
        }


    } else {
        e.replyError(C.permMsg(Roles.ADMIN));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:19,代码来源:LockCommand.java

示例2: execute

import net.dv8tion.jda.core.managers.PermOverrideManager; //导入依赖的package包/类
@Override
protected void execute(CommandEvent e) {
    if (C.hasRole(e.getMember(), Roles.ADMIN)) {
        try {
            PermissionOverride permissionOverride = e.getTextChannel().getPermissionOverride(Roles.EVERYONE.getRole());
            PermOverrideManager manager = permissionOverride.getManager();
            manager.grant(Permission.MESSAGE_WRITE).queue();
            e.replySuccess(":unlock: Channel has been unlocked!");
        } catch (NullPointerException npe) {
            e.replyError("An error occurred while un-locking the channel! Please make sure this channel is setup correctly.");
        }
    } else {
        e.replyError(C.permMsg(Roles.ADMIN));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:16,代码来源:UnlockCommand.java

示例3: getManager

import net.dv8tion.jda.core.managers.PermOverrideManager; //导入依赖的package包/类
@Override
public PermOverrideManager getManager()
{
    PermOverrideManager mng = manager;
    if (mng == null)
    {
        synchronized (mngLock)
        {
            mng = manager;
            if (mng == null)
                mng = manager = new PermOverrideManager(this);
        }
    }
    return mng;
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:16,代码来源:PermissionOverrideImpl.java

示例4: getManager

import net.dv8tion.jda.core.managers.PermOverrideManager; //导入依赖的package包/类
/**
 * Returns the {@link net.dv8tion.jda.core.managers.PermOverrideManager PermOverrideManager} for this PermissionOverride.
 * In the PermOverrideManager you can modify the permissions of the override.
 *
 * @return The PermOverrideManager of this override.
 *
 * @see    #getManagerUpdatable()
 */
PermOverrideManager getManager();
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:10,代码来源:PermissionOverride.java


注:本文中的net.dv8tion.jda.core.managers.PermOverrideManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。