本文整理了Java中org.bukkit.entity.Entity.getMetadata()
方法的一些代码示例,展示了Entity.getMetadata()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getMetadata()
方法的具体详情如下:
包路径:org.bukkit.entity.Entity
类名称:Entity
方法名:getMetadata
暂无
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public List<MetadataValue> getMetadata(String arg0) {
return base.getMetadata(arg0);
}
代码示例来源:origin: bergerkiller/BKCommonLib
public List<MetadataValue> getMetadata(String arg0) {
return entity.getMetadata(arg0);
}
代码示例来源:origin: elBukkit/MagicPlugin
@Override
public boolean isVanished(Entity entity) {
if (entity == null) return false;
for (MetadataValue meta : entity.getMetadata("vanished")) {
return meta.asBoolean();
}
return false;
}
代码示例来源:origin: mcMMO-Dev/mcMMO
/**
* Calculate bonus XP awarded for Archery when hitting a far-away target.
*
* @param target The {@link LivingEntity} damaged by the arrow
* @param damager The {@link Entity} who shot the arrow
*/
public void distanceXpBonus(LivingEntity target, Entity damager) {
Location firedLocation = (Location) damager.getMetadata(mcMMO.arrowDistanceKey).get(0).value();
Location targetLocation = target.getLocation();
if (firedLocation.getWorld() != targetLocation.getWorld()) {
return;
}
applyXpGain((int) (Math.min(firedLocation.distanceSquared(targetLocation), 2500) * Archery.DISTANCE_XP_MULTIPLIER), getXPGainReason(target, damager));
}
代码示例来源:origin: Co0sh/BetonQuest
@Override
public void run(String playerID) throws QuestRuntimeException {
Location location = loc.getLocation(playerID);
final double radius_squared = this.radius.getDouble(playerID) * this.radius.getDouble(playerID);
location
.getWorld()
.getEntitiesByClass(type.getEntityClass())
.stream()
//get only nearby entities
.filter(entity -> entity.getLocation().distanceSquared(location) <= radius_squared)
//only entities with given name
.filter(entity -> {
if (name == null) return true;
return name.equals(entity.getName());
})
//only entities marked
.filter(entity -> {
if (marked == null) return true;
return entity
.getMetadata("betonquest-marked")
.stream()
.anyMatch(metadataValue -> metadataValue.asString().equals(marked));
})
//remove them
.forEach(Entity::remove);
}
}
代码示例来源:origin: elBukkit/MagicPlugin
@Nullable
public static com.elmakers.mine.bukkit.api.block.UndoList getUndoList(Entity entity) {
com.elmakers.mine.bukkit.api.block.UndoList blockList = null;
if (entity != null && entity.hasMetadata("MagicBlockList")) {
List<MetadataValue> values = entity.getMetadata("MagicBlockList");
for (MetadataValue metadataValue : values) {
Object value = metadataValue.value();
if (value instanceof com.elmakers.mine.bukkit.api.block.UndoList) {
blockList = (com.elmakers.mine.bukkit.api.block.UndoList)value;
}
}
} else if (entity != null && entity instanceof FallingBlock) {
// Falling blocks need to check their location to handle chain reaction effects
Location entityLocation = entity.getLocation();
blockList = getUndoList(entityLocation);
if (blockList == null) {
// Check one block down as well, in case a spell removed the block underneath a falling block
entityLocation.setY(entityLocation.getY() - 1);
blockList = getUndoList(entityLocation);
}
}
return blockList;
}
代码示例来源:origin: NyaaCat/RPGItems-reloaded
damage *= damager.getMetadata("rpgitems.force").get(0).asFloat();
代码示例来源:origin: Co0sh/BetonQuest
return false;
List<MetadataValue> meta = entity.getMetadata("betonquest-marked");
for (MetadataValue m : meta) {
if (!m.asString().equals(marked)) {
代码示例来源:origin: Co0sh/BetonQuest
continue;
List<MetadataValue> meta = entity.getMetadata("betonquest-marked");
for (MetadataValue m : meta) {
if (!m.asString().equals(marked)) {
代码示例来源:origin: Co0sh/BetonQuest
return;
List<MetadataValue> meta = event.getEntity().getMetadata("betonquest-marked");
for (MetadataValue m : meta) {
if (!m.asString().equals(marked)) {
代码示例来源:origin: Co0sh/BetonQuest
continue;
List<MetadataValue> meta = entity.getMetadata("betonquest-marked");
for (MetadataValue m : meta) {
if (!m.asString().equals(marked)) {
代码示例来源:origin: mcMMO-Dev/mcMMO
/**
* Monitor falling blocks.
*
* @param event The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onFallingBlock(EntityChangeBlockEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
return;
if (BlockUtils.shouldBeWatched(event.getBlock().getState()) && event.getEntityType().equals(EntityType.FALLING_BLOCK)) {
if (event.getTo().equals(Material.AIR) && mcMMO.getPlaceStore().isTrue(event.getBlock())) {
event.getEntity().setMetadata("mcMMOBlockFall", new FixedMetadataValue( plugin, event.getBlock().getLocation()));
} else {
List<MetadataValue> values = event.getEntity().getMetadata( "mcMMOBlockFall" );
if (!values.isEmpty()) {
if (values.get(0).value() == null) return;
Block spawn = ((org.bukkit.Location) values.get(0).value()).getBlock();
mcMMO.getPlaceStore().setTrue( event.getBlock() );
mcMMO.getPlaceStore().setFalse( spawn );
}
}
}
}
代码示例来源:origin: ProjectKorra/ProjectKorra
final EarthGrab eg = (EarthGrab) event.getRightClicked().getMetadata("earthgrab:trap").get(0).value();
eg.damageTrap();
event.setCancelled(true);
代码示例来源:origin: mcMMO-Dev/mcMMO
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
代码示例来源:origin: ProjectKorra/ProjectKorra
final CoreAbility ability = (CoreAbility) e.getDamager().getMetadata("movement:stop").get(0).value();
if (!(ability instanceof EarthGrab)) {
e.setCancelled(true);
代码示例来源:origin: mcMMO-Dev/mcMMO
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
代码示例来源:origin: libraryaddict/LibsDisguises
if (!entity.getMetadata("LibsRabbitHop").isEmpty()) {
lastHop = System.currentTimeMillis() - entity.getMetadata("LibsRabbitHop").get(0).asLong();
代码示例来源:origin: elBukkit/MagicPlugin
Block targetBlock = null;
Location targetLocation = entity.getLocation();
List<MetadataValue> metadata = entity.getMetadata("hit");
for (MetadataValue value : metadata) {
if (value.getOwningPlugin().equals(plugin)) {
代码示例来源:origin: mcMMO-Dev/mcMMO
List<MetadataValue> metadataValue = attacker.getMetadata("mcMMO_oldName");
内容来源于网络,如有侵权,请联系作者删除!