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


Java PlayerInventory.getLeggings方法代码示例

本文整理汇总了Java中org.bukkit.inventory.PlayerInventory.getLeggings方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerInventory.getLeggings方法的具体用法?Java PlayerInventory.getLeggings怎么用?Java PlayerInventory.getLeggings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.inventory.PlayerInventory的用法示例。


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

示例1: isApplicableFor

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
public boolean isApplicableFor(Player player)
{
    PlayerInventory playerInventory = player.getInventory();
    ItemStack helmet = playerInventory.getHelmet();
    if ((helmet == null) || (helmet.getType() != Material.LEATHER_HELMET)) {
        return false;
    }
    ItemStack chestplate = playerInventory.getChestplate();
    if ((chestplate == null) || (chestplate.getType() != Material.LEATHER_CHESTPLATE)) {
        return false;
    }
    ItemStack leggings = playerInventory.getLeggings();
    if ((leggings == null) || (leggings.getType() != Material.LEATHER_LEGGINGS)) {
        return false;
    }
    ItemStack boots = playerInventory.getBoots();
    return (boots != null) && (boots.getType() == Material.LEATHER_BOOTS);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:19,代码来源:ArcherClass.java

示例2: isApplicableFor

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
@Override
public boolean isApplicableFor(Player player) {
    PlayerInventory playerInventory = player.getInventory();

    ItemStack helmet = playerInventory.getHelmet();
    if (helmet == null || helmet.getType() != Material.IRON_HELMET)
        return false;

    ItemStack chestplate = playerInventory.getChestplate();
    if (chestplate == null || chestplate.getType() != Material.IRON_CHESTPLATE)
        return false;

    ItemStack leggings = playerInventory.getLeggings();
    if (leggings == null || leggings.getType() != Material.IRON_LEGGINGS)
        return false;

    ItemStack boots = playerInventory.getBoots();
    return !(boots == null || boots.getType() != Material.IRON_BOOTS);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:20,代码来源:MinerClass.java

示例3: isApplicableFor

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
@Override
public boolean isApplicableFor(Player player) {
    PlayerInventory playerInventory = player.getInventory();

    ItemStack helmet = playerInventory.getHelmet();
    if (helmet == null || helmet.getType() != Material.IRON_HELMET || !helmet.getEnchantments().isEmpty())
        return false;

    ItemStack chestplate = playerInventory.getChestplate();
    if (chestplate == null || chestplate.getType() != Material.IRON_CHESTPLATE || !chestplate.getEnchantments().isEmpty())
        return false;

    ItemStack leggings = playerInventory.getLeggings();
    if (leggings == null || leggings.getType() != Material.IRON_LEGGINGS || !leggings.getEnchantments().isEmpty())
        return false;

    ItemStack boots = playerInventory.getBoots();
    return !(boots == null || boots.getType() != Material.IRON_BOOTS || !boots.getEnchantments().isEmpty());
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:20,代码来源:AssassinClass.java

示例4: isApplicableFor

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
@Override
public boolean isApplicableFor(Player player) {
    PlayerInventory playerInventory = player.getInventory();

    ItemStack helmet = playerInventory.getHelmet();
    if (helmet == null || helmet.getType() != Material.CHAINMAIL_HELMET) {
        return false;
    }

    ItemStack chestplate = playerInventory.getChestplate();
    if (chestplate == null || chestplate.getType() != Material.CHAINMAIL_CHESTPLATE) {
        return false;
    }

    ItemStack leggings = playerInventory.getLeggings();
    if (leggings == null || leggings.getType() != Material.CHAINMAIL_LEGGINGS) {
        return false;
    }

    ItemStack boots = playerInventory.getBoots();
    return !(boots == null || boots.getType() != Material.CHAINMAIL_BOOTS);
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:23,代码来源:RogueClass.java

示例5: onPlayerDeath

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event){
    Player player = event.getEntity();
    PlayerInventory inventory = player.getInventory();
    HashMap<Integer, ItemStack> itemsToKeep = new HashMap<>();
    if (inventory.getHelmet() != null) {
        if (inventory.getHelmet().getType().equals(type) && inventory.getHelmet().getDurability() == damageValue) {
            helmet.put(player, inventory.getHelmet());
        }
    }
    if (inventory.getChestplate() != null) {
        if (inventory.getChestplate().getType().equals(type) && inventory.getChestplate().getDurability() == damageValue) {
            chestplate.put(player, inventory.getChestplate());
        }
    }
    if (inventory.getLeggings() != null) {
        if (inventory.getLeggings().getType().equals(type) && inventory.getLeggings().getDurability() == damageValue) {
            leggings.put(player, inventory.getLeggings());
        }
    }
    if (inventory.getBoots() != null) {
        if (inventory.getBoots().getType().equals(type) && inventory.getBoots().getDurability() == damageValue) {
            boots.put(player, inventory.getBoots());
        }
    }
}
 
开发者ID:dentmaged,项目名称:Cardinal-Plus,代码行数:27,代码来源:ArmorKeep.java

示例6: testInventory

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
/**This method checks the inventory of the player; as to
 * whether it's clear, or is polluted, or has armor pollution
 * @param p the player we're testing
 * @return InventoryResult result of this test
 */
public static IceBall.InventoryResult testInventory(Player p) {
	PlayerInventory pi = p.getInventory();
	if(pi.getHelmet() != null)
		return InventoryResult.ARMOR_POLLUTION;
	if(pi.getChestplate() != null)
		return InventoryResult.ARMOR_POLLUTION;
	if(pi.getLeggings() != null)
		return InventoryResult.ARMOR_POLLUTION;
	if(pi.getBoots() != null)
		return InventoryResult.ARMOR_POLLUTION;
	
	ItemStack is[] = pi.getContents();
	for(int i = 0; i < is.length; i++) {
		if(is[i] != null) {
			if(is[i].getType() != Material.AIR) {
				return InventoryResult.POLLUTED;
			}
		}
	}
	return InventoryResult.CLEAR;
}
 
开发者ID:CrystalCraftMC,项目名称:IceBall,代码行数:27,代码来源:Utility.java

示例7: 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 pants = inv.getLeggings();
        if (hand.getType() != Material.AIR) {
            inv.setLeggings(hand);
            inv.setItemInMainHand(pants);
            p.sendMessage(var.getMessages() + "Pants equipped.");
        } else {
            if (pants != null)
                inv.setItemInMainHand(pants);
            inv.setLeggings(new ItemStack(Material.AIR));
            p.sendMessage(var.getMessages() + "Pants removed.");
        }
    } else
        sender.sendMessage(var.getEr() + "Error: " + var.getErMsg() + "You do not have armor.");
    return true;
}
 
开发者ID:pupnewfster,项目名称:Necessities,代码行数:22,代码来源:CmdPants.java

示例8: clearEvil

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
public void clearEvil() {
		for (Player player : Bukkit.getOnlinePlayers()) {
//			if (peacefulPlayer.contains(player) && player.getWorld().getName().equals("GriefFree")) {
			if (player.getWorld().getName().equals("GriefFree")) {
				PlayerInventory pinv = player.getInventory();
				if (pinv.getHelmet() == null && pinv.getChestplate() == null && pinv.getLeggings() == null && pinv.getBoots() != null && pinv.getBoots().getType() == Material.GOLD_BOOTS) {
					for (Entity e : player.getNearbyEntities(30, 30, 30)) {
						if (e instanceof LivingEntity) {
							if (e instanceof Monster) {
								e.remove();
							}
						}
					}
				}
			}
		}
	}
 
开发者ID:Esaych,项目名称:DDCustomPlugin,代码行数:18,代码来源:PeacefulGriefFree.java

示例9: 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

示例10: playerInteractEvent

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void playerInteractEvent(PlayerInteractEvent e) {
	if (e.getAction() == Action.PHYSICAL)
		return;
	if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
		final Player player = e.getPlayer();

		ArmourType newArmourType = ArmourType.matchType(e.getItem());

		if (newArmourType != null) {
			PlayerInventory inv = player.getInventory();
			if (newArmourType.equals(ArmourType.HELMET) && inv.getHelmet() == null
					|| newArmourType.equals(ArmourType.CHESTPLATE) && inv.getChestplate() == null
					|| newArmourType.equals(ArmourType.LEGGINGS) && inv.getLeggings() == null
					|| newArmourType.equals(ArmourType.BOOTS) && inv.getBoots() == null) {
				ArmourEquipEvent armourEquipEvent = new ArmourEquipEvent(e.getPlayer(), EquipMethod.HOTBAR,
						ArmourType.matchType(e.getItem()), null, e.getItem());
				Bukkit.getServer().getPluginManager().callEvent(armourEquipEvent);
				if (armourEquipEvent.isCancelled()) {
					e.setCancelled(true);
					player.updateInventory();
				}
			}
		}
	}
}
 
