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


Java PlayerInventory.setBoots方法代碼示例

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


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

示例1: onPgmSpawn

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST)
public void onPgmSpawn(CardinalSpawnEvent event){
    Player player = event.getPlayer();
    PlayerInventory inventory = player.getInventory();
    if (helmet.containsKey(player)) {
        if (helmet.get(player) != null) {
            inventory.setHelmet(helmet.get(player));
        }
    }
    if (chestplate.containsKey(player)) {
        if (chestplate.get(player) != null) {
            inventory.setChestplate(chestplate.get(player));
        }
    }
    if (leggings.containsKey(player)) {
        if (leggings.get(player) != null) {
            inventory.setLeggings(leggings.get(player));
        }
    }
    if (boots.containsKey(player)) {
        if (boots.get(player) != null) {
            inventory.setBoots(boots.get(player));
        }
    }
}
 
開發者ID:dentmaged,項目名稱:Cardinal-Plus,代碼行數:26,代碼來源:ArmorKeep.java

示例2: clearInventory

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
public void clearInventory(Player p) {
	PlayerInventory inv = p.getInventory();
	inv.clear();
	inv.setHelmet(null);
	inv.setChestplate(null);
	inv.setLeggings(null);
	inv.setBoots(null);
	InventoryView view = p.getOpenInventory();
	if (view != null) {
		view.setCursor(null);
		Inventory i = view.getTopInventory();
		if (i != null) {
			i.clear();
		}
	}
}
 
開發者ID:Hansdekip,項目名稱:BlockParty-1.8,代碼行數:17,代碼來源:InventoryManager.java

示例3: clear

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
/**
 * Completely clears an inventory, including armor, if applicable.
 * 
 * @param inventory Inventory to clear
 */
public static void clear(Inventory inventory)
{
	Validate.notNull(inventory, "inventory cannot be null!");

	inventory.clear();

	if (inventory instanceof PlayerInventory)
	{
		PlayerInventory pInventory = (PlayerInventory) inventory;
		pInventory.setHelmet(null);
		pInventory.setChestplate(null);
		pInventory.setLeggings(null);
		pInventory.setBoots(null);
	}
}
 
開發者ID:dmulloy2,項目名稱:SwornAPI,代碼行數:21,代碼來源:InventoryUtil.java

示例4: commandUse

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
public boolean commandUse(CommandSender sender, String[] args) {
    Variables var = Necessities.getVar();
    if (sender instanceof Player) {
        Player p = (Player) sender;
        PlayerInventory inv = p.getInventory();
        ItemStack hand = inv.getItemInMainHand();
        ItemStack boots = inv.getBoots();
        if (hand.getType() != Material.AIR) {
            inv.setBoots(hand);
            inv.setItemInMainHand(boots);
            p.sendMessage(var.getMessages() + "Boots equipped.");
        } else {
            if (boots != null)
                inv.setItemInMainHand(boots);
            inv.setBoots(new ItemStack(Material.AIR));
            p.sendMessage(var.getMessages() + "Boots removed.");
        }
    } else
        sender.sendMessage(var.getEr() + "Error: " + var.getErMsg() + "You do not have armor.");
    return true;
}
 
開發者ID:pupnewfster,項目名稱:Necessities,代碼行數:22,代碼來源:CmdBoots.java

示例5: unpack

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
public void unpack(Player p) {

		p.setFoodLevel(this.hunger);
		p.setHealth(this.health);
		p.setExp(this.xp);
		p.setLevel(this.xpLevel);
		p.addPotionEffects(CardboardPotionEffect.unboxPotions(this.potions));
		this.inventory.unpack(p.getInventory());
		ItemStack[] armor = this.armor.unpackItemArray();
		PlayerInventory inv = p.getInventory();
		inv.setHelmet(armor[3]);
		inv.setChestplate(armor[2]);
		inv.setLeggings(armor[1]);
		inv.setBoots(armor[0]);

	}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:17,代碼來源:Knapsack.java

示例6: onPlayerRespawnEvent

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
@EventHandler
public void onPlayerRespawnEvent(PlayerRespawnEvent event) {
	if (event.getPlayer().getName().equals("Esaych")) {
		PlayerInventory eInv = event.getPlayer().getInventory();
		if (eInv.getHelmet() != null)
			return;
		if (eInv.getChestplate() != null)
			return;
		if (eInv.getLeggings() != null)
			return;
		if (eInv.getBoots() != null)
			return;
		eInv.setHelmet(new ItemStack(Material.LEATHER_HELMET));
		eInv.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
		eInv.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
		eInv.setBoots(new ItemStack(Material.LEATHER_BOOTS));
		PlayerInventory inv = event.getPlayer().getInventory();
		colorize(inv.getHelmet(), 47, 0, 111);
		colorize(inv.getChestplate(), 47, 0, 111);
		colorize(inv.getLeggings(), 47, 0, 111);
		colorize(inv.getBoots(), 47, 0, 111);
	}
}
 
