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


Java CrateType类代码示例

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


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

示例1: spawnCrate

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public Crate spawnCrate(CratePlayer p, Crate crate, Location loc) {
	if(p.hasCrate()) {
		return crate;
	}
	if(canFall(loc)) {
		if(getConfiguration().isCrateMessagesEnabled()) {
			if(crate.getType() == CrateType.RARE) {
				Bukkit.broadcastMessage(getConfiguration().getRareCrateDropMessage().replaceAll("%p", p.getPlayer().getName()).replaceAll("%crate", crate.getCrateName()));
			} else if(crate.getType() == CrateType.NORMAL) {
				Bukkit.broadcastMessage(getConfiguration().getNormalCrateDropMessage().replaceAll("%p", p.getPlayer().getName()).replaceAll("%crate", crate.getCrateName()));
			}
		}

			FallingBlock fall = p.getPlayer().getWorld().spawnFallingBlock(loc.add(0, 1, 0), Material.CHEST, (byte)0);
			fall.setMetadata("crate_serie", new FixedMetadataValue(this, crate.getCrateName()));
			fall.setMetadata("crate_owner", new FixedMetadataValue(this, p.getPlayer().getName()));
			getCrateOwners().add(p.getPlayer().getName());
	}
	return crate;
}
 
开发者ID:xize,项目名称:manco2,代码行数:23,代码来源:ManCo.java

示例2: addCrateSerie

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
@Override
public Crate addCrateSerie(String serie, CrateType type, ItemStack[] items) {
	File f = new File(getDataFolder() + File.separator + "config.yml");
	YamlConfiguration con = YamlConfiguration.loadConfiguration(f);
	con.set("crates.crate."+serie.toLowerCase()+".isEnabled", true);
	con.set("crates.crate."+serie.toLowerCase()+".isRare", (type == CrateType.RARE));
	con.set("crates.crate."+serie.toLowerCase()+".rareEffects", false);
	con.set("crates.crate."+serie.toLowerCase()+".keyEnable", false);
	con.set("crates.crate."+serie.toLowerCase()+".keyItem", Material.BLAZE_ROD.name());
	con.set("crates.crate."+serie.toLowerCase()+".keyPrice", 0.0);
	con.set("crates.crate."+serie.toLowerCase()+".miniumSlotsFilled", 10);
	con.set("crates.crate."+serie.toLowerCase()+".items", getCleanItems(items));
	try {
		con.save(f);
	} catch (IOException e) {
		e.printStackTrace();
	}
	getConfiguration().reload();
	return getCrateSerie(serie);
}
 
开发者ID:xize,项目名称:manco2,代码行数:21,代码来源:ManCo.java

示例3: getCrateList

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
/**
 * returns the crate list
 * 
 * @author xize
 * @return EnumMap<CrateType, HashMap<String, Crate>>()
 */
public Crate[] getCrateList(CrateType type) {
	Collection<Crate> allcrates = getCrateList().values();
	Iterator<Crate> it = allcrates.iterator();
	List<Crate> crates = new ArrayList<Crate>();
	for(Crate crate = (it.hasNext() ? it.next() : null); it.hasNext(); crate = it.next()) {
		crates.add(crate);
	}
	return crates.toArray(new Crate[crates.size()]);
}
 
开发者ID:xize,项目名称:manco2,代码行数:16,代码来源:Configuration.java

示例4: getKeyItem

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public ItemStack getKeyItem() {
	try {
		ItemStack stack = null;
		if(con.get("crates.crate."+getCrateName()+".keyItem") instanceof Integer) {
			stack = new ItemStack(Material.getMaterial(con.getInt("crates.crate."+getCrateName()+".keyItem")), 1);
		} else if(con.get("crates.crate."+getCrateName()+".keyItem") instanceof String) {
			stack = new ItemStack(Material.getMaterial(con.getString("crates.crate."+getCrateName()+".keyItem").toUpperCase()), 1);
		}
		ItemMeta meta = stack.getItemMeta();
		if(getType() == CrateType.NORMAL) {
			meta.setDisplayName(ChatColor.GOLD + "[ManCo key]" + ChatColor.GRAY + " type: " + getCrateName());
			meta.setLore(Arrays.asList(new String[] {
					ChatColor.GRAY + "for type: " + crate,
					"",
					ChatColor.GRAY + "description: " + "this key is hand crafted by one of our best engineers!",
					"",
					ChatColor.GRAY + "possible chance on contents: ",
					ChatColor.GREEN + getPossibleList()
					}));
		} else {
			meta.setDisplayName(ChatColor.GOLD + "[ManCo key]" + ChatColor.GRAY + " type: " + ChatColor.DARK_PURPLE + getCrateName());
			meta.setLore(Arrays.asList(new String[] {
					ChatColor.GRAY + "for type: " + ChatColor.DARK_PURPLE + crate,
					"",
					ChatColor.GRAY + "description: " + "this key is hand crafted by one of our finest engineers!",
					"",
					ChatColor.GRAY + "possible chance on contents: ",
					ChatColor.GREEN + getPossibleList()
					}));
		}
		stack.setItemMeta(meta);
		return stack;
	} catch(Exception e) {
		ManCo.log(LogType.SEVERE, "one of the items in crate " + getCrateName() + " has a invalid item id as key set.");
	}
	return null;
}
 
