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


Java Player.setMetadata方法代碼示例

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


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

示例1: quitFuture

import org.bukkit.entity.Player; //導入方法依賴的package包/類
private ListenableFuture<?> quitFuture(Player player) {
    if(player.isOnline()) {
        final SettableFuture<?> future = SettableFuture.create();
        player.setMetadata(METADATA_KEY, new FixedMetadataValue(plugin, future));
        return future;
    } else {
        return Futures.immediateFuture(null);
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:10,代碼來源:PlayerServerChanger.java

示例2: set

import org.bukkit.entity.Player; //導入方法依賴的package包/類
private void set(Player player, String key, @Nullable Boolean value) {
    if(value != null) {
        player.setMetadata(key, new FixedMetadataValue(plugin, value));
    } else {
        player.removeMetadata(key, plugin);
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:8,代碼來源:PlayerStatesImpl.java

示例3: getLastLandChangedMeta

import org.bukkit.entity.Player; //導入方法依賴的package包/類
private long getLastLandChangedMeta(Player player) {
    List<MetadataValue> value = player.getMetadata(LAND_CHANGED_META_KEY);
    long millis = System.currentTimeMillis();
    long remaining = value == null || value.isEmpty() ? 0L : value.get(0).asLong() - millis;
    if (remaining <= 0L) { // update the metadata.
        player.setMetadata(LAND_CHANGED_META_KEY, new FixedMetadataValue(plugin, millis + LAND_CHANGE_MSG_THRESHOLD));
    }

    return remaining;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:11,代碼來源:FactionListener.java

示例4: onDisableMod

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public static void onDisableMod()
{
  Player[] arrayOfPlayer;
  int j = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length;
  for (int i = 0; i < j; i++)
  {
    Player online = arrayOfPlayer[i];
    if (modMode.contains(online.getName()))
    {
      online.setMetadata("ModMode", new FixedMetadataValue(HCF.getInstance(), Integer.valueOf(1)));
      leaveMod(online);
    }
  }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:15,代碼來源:ModeratorMode.java

示例5: onItemPickup

import org.bukkit.entity.Player; //導入方法依賴的package包/類
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onItemPickup(PlayerPickupItemEvent event) {
    Player player = event.getPlayer();
    long remaining = getRemaining(player);
    if (remaining > 0L) {
        UUID itemUUID = event.getItem().getUniqueId();
        Long delay = itemUUIDPickupDelays.get(itemUUID);
        if (delay == null)
            return;

        // The item has been spawned for over the required pickup time for
        // PVP Protected players, let them pick it up.
        long millis = System.currentTimeMillis();
        if ((delay - millis) > 0L) {
            event.setCancelled(true);

            // Don't let the pickup event spam the player.
            List<MetadataValue> value = player.getMetadata(ITEM_PICKUP_MESSAGE_META_KEY);
            if (value != null && !value.isEmpty() && value.get(0).asLong() - millis <= 0L) {
                player.setMetadata(ITEM_PICKUP_MESSAGE_META_KEY, new FixedMetadataValue(plugin, millis + ITEM_PICKUP_MESSAGE_DELAY));
                player.sendMessage(ChatColor.RED + "You cannot pick this item up for another " + ChatColor.BOLD + DurationFormatUtils.formatDurationWords(remaining, true, true) + ChatColor.RED
                        + " as your " + getDisplayName() + ChatColor.RED + " timer is active [" + ChatColor.BOLD + DurationFormatter.getRemaining(remaining, true, false) + ChatColor.RED
                        + " remaining]");
            }
        } else
            itemUUIDPickupDelays.remove(itemUUID);
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:29,代碼來源:InvincibilityTimer.java

示例6: setPlayer

import org.bukkit.entity.Player; //導入方法依賴的package包/類
public void setPlayer(Player player) {
	this.player = player;
	if(!player.hasMetadata("id"))
	player.setMetadata("id", new FixedMetadataValue(VanillaPlus.getInstance(), id));
}
 
開發者ID:dracnis,項目名稱:VanillaPlus,代碼行數:6,代碼來源:VPPlayer.java


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