本文整理汇总了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);
}
示例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;
}
示例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);
}
示例4: set
import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
public void set(Guardian entity) {
if(isElder)
entity.setElder(true);
}
示例5: match
import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
protected boolean match(Guardian entity) {
return entity.isElder() == isElder;
}
示例6: getType
import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
public Class<? extends Guardian> getType() {
return Guardian.class;
}
示例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);
}
示例8: getBukkitEntity
import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
Guardian getBukkitEntity();
示例9: isElderGuardian
import org.bukkit.entity.Guardian; //导入依赖的package包/类
@Override
public boolean isElderGuardian(Entity entity)
{
return entity instanceof Guardian && ((Guardian) entity).isElder();
}
示例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();
}