开发者ID:gvlfm78,项目名称:BukkitOldCombatMechanics,代码行数:28,代码来源:ArmourListener.java

示例11: Kit

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
public Kit(String name, PlayerInventory playerInventory) {
    this.name = name;
    this.displayed = ItemBuilder.builder().type(Material.DIAMOND_SWORD).name("&7&l" + name).lore(Arrays.asList("&aClick to send", "&aa duel request", "&awith this kit!")).build();
    
    Map<Integer, ItemStack> inventory = new HashMap<>();

    for (int i = 0; i < playerInventory.getSize(); i++) {
        ItemStack item = playerInventory.getContents()[i];

        if (item == null) {
            continue;
        }

        inventory.put(i, item.clone());
    }

    Map<Integer, ItemStack> armor = new HashMap<>();

    if (playerInventory.getHelmet() != null) {
        armor.put(1, playerInventory.getHelmet().clone());
    }

    if (playerInventory.getChestplate() != null) {
        armor.put(2, playerInventory.getChestplate().clone());
    }

    if (playerInventory.getLeggings() != null) {
        armor.put(3, playerInventory.getLeggings().clone());
    }

    if (playerInventory.getBoots() != null) {
        armor.put(4, playerInventory.getBoots().clone());
    }

    items.put(KitManager.Type.INVENTORY, inventory);
    items.put(KitManager.Type.ARMOR, armor);
}
 
开发者ID:RealizedMC,项目名称:Duels,代码行数:38,代码来源:Kit.java

示例12: setStratingKit

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
public void setStratingKit(PlayerInventory inventory, String arenaName) {
    Arena arena = arenas.get(arenaName);
    arena.startingKitInventory = Bukkit.createInventory(null, InventoryType.PLAYER);
    arena.startingKitInventory.setContents(inventory.getContents());
    arena.kitBoots = inventory.getBoots();
    arena.kitChestplate = inventory.getChestplate();
    arena.kitHelmet = inventory.getHelmet();
    arena.kitLeggings = inventory.getLeggings();
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:10,代码来源:ArenaManager.java

示例13: onPlayerCloseInventoryEvent

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
public void onPlayerCloseInventoryEvent(InventoryCloseEvent event) {
	Player player = (Player) event.getPlayer();
	if (player.getWorld().getName().equals("GriefFree")) {
		PlayerInventory pinv = player.getInventory();
		if (pinv.getHelmet() == null && pinv.getChestplate() == null && pinv.getLeggings() == null && pinv.getBoots() != null && pinv.getBoots().getType() == Material.GOLD_BOOTS) {
			for (Entity e : player.getNearbyEntities(30, 30, 30)) {
				if (e instanceof LivingEntity) {
					if (e instanceof Monster) {
						e.remove();
					}
				}
			}
		}
	}
}
 
开发者ID:Esaych,项目名称:DDCustomPlugin,代码行数:16,代码来源:PeacefulGriefFree.java

示例14: 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

示例15: onPlayerDeath

import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
    Player player = event.getEntity();
    PlayerInventory inventory = player.getInventory();
    Map<Integer, ItemStack> itemsToKeep = new HashMap<>();
    if (inventory.getHelmet() != null) {
        if (inventory.getHelmet().getType().equals(type) && inventory.getHelmet().getDurability() == damageValue) {
            helmet.put(player, inventory.getHelmet());
            inventory.setHelmet(null);
        }
    }
    if (inventory.getChestplate() != null) {
        if (inventory.getChestplate().getType().equals(type) && inventory.getChestplate().getDurability() == damageValue) {
            chestplate.put(player, inventory.getChestplate());
            inventory.setChestplate(null);
        }
    }
    if (inventory.getLeggings() != null) {
        if (inventory.getLeggings().getType().equals(type) && inventory.getLeggings().getDurability() == damageValue) {
            leggings.put(player, inventory.getLeggings());
            inventory.setLeggings(null);
        }
    }
    if (inventory.getBoots() != null) {
        if (inventory.getBoots().getType().equals(type) && inventory.getBoots().getDurability() == damageValue) {
            boots.put(player, inventory.getBoots());
            inventory.setBoots(null);
        }
    }
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:31,代码来源:ArmorKeep.java


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