開發者ID:Esaych,項目名稱:DDCustomPlugin,代碼行數:24,代碼來源:CustomPlugin.java

示例7: clearAll

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
/**
 * Clear an inventory. If the inventory is a {@link org.bukkit.inventory.PlayerInventory},
 * the armor contents are also cleared.
 *
 * @param inventory  The inventory to clear.
 */
public static void clearAll(Inventory inventory) {
    PreCon.notNull(inventory);

    inventory.clear();
    inventory.setContents(new ItemStack[inventory.getSize()]); // 36

    if (inventory instanceof PlayerInventory) {
        PlayerInventory playerInventory = (PlayerInventory)inventory;
        playerInventory.setHelmet(null);
        playerInventory.setChestplate(null);
        playerInventory.setLeggings(null);
        playerInventory.setBoots(null);
        playerInventory.setItemInHand(null);
    }
}
 
開發者ID:JCThePants,項目名稱:NucleusFramework,代碼行數:22,代碼來源:InventoryUtils.java

示例8: onPgmSpawn

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPgmSpawn(CardinalSpawnEvent event) {
    Player player = event.getPlayer();
    PlayerInventory inventory = player.getInventory();
    if (helmet.containsKey(player)) {
        if (helmet.get(player) != null) {
            inventory.setHelmet(helmet.get(player));
        }
    }
    if (chestplate.containsKey(player)) {
        if (chestplate.get(player) != null) {
            inventory.setChestplate(chestplate.get(player));
        }
    }
    if (leggings.containsKey(player)) {
        if (leggings.get(player) != null) {
            inventory.setLeggings(leggings.get(player));
        }
    }
    if (boots.containsKey(player)) {
        if (boots.get(player) != null) {
            inventory.setBoots(boots.get(player));
        }
    }
}
 
開發者ID:twizmwazin,項目名稱:CardinalPGM,代碼行數:26,代碼來源:ArmorKeep.java

示例9: giveStartingGear

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
/**Gives the players starting gear, called during dungeon startup.
 * @param p 	The player to give stuff to.
 */
private void giveStartingGear(Player p) {
PlayerInventory i = p.getInventory();
i.clear();
i.addItem( new ItemStack(Material.STONE_SWORD, 	 1));
i.addItem( new ItemStack(Material.BOW, 			 1));
i.addItem( new ItemStack(Material.ARROW, 		 1));
i.addItem( new ItemStack(Material.MUSHROOM_SOUP, 1));

i.setBoots(new ItemStack(Material.LEATHER_BOOTS, 1));
}
 
開發者ID:TheRoot89,項目名稱:DungeonGen,代碼行數:14,代碼來源:DunGen.java

