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

Java Guardian类代码示例

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

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



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

示例1: onEntityBendingDeath

import org.bukkit.entity.Guardian; //导入依赖的package包/类
@EventHandler
public void onEntityBendingDeath(EntityBendingDeathEvent event) {
	Entity v = event.getVictim();
	Element e = CoreAbility.getAbility(event.getAbility()).getElement();
	int xp;
	
	if(v == null || e == null)
		return;
	
	if(v instanceof Player) {
		xp = 25 + (int)(Math.random() * ((35 - 25) + 1));
	}
	else if(v instanceof Zombie || v instanceof Creeper || v instanceof Witch || v instanceof Skeleton || v instanceof Guardian || v instanceof Spider) {
		xp = 13 + (int)(Math.random() * ((22 - 13) + 1));
	}
	else {
		xp = 3 + (int)(Math.random() * ((8 - 3) + 1));
	}
	BendingExp.addExp(event.getAttacker(), e, xp);
}
 
开发者ID:savior67,项目名称:BendingExp,代码行数:21,代码来源:DeathByBendingListener.java


示例2: init

import org.bukkit.entity.Guardian; //导入依赖的package包/类
@SuppressWarnings("null")
@Override
protected boolean init(Class<? extends Guardian> c, Guardian e) {
	if(e != null)
		isElder = e.isElder();
	return true;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:8,代码来源:GuardianData.java


示例3: getState

import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
public RequirementState getState() {
	YamlConfiguration myState = new YamlConfiguration();
	
	myState.set("type", "vr");
	
	ConfigurationSection foeSection = myState.createSection("foe");
	foeSection.set("type", foe.getType().name());
	foeSection.set("maxhp", foe.getMaxHealth());
	foeSection.set("hp", foe.getHealth());
	foeSection.set("name", foe.getCustomName());
	foeSection.set("location", foe.getLocation());
	
	if (foe instanceof Guardian) {
		foeSection.set("elder", ((Guardian) foe).isElder());
	}
	
	if (foe instanceof Slime) {
		foeSection.set("size", ((Slime) foe).getSize());
	}
	
	if (foe instanceof Skeleton) {
		foeSection.set("wither", ((Skeleton) foe).getSkeletonType() == SkeletonType.WITHER);
	}
	
	EquipmentConfiguration econ = new EquipmentConfiguration(foe.getEquipment());
	foeSection.set("equipment", econ.getConfiguration());
	
	return new RequirementState(myState);
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:31,代码来源:VanquishRequirement.java


示例4: set

import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
public void set(Guardian entity) {
	if(isElder)
		entity.setElder(true);
	
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:7,代码来源:GuardianData.java


示例5: match

import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
protected boolean match(Guardian entity) {
	return entity.isElder() == isElder;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:5,代码来源:GuardianData.java


示例6: getType

import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
public Class<? extends Guardian> getType() {
	return Guardian.class;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:5,代码来源:GuardianData.java


示例7: activate

import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
public void activate() {
	ConfigurationSection myState = foeStateRecord.getConfig();
	
	//get rid of any entities we already have
	if (foe != null && !foe.isDead()) {
		foe.remove();			
	}
	
	
	ConfigurationSection foeState =  myState.getConfigurationSection("foe");
	Location loc = ((LocationState) foeState.get("location")).getLocation();
	
	//load chunk before creating foe
	loc.getChunk();
	
	foe = (LivingEntity) loc.getWorld().spawnEntity(loc, EntityType.valueOf(foeState.getString("type")));
	this.id = foe.getUniqueId();
	foe.setMaxHealth(foeState.getDouble("maxhp"));
	foe.setHealth(foeState.getDouble("hp"));
	foe.setCustomName(foeState.getString("name"));
	
	foe.setRemoveWhenFarAway(false);
	
	EntityEquipment equipment = foe.getEquipment();
	EquipmentConfiguration econ = new EquipmentConfiguration();
	try {
		econ.load( foeState.getConfigurationSection("equipment"));
	} catch (InvalidConfigurationException e) {
		e.printStackTrace();
	}
	
	equipment.setHelmet(econ.getHead());
	equipment.setChestplate(econ.getChest());
	equipment.setLeggings(econ.getLegs());
	equipment.setBoots(econ.getBoots());
	equipment.setItemInMainHand(econ.getHeldMain());
	equipment.setItemInOffHand(econ.getHeldOff());
	
	//special checks
	if (foe instanceof Guardian) {
		if (foeState.getBoolean("elder", false)) {
			((Guardian) foe).setElder(true);
		}
	}
	
	if (foe instanceof Slime) {
		if (foeState.getInt("size", 1) > 1) {
			((Slime) foe).setSize(foeState.getInt("size"));
		}
	}
	
	if (foe instanceof Skeleton) {
		if (foeState.getBoolean("wither", false)) {
			((Skeleton) foe).setSkeletonType(SkeletonType.WITHER);
		}
	}
	
	if (desc == null) {
		desc = foeState.getString("description", "Slay " + foe.getCustomName());
	}
	
	//add as NPC for non-removal
	foeNPC = new QuestMonsterNPC();
	foeNPC.setEntity(foe);
	
	QuestManagerPlugin.questManagerPlugin.getManager().registerNPC(foeNPC);
	
	update();
	Bukkit.getPluginManager().registerEvents(this, QuestManagerPlugin.questManagerPlugin);
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:72,代码来源:VanquishRequirement.java


示例8: getBukkitEntity

import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
Guardian getBukkitEntity();
 
开发者ID:TechzoneMC,项目名称:SonarPet,代码行数:3,代码来源:IEntityGuardianPet.java


示例9: isElderGuardian

import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
public boolean isElderGuardian(Entity entity)
{
	return entity instanceof Guardian && ((Guardian) entity).isElder();
}
 
开发者ID:dmulloy2,项目名称:SwornAPI,代码行数:6,代码来源:SpecialEntities.java


示例10: AcidTask

import org.bukkit.entity.Guardian; //导入依赖的package包/类
/**
 * Runs repeating tasks to deliver acid damage to mobs, etc.
 * @param plugin
 */
public AcidTask(final ASkyBlock plugin) {
    this.plugin = plugin;
    // Initialize water item list
    itemsInWater = new HashSet<UUID>();
    // This part will kill monsters if they fall into the water
    // because it
    // is acid
    if (Settings.mobAcidDamage > 0D || Settings.animalAcidDamage > 0D) {
        plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
            @Override
            public void run() {
                List<Entity> entList = ASkyBlock.getIslandWorld().getEntities();
                for (Entity current : entList) {
                    if (plugin.isOnePointEight() && current instanceof Guardian) {
                        // Guardians are immune to acid too
                        continue;
                    }
                    if ((current instanceof Monster) && Settings.mobAcidDamage > 0D) {
                        if ((current.getLocation().getBlock().getType() == Material.WATER)
                                || (current.getLocation().getBlock().getType() == Material.STATIONARY_WATER)) {
                            ((Monster) current).damage(Settings.mobAcidDamage);
                            // getLogger().info("Killing monster");
                        }
                    } else if ((current instanceof Animals) && Settings.animalAcidDamage > 0D) {
                        if ((current.getLocation().getBlock().getType() == Material.WATER)
                                || (current.getLocation().getBlock().getType() == Material.STATIONARY_WATER)) {
                            if (!current.getType().equals(EntityType.CHICKEN)) {
                                ((Animals) current).damage(Settings.animalAcidDamage);
                            } else if (Settings.damageChickens) {
                                ((Animals) current).damage(Settings.animalAcidDamage);
                            }
                            // getLogger().info("Killing animal");
                        }
                    }
                }
            }
        }, 0L, 20L);
    }
    runAcidItemRemovalTask();
}
 
开发者ID:tastybento,项目名称:acidisland,代码行数:45,代码来源:AcidTask.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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