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


Java Player.addAttachment方法代碼示例

本文整理匯總了Java中org.bukkit.entity.Player.addAttachment方法的典型用法代碼示例。如果您正苦於以下問題:Java Player.addAttachment方法的具體用法?Java Player.addAttachment怎麽用?Java Player.addAttachment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.entity.Player的用法示例。


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

示例1: applyPermissions

import org.bukkit.entity.Player; //導入方法依賴的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

示例2: updatePlayer

import org.bukkit.entity.Player; //導入方法依賴的package包/類
/**
 * Performs updates on this player such as attempting to give vote rewards, updating player tablist name,
 * and sending the "you have mail" message
 */
public void updatePlayer() {
    if (!isOnline())
        return; // This only applies to online players.

    Player player = getPlayer();
    setUsername(player.getName());
    player.setDisplayName(getName());
    getTemporaryRank().getTeam().addEntry(player.getName());
    Voting.giveRewards(player); // Give vote rewards, if any.
    player.setOp(getRank().isAtLeast(EnumRank.BUILDER)); // Grant or remove OP status if the player is of high enough level.

    // Updates data.
    setLastIP(player.getAddress().toString().split("/")[1].split(":")[0]);
    player.addAttachment(Core.getInstance(), "OpenInv.*", getRank().isStaff());

    Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> {
        if (!getMail().isEmpty())
            player.sendMessage(ChatColor.GOLD + "You have " + ChatColor.RED + getMail().size() + ChatColor.GOLD
                    + " unread messages. Use /mail to read them.");
        if (!getMailbox().isEmpty()) {
            String l = ChatColor.YELLOW + "✉" + ChatColor.GOLD;
            player.sendMessage(TextUtils.centerChat(l + " You have new mail! Claim it with /mailbox. " + l));
        }
    }, 20L);
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:30,代碼來源:KCPlayer.java

示例3: executePlayer

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@Override
public void executePlayer(final Player p, PlayerDataRPG pd, String[] args) {
    p.addAttachment(plugin, "voxelsniper.*", true);
    p.addAttachment(plugin, "voxelsniper.sniper", true);
    p.addAttachment(plugin, "voxelsniper.command.*", true);
    p.sendMessage("You can now use voxel sniper. Note that the server now has CoreProtect so don't grief in the main world (/cw main) as I can see who did it and revert the changes (and ban you!).");
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:8,代碼來源:VoxelSniperCommand.java

示例4: setup

import org.bukkit.entity.Player; //導入方法依賴的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.entity.Player; //導入方法依賴的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: applyPermissions

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public void applyPermissions(Player player)
{
    if(player != null)
    {
        if (attachment == null)
            attachment = player.addAttachment(plugin);

        for (Map.Entry<String, Boolean> data : permissions.entrySet())
        {
            //System.out.print("Permission " + data.getKey() + " value: " + data.getValue());
            attachment.setPermission(data.getKey(), data.getValue());
        }
    }
}
 
開發者ID:SamaGames,項目名稱:SamaGamesCore,代碼行數:15,代碼來源:PermissionEntity.java

示例7: PlayerData

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public PlayerData(Player p) {
    name = p.getName();
    uuid = p.getUniqueId();
    loadedSQL = false;
    perms = p.addAttachment(plugin);
    load(p);
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:8,代碼來源:PlayerData.java


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