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


Java Horse.Variant方法代碼示例

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


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

示例1: getFoodChance

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
/**
 * Examine an itemstack and determine the probability that a given horse variant will become tamed
 * upon consuming one item.
 * 
 * @param variant The type of Horse
 * @param item The ItemStack that may be edible
 * @return The chance of becoming tamed
 */
public double getFoodChance(Horse.Variant variant, ItemStack item) {
  String node = variant.name().toLowerCase() + "." + item.getType().name().toLowerCase();
  /* Check to see if the food is defined without a data value */
  if (plugin.getConfig().contains(node)) {
    return plugin.getConfig().getDouble(node, 0.0);
  }
  /* Check to see if the food is defined with a data value */
  if (plugin.getConfig().contains(node + ":" + item.getDurability())) {
    return plugin.getConfig().getDouble(node + ":" + item.getDurability(), 0.0);
  }
  return 0.0;
}
 
開發者ID:EasyMFnE,項目名稱:DeadHorses,代碼行數:21,代碼來源:Config.java

示例2: isFood

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
/**
 * Examine an itemstack and determine if a specific horse Variant can eat it
 * 
 * @param variant The type of Horse
 * @param item The ItemStack that may be edible
 * @return Whether the Horse can eat the item or not
 */
public boolean isFood(Horse.Variant variant, ItemStack item) {
  String node = variant.name().toLowerCase() + "." + item.getType().name().toLowerCase();
  /* Check to see if the food is defined without a data value */
  if (plugin.getConfig().contains(node) && plugin.getConfig().getDouble(node, 0.0) > 0.0) {
    return true;
  }
  /* Check to see if the food is defined with a data value */
  if (plugin.getConfig().contains(node + ":" + item.getDurability())
      && plugin.getConfig().getDouble(node + ":" + item.getDurability(), 0.0) > 0.0) {
    return true;
  }
  return false;
}
 
開發者ID:EasyMFnE,項目名稱:DeadHorses,代碼行數:21,代碼來源:Config.java

示例3: onCommand

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
/**
 * This method handles user commands. Usage: "/deadhorses <reload,summon>"
 */
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  /* "/deadhorses reload" - Reload configuration */
  if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
    plugin.reload();
    sender.sendMessage("Configuration has been reloaded.");
    return true;
  }

  /* "/deadhorses summon" - Summon DeadHorses for testing */
  if (args.length == 1 && args[0].equalsIgnoreCase("summon")) {
    if (!(sender instanceof Player)) {
      sender.sendMessage("This command does not support console use.");
      return true;
    }
    Player player = (Player) sender;
    for (Horse.Variant variant : new Horse.Variant[] {Horse.Variant.SKELETON_HORSE,
        Horse.Variant.UNDEAD_HORSE}) {
      Horse horse = (Horse) player.getWorld().spawnEntity(player.getLocation(), EntityType.HORSE);
      horse.setVariant(variant);
      if (plugin.getPluginConfig().isFoodAgingEnabled()) {
        horse.setBaby();
      } else {
        horse.setAdult();
      }
    }
    sender.sendMessage("Dead horses have been summoned.");
    return true;
  }

  /* Return false to trigger display of usage from plugin.yml */
  return false;
}
 
開發者ID:EasyMFnE,項目名稱:DeadHorses,代碼行數:37,代碼來源:DeadHorsesCommand.java

