• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Items类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.milkbowl.vault.item.Items的典型用法代码示例。如果您正苦于以下问题:Java Items类的具体用法?Java Items怎么用?Java Items使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Items类属于net.milkbowl.vault.item包,在下文中一共展示了Items类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testItems

import net.milkbowl.vault.item.Items; //导入依赖的package包/类
@Test
public void testItems() {
    boolean failed = false;
    for (ItemInfo item : Items.getItemList()) {
        ItemInfo queriedInfo = Items.itemByString(item.getName());
        try {
            assertEquals(item, queriedInfo);
        } catch (AssertionError e) {
            e.printStackTrace();
            failed = true;
        }
    }
    assertEquals(false, failed);
}
 
开发者ID:MilkBowl,项目名称:VaultAPI,代码行数:15,代码来源:ItemTest.java


示例2: getItemName

import net.milkbowl.vault.item.Items; //导入依赖的package包/类
/**
 * Returns the name of an item reward, in a readable format.
 *
 * @param item
 * @return the item name
 */
public String getItemName(ItemStack item) {
	// Return Vault name of object if available.
	if (economy != null) {
		ItemInfo itemInfo = Items.itemByStack(item);
		if (itemInfo != null) {
			return itemInfo.getName();
		}
	}
	// Vault name of object not available.
	return StringUtils.replace(item.getType().toString(), "_", " ").toLowerCase();
}
 
开发者ID:PyvesB,项目名称:AdvancedAchievements,代码行数:18,代码来源:RewardParser.java


示例3: testItemStacks

import net.milkbowl.vault.item.Items; //导入依赖的package包/类
@Test
public void testItemStacks() {
    boolean failed = false;
    for (ItemInfo item : Items.getItemList()) {
        ItemStack stack = item.toStack();
        try {
            assertEquals(item, Items.itemByStack(stack));
        } catch (AssertionError e) {
            e.printStackTrace();
            failed = true;
        }
    }
    assertEquals(false, failed);
}
 
开发者ID:MilkBowl,项目名称:VaultAPI,代码行数:15,代码来源:ItemTest.java


示例4: MissingMaterialtest

import net.milkbowl.vault.item.Items; //导入依赖的package包/类
@Test
public void MissingMaterialtest() {
	boolean missing = false;
    for (Material mat : Material.values()) {
        if (ignoreMats.contains(mat)) continue;
        if (Items.itemByType(mat) == null) {
        	missing = true;
        	System.out.println("Missing " + mat.toString() + " in item search list");
        }
    }
    assertEquals(missing, false);
}
 
开发者ID:MilkBowl,项目名称:VaultAPI,代码行数:13,代码来源:ItemTest.java


示例5: plotStart

import net.milkbowl.vault.item.Items; //导入依赖的package包/类
/**
 * Executes the command "/plot start"
 * 
 * @param sender
 * @param args
 * @param path
 */
private void plotStart(CommandSender sender, Player p, String[] args, String path) {
    // Copy inventory
    ItemStack[] inv = p.getInventory().getContents();

    // Clear Inventory of 'p' and gives add the Wand-Item
    p.getInventory().clear();
    p.getInventory().setItemInHand(new ItemStack(Items.itemById(Configuration.Wand).getType()));

    // Information messages
    Helper.sendMessage(sender, Constants.InfoSelectPositions);
    Helper.sendMessage(sender, Constants.InfoPlotLeave);
    Helper.sendMessage(sender, Constants.InfoFly);

    // Allows player to fly
    if (Configuration.PlayerIsAllowedToFlyWhileInSelectionMode.get(Vault.permission.getPrimaryGroup(p.getWorld(), p.getName()))) {
        p.setAllowFlight(true);
    }

    // Saves inventory
    Configuration.inventorys.put(path, inv);
    plugin.saveConfig();

    // Add player
    Configuration.players.add(path);
    return;
}
 
开发者ID:Blockhaus2000,项目名称:SelfMadeRegion,代码行数:34,代码来源:Plot.java


示例6: getItemName

import net.milkbowl.vault.item.Items; //导入依赖的package包/类
public String getItemName(Material material, short data) {
    ItemInfo info = Items.itemByType(material, data);
    return info == null ? null : info.getName();
}
 
开发者ID:elBukkit,项目名称:MagicLib,代码行数:5,代码来源:VaultController.java


示例7: onPlayerInteract

import net.milkbowl.vault.item.Items; //导入依赖的package包/类
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    Player player = event.getPlayer();
    String playerName = player.getName();
    String worldName = player.getWorld().getName();
    String path = playerName.toLowerCase() + "|" + worldName.toLowerCase();

    if (!Configuration.players.contains(path)) {
        return;
    }

    if (!event.hasBlock()) {
        return;
    }

    if (event.getMaterial() == Items.itemById(Configuration.Wand).getType()) {
        // Leftclick (L) or Rightclick (B)
        String click;

        if (event.getAction().compareTo(Action.LEFT_CLICK_BLOCK) == 1) {
            // Rightclick
            click = "B";
        } else {
            // Leftkclick
            click = "A";
        }

        int x = event.getClickedBlock().getX() + 0;
        int y = event.getClickedBlock().getY() + 0;
        int z = event.getClickedBlock().getZ() + 0;

        String msg = "Position " + click + " set to: " + x + ", " + y + ", " + z;
        Helper.sendMessage(event.getPlayer(), msg.replaceAll("A", "1").replaceAll("B", "2"));

        ArrayList<Integer> pt = new ArrayList<Integer>();
        pt.add(x);
        pt.add(y);
        pt.add(z);

        if (!Configuration.points.containsKey(path)) {
            Configuration.points.put(path, new Region(event.getPlayer().getWorld()));
        }

        Region region = Configuration.points.get(path);
        if (click.equals("A")) {
            region.setMinX(x);
            region.setMinY(y);
            region.setMinZ(z);
        } else {
            region.setMaxX(x);
            region.setMaxY(y);
            region.setMaxZ(z);
        }
        Configuration.points.put(path, region);
    }
}
 
开发者ID:Blockhaus2000,项目名称:SelfMadeRegion,代码行数:57,代码来源:PlayerInteractListener.java


示例8: resolve

import net.milkbowl.vault.item.Items; //导入依赖的package包/类
/**
 * Attempts to resolve a string into a Material using Vault's Items API.
 * 
 * @param string String to resolve
 * @return Material, or null if not found
 */
public static Material resolve(String string)
{
	ItemInfo info = Items.itemByString(string);
	return info != null ? info.getType() : null;
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:12,代码来源:VaultHandler.java


示例9: friendlyName

import net.milkbowl.vault.item.Items; //导入依赖的package包/类
/**
 * Attempts to get the friendly name of an ItemStack with Vault.
 * 
 * @param stack ItemStack to get the name of
 * @return The name, or null
 */
public static String friendlyName(ItemStack stack)
{
	ItemInfo info = Items.itemByStack(stack);
	return info != null ? info.getName() : null;
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:12,代码来源:VaultHandler.java



注:本文中的net.milkbowl.vault.item.Items类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FileSystemApplicationHistoryStore类代码示例发布时间:2022-05-23
下一篇:
Java AntPathRequestMatcher类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap