當前位置: 首頁>>代碼示例>>Java>>正文


Java PermissionAttachment類代碼示例

本文整理匯總了Java中org.bukkit.permissions.PermissionAttachment的典型用法代碼示例。如果您正苦於以下問題:Java PermissionAttachment類的具體用法?Java PermissionAttachment怎麽用?Java PermissionAttachment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PermissionAttachment類屬於org.bukkit.permissions包,在下文中一共展示了PermissionAttachment類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: enable

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
@Override
public void enable() {
    final PermissionAttachment attachment = Bukkit.getConsoleSender().addAttachment(plugin);
    Stream.of(
        PERMISSION,
        PERMISSION_GET,
        PERMISSION_SET,
        PERMISSION_ANY,
        PERMISSION_ANY_GET,
        PERMISSION_ANY_SET,
        PERMISSION_IMMEDIATE
    ).forEach(name -> {
        final Permission permission = new Permission(name, PermissionDefault.FALSE);
        pluginManager.addPermission(permission);
        attachment.setPermission(permission, true);
    });
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:18,代碼來源:NicknameCommands.java

示例2: applyPermissions

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
protected void applyPermissions(Player player, UserDoc.Login userDoc) {
    boolean op = false;

    final Server localServer = minecraftService.getLocalServer();
    if(localServer.operators().containsKey(player.getUniqueId())) {
        logger.info("Opping " + player.getName() + " because they are in the server op list");
        op = true;
    }

    if(localServer.team() != null && localServer.team().members().contains(userDoc)) {
        logger.info("Opping " + player.getName() + " because they are on the team that owns the server");
        op = true;
    }

    PermissionAttachment attachment = player.addAttachment(this.plugin);
    PermissionUtils.setPermissions(attachment, Permissions.mergePermissions(localServer.realms(), userDoc.mc_permissions_by_realm()));
    player.recalculatePermissions();

    if(player.hasPermission("op")) {
        op = true;
        logger.info("Opping " + player.getName() + " because they have the op permission node");
    }

    player.setOp(op); // This is always explicitly set to true or false on login
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:26,代碼來源:LoginListener.java

示例3: permissionsSetter

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
private void permissionsSetter(UUID uuid){
    PermissionAttachment attachment = this.playerPermissions.get(uuid);
    try {
        for (String rank : RankManager.getAllRanks()){

            if (!(RankManager.getPlayersInRank(RankManager.getRankId(rank)).contains(Bukkit.getPlayer(uuid)))) {
            return;
            }
            for (String permission : RankManager.getPermissions(RankManager.getRankId(rank))){
                if(!(StringUtils.isEmpty(permission) || permission.equals(" "))){attachment.setPermission(permission, true); }
            }
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
開發者ID:Warvale,項目名稱:Ace,代碼行數:17,代碼來源:PermissionsManager.java

示例4: setup

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
public void setup(Player player){
    if(playerPermissions.containsKey(player.getUniqueId())){
        playerPermissions.remove(player.getUniqueId());
    }
    PermissionAttachment attachment = player.addAttachment(plugin);
    this.playerPermissions.put(player.getUniqueId(), attachment);
    permissionsSetter(player.getUniqueId());
}
 
開發者ID:Warvale,項目名稱:Ace,代碼行數:9,代碼來源:PermissionsManager.java

示例5: onPlayerJoin

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
@EventHandler(priority = EventPriority.LOW)
public void onPlayerJoin(PlayerJoinEvent e) {
    Player p = e.getPlayer();
    PAUser u = PAServer.getUser(p);

    if(u.isOnRank(PACmd.Grupo.Mod)){
        PermissionAttachment attachment = p.addAttachment(plugin);
        plugin.getPerms().put(p, attachment);
        PermissionAttachment pperms = plugin.getPerms().get(p);
        pperms.setPermission("bm.*", true);
    }

    //u.sendHeaderAndFooter("&cProject&6Alpha", "");

    u.getUserData().setLastConnect(System.currentTimeMillis());
    u.getUserData().setTimeJoin(System.currentTimeMillis());
    u.getUserData().setIp(u.getPlayer().getAddress());
    u.save();
    u.getPlayer().setFlySpeed(0.2f);
    u.getPlayer().setWalkSpeed(0.2f);
    if (u.getUserData().getNickname() != null) {
        u.getPlayer().setDisplayName(u.getUserData().getNickname());
    } else {
        u.getPlayer().setDisplayName(u.getName());
    }

    e.setJoinMessage(Messages.getMessage(Messages.JOIN, PAData.CORE, "%player%", e.getPlayer().getName()));
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:29,代碼來源:PlayerListener.java

示例6: addAttachment

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
@Override
public PermissionAttachment addAttachment( Plugin plugin ) {
    return this.permissionAttachments.computeIfAbsent( plugin, new Function<Plugin, PermissionAttachment>() {
        @Override
        public PermissionAttachment apply( Plugin plugin1 ) {
            return new PermissionAttachment( plugin1, FlexServerImpl.this );
        }
    } );
}
 
開發者ID:lukas81298,項目名稱:FlexMC,代碼行數:10,代碼來源:FlexServerImpl.java

示例7: addAttachment

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
@Override
public PermissionAttachment addAttachment(Plugin plugin)
{
    if (oldpermissible == null)
    {
        return super.addAttachment(plugin);
    }
    return oldpermissible.addAttachment(plugin);
}
 
開發者ID:SamaGames,項目名稱:SamaGamesCore,代碼行數:10,代碼來源:Permissible.java

示例8: removeAttachment

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
@Override
public void removeAttachment(PermissionAttachment attachment)
{
    if (oldpermissible == null)
    {
        super.removeAttachment(attachment);
        return;
    }
    oldpermissible.removeAttachment(attachment);
}
 
開發者ID:SamaGames,項目名稱:SamaGamesCore,代碼行數:11,代碼來源:Permissible.java

示例9: addAttachment

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
    return perm.addAttachment(plugin, name, value);
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:4,代碼來源:CraftHumanEntity.java

示例10: removeAttachment

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
public void removeAttachment(PermissionAttachment attachment) {
    perm.removeAttachment(attachment);
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:4,代碼來源:CraftHumanEntity.java

示例11: addAttachment

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
@Override
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
    return perm.addAttachment(plugin, name, value);
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:5,代碼來源:CraftMinecartCommand.java

示例12: removeAttachment

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
@Override
public void removeAttachment(PermissionAttachment attachment) {
    perm.removeAttachment(attachment);
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:5,代碼來源:CraftMinecartCommand.java

示例13: addAttachment

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
@Override
public PermissionAttachment addAttachment(Plugin plugin) {
    return new PermissionAttachment(plugin, this);
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:5,代碼來源:NullPermissible.java

示例14: removeAttachment

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
@Override
public void removeAttachment(PermissionAttachment attachment) {
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:4,代碼來源:NullPermissible.java

示例15: setPermissions

import org.bukkit.permissions.PermissionAttachment; //導入依賴的package包/類
public static void setPermissions(PermissionAttachment attachment,  Map<String, Boolean> permissions) {
    for(Map.Entry<String, Boolean> entry : permissions.entrySet()) {
        attachment.setPermission(entry.getKey(), entry.getValue());
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:6,代碼來源:PermissionUtils.java


注:本文中的org.bukkit.permissions.PermissionAttachment類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。