本文整理匯總了Java中org.bukkit.entity.Wolf.setOwner方法的典型用法代碼示例。如果您正苦於以下問題:Java Wolf.setOwner方法的具體用法?Java Wolf.setOwner怎麽用?Java Wolf.setOwner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.entity.Wolf
的用法示例。
在下文中一共展示了Wolf.setOwner方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import org.bukkit.entity.Wolf; //導入方法依賴的package包/類
@Override
public boolean run(Player player, ConfigurationSection config) {
for (int i = 0; i < config.getInt("number_to_spawn"); i++) {
Wolf wolf = player.getWorld().spawn(player.getLocation(), Wolf.class);
wolf.setTamed(true);
wolf.setHealth(config.getInt("health_per_companion"));
wolf.setOwner(player);
wolf.setCustomName(player.getName());
wolf.setCustomNameVisible(true);
}
return true;
}
示例2: doKillStreak
import org.bukkit.entity.Wolf; //導入方法依賴的package包/類
@Override
public void doKillStreak(ArenaPlayer ap)
{
try
{
Player pl = Util.matchPlayer(ap.player.getName());
if (pl != null)
{
if (ap.killstreak == 8)
giveItem(pl, Material.POTION.getId(), (byte)9, 1, "八殺! 解鎖力量藥水!");
if (ap.killstreak == 12)
giveItem(pl, Material.POTION.getId(), (byte)2, 1, "十二殺! 解鎖迅捷藥水!");
if (ap.killstreak == 16)
giveItem(pl, Material.POTION.getId(), (byte)3, 1, "十六殺! 解鎖防火藥水!");
if (ap.killstreak == 24)
{
giveItem(pl, Material.POTION.getId(), (byte)1, 1, "二十四殺! 解鎖生命藥水!");
giveItem(pl, Material.GRILLED_PORK.getId(), (byte)0, 2, "二十四殺! 解鎖食物!");
}
if (ap.killstreak == 32)
{
pl.sendMessage(ChatColor.GOLD + "三十二殺! 解鎖軍犬!");
for (int i = 0; i < 3; i++)
{
Wolf wolf = (Wolf) pl.getLocation().getWorld().spawnEntity(pl.getLocation(), EntityType.WOLF);
wolf.setOwner(pl);
}
}
if (ap.killstreak == 40)
{
giveItem(pl, Material.POTION.getId(), (byte)1, 1, "四十殺! 解鎖生命藥水!");
giveItem(pl, Material.GRILLED_PORK.getId(), (byte)0, 2, "四十殺! 解鎖食物!");
}
if (ap.killstreak == 72)
giveItem(pl, Material.GOLDEN_APPLE.getId(), (byte)0, 2, "七十二殺! 解鎖金蘋果!");
if (ap.killstreak == 112)
giveItem(pl, Material.GOLDEN_APPLE.getId(), (byte)0, 2, "一百一十二殺! 解鎖金蘋果!");
}
}
catch(Exception e)
{
plugin.getLogger().severe("載入怪物競技場連殺時出現錯誤:");
e.printStackTrace();
}
}
示例3: doKillStreak
import org.bukkit.entity.Wolf; //導入方法依賴的package包/類
/**Basic Killstreak System**/
public void doKillStreak(ArenaPlayer ap)
{
try
{
Player pl = Util.matchPlayer(ap.player.getName());
if (pl != null)
{
/**Hunger Arena check**/
if (plugin.getArena(pl).type.equals("Hunger"))
return;
if (ap.killstreak == 2)
giveItem(pl, Material.POTION.getId(), (byte)9, 1, "雙殺! 解鎖力量藥水!");
if (ap.killstreak == 4)
{
giveItem(pl, Material.POTION.getId(), (byte)1, 1, "四殺! 解鎖生命藥水!");
giveItem(pl, Material.GRILLED_PORK.getId(), (byte)0, 2, "四殺! 解鎖食物!");
}
if (ap.killstreak == 5)
{
if (!(this.az.arenaType.equalsIgnoreCase("cq")))
{
pl.sendMessage(ChatColor.GOLD + "五殺! 解鎖僵屍!");
for (int i = 0; i < 4; i++)
{
pl.getLocation().getWorld().spawnEntity(pl.getLocation(), EntityType.ZOMBIE);
}
}
}
if (ap.killstreak == 8)
{
pl.sendMessage(ChatColor.GOLD + "八殺! 解鎖軍犬!");
for (int i = 0; i < 2; i++)
{
Wolf wolf = (Wolf) pl.getLocation().getWorld().spawnEntity(pl.getLocation(), EntityType.WOLF);
wolf.setOwner(pl);
}
}
if (ap.killstreak == 12)
{
giveItem(pl, Material.POTION.getId(), (byte)1, 1, "十二殺! 解鎖生命藥水!");
giveItem(pl, Material.GRILLED_PORK.getId(), (byte)0, 2, "十二殺! 解鎖食物!");
}
}
}
catch(Exception e)
{
plugin.getLogger().severe("載入連殺配置時出現錯誤: " + e.getMessage());
}
}
示例4: onEntityTame
import org.bukkit.entity.Wolf; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityTame(EntityTameEvent event)
{
AnimalTamer owner = event.getOwner();
if (owner instanceof Player)
{
Player player = (Player) owner;
if (! plugin.isDisabledWorld(player))
{
// XP Gain
String mobname = FormatUtil.getFriendlyName(event.getEntity().getType());
String article = FormatUtil.getArticle(mobname);
String message = plugin.getPrefix() +
FormatUtil.format(plugin.getMessage("taming_gain"), xpGain, article, mobname);
plugin.getExperienceHandler().handleXpGain(player, xpGain, message);
// Wolf/Ocelot's Pal
PlayerData data = plugin.getPlayerDataCache().getData(player);
int level = data.getLevel(50);
if (Util.random(150 / level) == 0)
{
if (event.getEntity() instanceof Wolf)
{
Wolf wolf = (Wolf) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.WOLF);
wolf.setOwner(player);
}
else if (event.getEntity() instanceof Ocelot)
{
Ocelot ocelot = (Ocelot) player.getLocation().getWorld().spawnEntity(player.getLocation(), EntityType.OCELOT);
ocelot.setOwner(player);
}
}
// Taming Bomb!
if (Util.random(150 / level) == 0)
{
boolean sendMessage = false;
List<Entity> entities = player.getNearbyEntities(10, 10, 10);
if (entities.size() > 0)
{
for (Entity entity : entities)
{
if (entity != null && entity instanceof Tameable)
{
Tameable tameable = (Tameable) entity;
if (! tameable.isTamed())
{
tameable.setOwner(player);
sendMessage = true;
}
}
}
}
if (sendMessage)
{
player.sendMessage(plugin.getPrefix() + FormatUtil.format(plugin.getMessage("tame_bomb")));
}
}
}
}
}