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


Java PermissibleBase类代码示例

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


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

示例1: injectConsole

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
private void injectConsole() throws Exception {
    ConsoleCommandSender consoleSender = this.plugin.getServer().getConsoleSender();

    // get the ServerCommandSender class
    Class<?> serverCommandSenderClass = ReflectionUtil.obcClass("command.ServerCommandSender");

    // get the perm field
    Field permField = serverCommandSenderClass.getDeclaredField("perm");
    permField.setAccessible(true);

    // get the PermissibleBase instance
    PermissibleBase permBase = (PermissibleBase) permField.get(consoleSender);

    // create a monitored instance which delegates to the previous PermissibleBase
    MonitoredPermissibleBase newPermBase = wrap(permBase, "internal/console");

    // inject the monitored instance
    permField.set(consoleSender, newPermBase);
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:20,代码来源:PermissibleMonitoringInjector.java

示例2: injectEntity

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
private void injectEntity() throws Exception {
    // get the CraftEntity class
    Class<?> entityClass = ReflectionUtil.obcClass("entity.CraftEntity");

    // get the method used to obtain a PermissibleBase
    // this method will initialise a new PB instance if one doesn't yet exist
    Method getPermissibleBaseMethod = entityClass.getDeclaredMethod("getPermissibleBase");
    getPermissibleBaseMethod.setAccessible(true);

    // get the PermissibleBase instance
    PermissibleBase permBase = (PermissibleBase) getPermissibleBaseMethod.invoke(null);

    // get the perm field on CraftEntity
    Field permField = entityClass.getDeclaredField("perm");
    permField.setAccessible(true);

    // create a monitored instance which delegates to the previous PermissibleBase
    MonitoredPermissibleBase newPermBase = wrap(permBase, "internal/entity");

    // inject the monitored instance
    permField.set(null, newPermBase);
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:23,代码来源:PermissibleMonitoringInjector.java

示例3: inject

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
public Permissible inject(Player player, Permissible permissible) throws NoSuchFieldException, IllegalAccessException {
    Field permField = null;
    try {
        permField = getPermissibleField(player);
    } catch (Exception e) {
    }
    if (permField == null) {
        return null;
    }
    Permissible oldPerm = (Permissible) permField.get(player);
    if (permissible instanceof PermissibleBase) {
        PermissibleBase newBase = (PermissibleBase) permissible;
        permField.set(player, newBase);
    }

    // Inject permissible
    permField.set(player, permissible);
    return oldPerm;
}
 
开发者ID:gustav9797,项目名称:PowerfulPerms,代码行数:20,代码来源:PermissibleBaseInjector.java

示例4: Permissible

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
public Permissible(CommandSender sender, PermissionEntity entity)
{
    super(sender);
    this.sender = sender;
    this.entity = entity;
    permissions = new LinkedHashMap<String, PermissionAttachmentInfo>()
    {
        @Override
        public PermissionAttachmentInfo put(String k, PermissionAttachmentInfo v)
        {
            PermissionAttachmentInfo existing = this.get(k);
            if (existing != null)
            {
                return existing;
            }
            return super.put(k, v);
        }
    };

    try
    {
        Field permissionsField = PermissibleBase.class.getField("permissions");
        Reflection.setField(permissionsField, this, permissions);
    }
    catch (NoSuchFieldException e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:30,代码来源:Permissible.java

示例5: clearPermissions

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
@Override
public synchronized void clearPermissions()
{
    if (oldpermissible == null)
    {
        super.clearPermissions();
        return;
    }
    if (oldpermissible instanceof PermissibleBase)
    {
        PermissibleBase base = (PermissibleBase) oldpermissible;
        base.clearPermissions();
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:15,代码来源:Permissible.java

示例6: inject

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
/**
 * Injects a {@link LPPermissible} into a {@link Player}.
 *
 * @param player the player to inject into
 * @param newPermissible the permissible to inject
 * @throws Exception propagates any exceptions which were thrown during injection
 */
public static void inject(Player player, LPPermissible newPermissible) throws Exception {

    // get the existing PermissibleBase held by the player
    PermissibleBase oldPermissible = (PermissibleBase) HUMAN_ENTITY_PERMISSIBLE_FIELD.get(player);

    // seems we have already injected into this player.
    if (oldPermissible instanceof LPPermissible) {
        throw new IllegalStateException("LPPermissible already injected into player " + player.toString());
    }

    // Move attachments over from the old permissible

    //noinspection unchecked
    List<PermissionAttachment> attachments = (List<PermissionAttachment>) PERMISSIBLE_BASE_ATTACHMENTS_FIELD.get(oldPermissible);

    newPermissible.convertAndAddAttachments(attachments);
    attachments.clear();
    oldPermissible.clearPermissions();

    // Setup the new permissible
    newPermissible.getActive().set(true);
    newPermissible.setOldPermissible(oldPermissible);

    // inject the new instance
    HUMAN_ENTITY_PERMISSIBLE_FIELD.set(player, newPermissible);
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:34,代码来源:PermissibleInjector.java

示例7: MonitoredPermissibleBase

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
public MonitoredPermissibleBase(VerboseHandler verboseHandler, PermissibleBase delegate, String name) {
    super(null);
    DummyPermissibleBase.nullFields(this);

    this.verboseHandler = verboseHandler;
    this.delegate = delegate;
    this.name = name;
    this.initialised = true;

    // since we effectively cancel the execution of this call in the super
    // constructor we need to call it again.
    recalculatePermissions();
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:14,代码来源:MonitoredPermissibleBase.java

示例8: wrap

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
private MonitoredPermissibleBase wrap(PermissibleBase permBase, String name) {
    Objects.requireNonNull(permBase, "permBase");

    // unwrap any previous injection
    if (permBase instanceof MonitoredPermissibleBase) {
        permBase = ((MonitoredPermissibleBase) permBase).getDelegate();
    }

    // create a monitored instance which delegates to the previous PermissibleBase
    return new MonitoredPermissibleBase(this.plugin.getVerboseHandler(), permBase, name);
}
 
开发者ID:lucko,项目名称:LuckPerms,代码行数:12,代码来源:PermissibleMonitoringInjector.java

示例9: MessageReceiver

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
public MessageReceiver (boolean op, String remote) {
    this.op = op;
    this.remote = remote;
    this.messages = new ArrayList<String>();
    this.perm = new PermissibleBase(this);
    this.acceptingMessages = true;
}
 
开发者ID:ausbin,项目名称:mccmd,代码行数:8,代码来源:MessageReceiver.java

示例10: clearPermissions

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
@Override
public synchronized void clearPermissions()
{
    if (oldPermissible instanceof PermissibleBase)
    {
        PermissibleBase base = (PermissibleBase) oldPermissible;
        base.clearPermissions();
    }
}
 
开发者ID:weaondara,项目名称:BungeePerms,代码行数:10,代码来源:BPPermissible.java

示例11: inject

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
public void inject()
{
    if (Injector.getPermissible(sender) == this)
    {
        return;
    }
    Statics.setField(PermissibleBase.class, oldPermissible, superperms, "permissions");
    Statics.setField(PermissibleBase.class, this, permissions, "permissions");
    Statics.setField(PermissibleBase.class, oldPermissible, opable, "opable");
    Injector.inject(sender, this);

    recalculatePermissions();
}
 
开发者ID:weaondara,项目名称:BungeePerms,代码行数:14,代码来源:BPPermissible.java

示例12: uninject

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
public void uninject()
{
    if (Injector.getPermissible(sender) != this)
    {
        return;
    }
    Statics.setField(PermissibleBase.class, oldPermissible, new HashMap<String, PermissionAttachmentInfo>(), "permissions");
    Statics.setField(PermissibleBase.class, oldPermissible, oldOpable, "opable");
    Injector.inject(sender, oldPermissible);

    recalculatePermissions();
}
 
开发者ID:weaondara,项目名称:BungeePerms,代码行数:13,代码来源:BPPermissible.java

示例13: injectBridge

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
public void injectBridge(Player p) {
    try {
        PermissibleBase playerPermissibleBase = (PermissibleBase) permField.get(p);
        permField.set(p, new PermissibleBaseUserBridge(p, new UserFetcher(p.getName())));
        playerPermissibleBase.recalculatePermissions();
    } catch (IllegalArgumentException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:OverCaste,项目名称:OverPermissions,代码行数:10,代码来源:BridgeInjectorAction.java

示例14: DiscordConsoleCommandSender

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
public DiscordConsoleCommandSender(CommandEvent e) {
    this.e = e;
    perm = new PermissibleBase(this);
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:5,代码来源:DiscordConsoleCommandSender.java

示例15: DiscordCommandSender

import org.bukkit.permissions.PermissibleBase; //导入依赖的package包/类
public DiscordCommandSender(CommandEvent e) {
    this.e = e;
    perm = new PermissibleBase(this);
}
 
开发者ID:CyR1en,项目名称:Minecordbot,代码行数:5,代码来源:DiscordCommandSender.java


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