示例4: getVariant

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public static Horse.Variant getVariant(PlayerDataRPG pd) {
    if (pd.horseVariant == null)
        pd.horseVariant = RMath.randObject(Horse.Variant.values());
    return pd.horseVariant;
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:6,代碼來源:HorseManager.java

示例5: get

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public static Horse.Variant get(String string) {
    return instance()._get(string);
}
 
開發者ID:GameBoxx,項目名稱:GameBoxx,代碼行數:4,代碼來源:HorseVariants.java

示例6: getName

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public static String getName(Horse.Variant key) {
    return instance()._getName(key);
}
 
開發者ID:GameBoxx,項目名稱:GameBoxx,代碼行數:4,代碼來源:HorseVariants.java

示例7: getDisplayName

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public static String getDisplayName(Horse.Variant key) {
    return instance()._getDisplayName(key);
}
 
開發者ID:GameBoxx,項目名稱:GameBoxx,代碼行數:4,代碼來源:HorseVariants.java

示例8: getAliases

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public static List<String> getAliases(Horse.Variant key) {
    return instance()._getAliases(key);
}
 
開發者ID:GameBoxx,項目名稱:GameBoxx,代碼行數:4,代碼來源:HorseVariants.java

示例9: getVariant

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public Horse.Variant getVariant() {
    return variant;
}
 
開發者ID:leMaik,項目名稱:RpgPlus,代碼行數:4,代碼來源:HorseTrait.java

示例10: setVariant

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public void setVariant(Horse.Variant variant) {
    this.variant = variant;
    if (getNPC().isSpawned()) ((Horse) getNPC().getEntity()).setVariant(variant);
}
 
開發者ID:leMaik,項目名稱:RpgPlus,代碼行數:5,代碼來源:HorseTrait.java

示例11: of

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public static HorseVariant of(Horse.Variant variant) {
    return VARIANT_CONVERTER.convert(variant);
}
 
開發者ID:LapisBlue,項目名稱:Pore,代碼行數:4,代碼來源:HorseConverter.java

示例12: onEnable

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
public void onEnable() {
	
	this.saveDefaultConfig();
	
	PluginManager pm = getServer().getPluginManager();
	pm.registerEvents(this, this);
	
	this.DisableSpawning = ((Boolean) this.getConfig().get("disable-spawning") == true) ? true : false;
	this.DisableItemDrops = ((Boolean) this.getConfig().get("disable-item-drops") == true) ? true : false;
	
	this.mountVariants = new HashMap<String, Horse.Variant>();
	this.mountVariants.put("horse", Horse.Variant.HORSE);
	this.mountVariants.put("mule", Horse.Variant.MULE);
	this.mountVariants.put("donkey", Horse.Variant.DONKEY);
	this.mountVariants.put("skeleton", Horse.Variant.SKELETON_HORSE);
	this.mountVariants.put("zombie", Horse.Variant.UNDEAD_HORSE);
	
	this.mountStyles = new HashMap<String, Horse.Style>();
	this.mountStyles.put("default", Horse.Style.NONE);
	this.mountStyles.put("white", Horse.Style.WHITE);
	this.mountStyles.put("whitefield", Horse.Style.WHITEFIELD);
	this.mountStyles.put("whitedots", Horse.Style.WHITE_DOTS);
	this.mountStyles.put("blackdots", Horse.Style.BLACK_DOTS);
	
	this.mountColors = new HashMap<String, Horse.Color>();
	this.mountColors.put("white", Horse.Color.WHITE);
	this.mountColors.put("creamy", Horse.Color.CREAMY);
	this.mountColors.put("chestnut", Horse.Color.CHESTNUT);
	this.mountColors.put("brown", Horse.Color.BROWN);
	this.mountColors.put("black", Horse.Color.BLACK);
	this.mountColors.put("gray", Horse.Color.GRAY);
	this.mountColors.put("darkbrown", Horse.Color.DARK_BROWN);
	
	this.mountArmor = new HashMap<String, Material>();
	this.mountArmor.put("iron", Material.IRON_BARDING);
	this.mountArmor.put("gold", Material.GOLD_BARDING);
	this.mountArmor.put("diamond", Material.DIAMOND_BARDING);
	
	// Commands
	getCommand("hm").setExecutor(new HorseMountCommandExecutor(this));
	getCommand("horsemount").setExecutor(new HorseMountCommandExecutor(this));
	getCommand("mount").setExecutor(new HorseMountCommandExecutor(this));
	getCommand("dismount").setExecutor(new HorseMountCommandExecutor(this));
	getCommand("setmount").setExecutor(new HorseMountCommandExecutor(this));
	getCommand("setarmor").setExecutor(new HorseMountCommandExecutor(this));
	getCommand("showmount").setExecutor(new HorseMountCommandExecutor(this));
	getCommand("spawnmount").setExecutor(new HorseMountCommandExecutor(this));
	
	// Plugin Metrics
	try {
	    Metrics metrics = new Metrics(this);
	    metrics.start();
	} catch (IOException e) {
		getLogger().info("Failed to submit stats to MCStats.org");
	}
}
 
開發者ID:ktross,項目名稱:HorseMount,代碼行數:57,代碼來源:HorseMount.java

示例13: isArmorEquippable

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
/**
 * @param variant A variant of horse
 * @return Whether the horse variant should be allowed to equip barding
 */
public boolean isArmorEquippable(Horse.Variant variant) {
  return plugin.getConfig().getBoolean("armor." + variant.name().toLowerCase(), false);
}
 
開發者ID:EasyMFnE,項目名稱:DeadHorses,代碼行數:8,代碼來源:Config.java

示例14: isHoldingFood

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
/**
 * @param player Player with item in hand
 * @param variant Type of Horse
 * @return Whether or not the held item is a valid food for the horse
 */
private boolean isHoldingFood(Player player, Horse.Variant variant) {
  return plugin.getPluginConfig().isFood(variant, player.getItemInHand());
}
 
開發者ID:EasyMFnE,項目名稱:DeadHorses,代碼行數:9,代碼來源:PlayerListener.java

示例15: getVariant

import org.bukkit.entity.Horse; //導入方法依賴的package包/類
Horse.Variant getVariant(); 
開發者ID:deathcap,項目名稱:BedrockAPI,代碼行數:2,代碼來源:Horse.java


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