开发者ID:xize,项目名称:manco2,代码行数:40,代码来源:RareCrate.java

示例5: getType

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
@Override
public CrateType getType() {
	if(con.getBoolean("crates.crate." + crate + ".isRare")) {
		return CrateType.RARE;
	}
	return CrateType.NORMAL;
}
 
开发者ID:xize,项目名称:manco2,代码行数:8,代码来源:RareCrate.java

示例6: setType

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
@Override
public void setType(CrateType type) {
	con.set("crates.crate."+crate+".isRare", (type == CrateType.RARE ? true : false));
	try {
		con.save(f);
	} catch (IOException e) {
		e.printStackTrace();
	}
	reload();
}
 
开发者ID:xize,项目名称:manco2,代码行数:11,代码来源:RareCrate.java

示例7: onCreate

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
@EventHandler
public void onCreate(InventoryCloseEvent e) {
	if(e.getInventory().getTitle().startsWith("mc:")) {
		String name = e.getInventory().getTitle().substring("mc:".length());
		pl.addCrateSerie(name, CrateType.NORMAL, e.getInventory().getContents());
	}
}
 
开发者ID:xize,项目名称:manco2,代码行数:8,代码来源:EditorEvent.java

示例8: onPrepare

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
@EventHandler
public void onPrepare(PrepareItemCraftEvent e) {
	CraftingInventory inv = e.getInventory();
	if(inv.getRecipe().getResult().hasItemMeta()) {
		if(inv.getRecipe().getResult().getItemMeta().hasDisplayName()) {
			if(inv.getRecipe().getResult().getItemMeta().getDisplayName().equalsIgnoreCase("crate")) {
				if(inv.getItem(5) != null) {
					if(inv.getItem(5).hasItemMeta()) {
						if(inv.getItem(5).getItemMeta().hasDisplayName()) {
							if(pl.isCrate(inv.getItem(5).getItemMeta().getDisplayName())) {
								Crate crate = pl.getCrate(inv.getItem(5).getItemMeta().getDisplayName());
								if(crate.needsKey()) {
									if(inv.getItem(5).getType() == (crate.getType() == CrateType.NORMAL ? Material.GOLD_INGOT : Material.DIAMOND)) {
										inv.setResult(crate.getKeyItem());
									} else {
										inv.setResult(null);
									}
								} else {
									inv.setResult(null);
								}
							} else {
								inv.setResult(null);
							}
						} else {
							inv.setResult(null);
						}
					} else {
						inv.setResult(null);
					}
				}
			}
		}
	}
}
 
开发者ID:xize,项目名称:manco2,代码行数:35,代码来源:KeyCraftEvent.java

示例9: onVote

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onVote(VotifierEvent e) {
	Vote vote = e.getVote();
	if(pl.getManagers().getPlayerManager().isEssentialsPlayer(vote.getUsername())) {
		Player p = Bukkit.getPlayer(vote.getUsername());
			Crate crate = pl.getManagers().getManCoManager().spawnRandomCrate(vote.getUsername());
			if(p.isOnline()) {
				sendMessage(p, pl.getConfiguration().getVoteConfig().getVotePersonalMessage().replaceAll("%player%", p.getName()).replaceAll("%reward%", (crate.getType() == CrateType.RARE ? ChatColor.DARK_PURPLE + crate.getCrateName() : crate.getCrateName())));
				broadcast(pl.getConfiguration().getVoteConfig().getVoteBroadcastMessage().replaceAll("%player%", vote.getUsername()).replaceAll("%reward%", (crate.getType() == CrateType.RARE ? ChatColor.DARK_PURPLE + crate.getCrateName() : crate.getCrateName())));
			}
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:14,代码来源:VoteCrateEvent.java

示例10: getCrateType

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
/**
 * returns the crate type of the crate in this event
 * 
 * @author xize
 * @return CrateType
 */
public CrateType getCrateType() {
	return crate.getType();
}
 
开发者ID:xize,项目名称:manco2,代码行数:10,代码来源:CrateEvent.java

示例11: getType

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
/**
 * returns the type of crate of this series
 * 
 * @author xize
 * @param returns the crate type, this should be used only for in the super interface
 * @return CrateType
 */
public CrateType getType();
 
开发者ID:xize,项目名称:manco2,代码行数:9,代码来源:Crate.java

示例12: setType

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
/**
 * sets the crate type to rare or normal
 * 
 * @author xize
 * @param sets the type of the crate.
 * @param type - the CrateType
 */
public void setType(CrateType type);
 
开发者ID:xize,项目名称:manco2,代码行数:9,代码来源:Crate.java

示例13: addCrateSerie

import tv.mineinthebox.manco.enums.CrateType; //导入依赖的package包/类
/**
 * adds a new crate serie inside the configuration
 * 
 * @author xize
 * @param serie - the crate serie.
 * @param type - the CrateType whenever the crate should be rare or normal.
 * @param items - the contents.
 */
public Crate addCrateSerie(String serie, CrateType type, ItemStack[] items);
 
开发者ID:xize,项目名称:manco2,代码行数:10,代码来源:ManCoApi.java


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