本文整理汇总了Java中org.bukkit.inventory.PlayerInventory.setLeggings方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerInventory.setLeggings方法的具体用法?Java PlayerInventory.setLeggings怎么用?Java PlayerInventory.setLeggings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.inventory.PlayerInventory
的用法示例。
在下文中一共展示了PlayerInventory.setLeggings方法的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));
}
}
}
示例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();
}
}
}
示例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);
}
}
示例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 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;
}
示例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]);
}
示例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);
}
}
示例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);
}
}
示例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));
}
}
}
示例9: 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);
}
}
示例10: 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());
}
示例11: 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));//到这里就清空了
}
示例12: 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"))));
}
}
示例13: 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]);
}
示例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();
}
}
}
示例15: start
import org.bukkit.inventory.PlayerInventory; //导入方法依赖的package包/类
public void start() {
playing = true;
starting = true;
Title title = new Title("Tout le monde est prêt ?");
title.setTitleColor(ChatColor.DARK_AQUA);
title.setSubtitle("On ne bouge plus !");
title.setSubtitleColor(ChatColor.AQUA);
title.setFadeInTime(9);
title.setStayTime(20);
title.setFadeOutTime(9);
title.setTimingsToTicks();
title.broadcast();
RftdLogger.log(Level.INFO, "Starting game...");
RftdHelper.setDifficulty(Difficulty.HARD);
RftdHelper.canEveryoneWalk(false);
RftdHelper.setEveryoneGameMode(GameMode.ADVENTURE);
RftdHelper.setAnimalSpawnLimit(50);
Collection<? extends Player> players = Bukkit.getOnlinePlayers();
for(Player player : players) {
PlayerInventory inventory = player.getInventory();
inventory.clear();
inventory.setHelmet(null);
inventory.setChestplate(null);
inventory.setLeggings(null);
inventory.setBoots(null);
ItemStack endereyes = new ItemStack(Material.EYE_OF_ENDER, getEyeOfEnderQty());
inventory.setItem(4, endereyes);
}
task = Bukkit.getScheduler().runTaskTimer(plugin, new StartTimer(), 40, 20);
}