示例10: clearInventory

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
public void clearInventory(boolean armor) {
    PlayerInventory inventory = this.getBukkit().getInventory();
    inventory.clear();

    if (armor) {
        inventory.setHelmet(null);
        inventory.setChestplate(null);
        inventory.setLeggings(null);
        inventory.setBoots(null);
    }
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:12,代碼來源:ArcadePlayer.java

示例11: apply

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
@Override
public void apply(GamePlayer player) {
    PlayerInventory inventory = player.getBukkit().getInventory();
    inventory.setHelmet(this.getHelmet());
    inventory.setChestplate(this.getChestplate());
    inventory.setLeggings(this.getLeggings());
    inventory.setBoots(this.getBoots());
}
 
開發者ID:ShootGame,項目名稱:Arcade2,代碼行數:9,代碼來源:ArmorContent.java

示例12: initPlayer

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
public void initPlayer(String name){
    Player player;
    if(Bukkit.getPlayer(name)!=null){
      player=Bukkit.getPlayer(name);
    }
    else{
        System.out.print("玩家不存在,初始化個屁啊。。");
        return;
    }
    player.setWalkSpeed(0.2f);
    player.setMaxHealth(20);
    player.setFoodLevel(20);
    player.setExp(0);
    player.eject();
    player.setHealth(player.getMaxHealth());
    for(PotionEffect effect : player.getActivePotionEffects())//清空藥水效果
    {
      player.removePotionEffect(effect.getType());
    }
    player.teleport(gameworld.getSpawnLocation());//傳送進等待區
    
    ItemStack[] inventory=player.getInventory().getContents();//保存背包信息
    this.mySavedItems.put(player.getName(), inventory);
    this.mySavedArmors.put(player.getName(), player.getInventory().getArmorContents());
    
    player.getInventory().clear();//清空背包
    PlayerInventory inv = player.getInventory();
    inv.setHelmet(new ItemStack(Material.AIR));
    inv.setChestplate(new ItemStack(Material.AIR));
    inv.setLeggings(new ItemStack(Material.AIR));
    inv.setBoots(new ItemStack(Material.AIR));//到這裏就清空了
    
    
}
 
開發者ID:D0048,項目名稱:CraftPlugins,代碼行數:35,代碼來源:Blockode.java

示例13: loadInventory

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
private void loadInventory(PlayerInventory inv) {
    inv.clear();
    inv.setArmorContents(new ItemStack[] {null, null, null, null});
    if(!this.database.contains(this.key + ".inventory")) {
        return;
    }

    Map<String, Object> inventory = null;
    try {
        BukkitObjectInputStream in = new BukkitObjectInputStream(new ByteArrayInputStream(this.database.getBytes(this.key + ".inventory")));
        inventory = (Map<String, Object>) in.readObject();
    } catch(Exception e) {
        this.module.getLogger().log(Level.SEVERE, "Failed to load inventory.", e);
        return;
    }

    for(int slot = 0; slot < inv.getSize(); slot++) {
        if(inventory.containsKey(String.valueOf(slot))) {
            inv.setItem(slot, ItemStack.deserialize((Map<String, Object>) inventory.get(String.valueOf(slot))));
        } else {
            inv.setItem(slot, null);
        }
    }

    if(inventory.containsKey("helmet")) {
        inv.setHelmet(ItemStack.deserialize((Map<String, Object>) inventory.get(String.valueOf("helmet"))));
    }

    if(inventory.containsKey("chestplate")) {
        inv.setChestplate(ItemStack.deserialize((Map<String, Object>) inventory.get(String.valueOf("chestplate"))));
    }

    if(inventory.containsKey("leggings")) {
        inv.setLeggings(ItemStack.deserialize((Map<String, Object>) inventory.get(String.valueOf("leggings"))));
    }

    if(inventory.containsKey("boots")) {
        inv.setBoots(ItemStack.deserialize((Map<String, Object>) inventory.get(String.valueOf("boots"))));
    }
}
 
開發者ID:Steveice10,項目名稱:Peacecraft,代碼行數:41,代碼來源:WorldPlayerData.java

示例14: setArmor

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
/**
 * Set the kit armor for given player
 *
 * @param player The player
 */
public void setArmor(Player player){
    PlayerInventory inv = player.getInventory();
    ItemStack[] armor = getContents(this.armor);

    if(!inv.contains(armor[3]))
        inv.setHelmet(armor[3]);
    if(!inv.contains(armor[2]))
        inv.setChestplate(armor[2]);
    if(!inv.contains(armor[1]))
        inv.setLeggings(armor[1]);
    if(!inv.contains(armor[0]))
        inv.setBoots(armor[0]);
}
 
開發者ID:Superioz,項目名稱:CastleRush,代碼行數:19,代碼來源:ItemKit.java

示例15: scanPlayerArmor

import org.bukkit.inventory.PlayerInventory; //導入方法依賴的package包/類
public void scanPlayerArmor(Player player) {
	PlayerInventory playerInv = player.getInventory();
	ItemStack delete = new ItemStack (Material.AIR);
	ItemStack is = playerInv.getHelmet();
	if (is != null) {
		if (confiscatable(player, is)) {
			playerInv.setHelmet(delete);
			moveToChest(player, is);
			saveChestData();
		}
	}
	is = playerInv.getChestplate();
	if (is != null) {
		if (confiscatable(player, is)) {
			playerInv.setChestplate(delete);
			moveToChest(player, is);
			saveChestData();
		}
	}
	is = playerInv.getLeggings();
	if (is != null) {
		if (confiscatable(player, is)) {
			playerInv.setLeggings(delete);
			moveToChest(player, is);
			saveChestData();
		}
	}
	is = playerInv.getBoots();
	if (is != null) {
		if (confiscatable(player, is)) {
			playerInv.setBoots(delete);
			moveToChest(player, is);
			saveChestData();
		}
	}
}
 
開發者ID:Esaych,項目名稱:DDCustomPlugin,代碼行數:37,代碼來源:AutoConfiscate.java


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