本文整理了Java中org.bukkit.entity.Entity.setMetadata()
方法的一些代码示例,展示了Entity.setMetadata()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.setMetadata()
方法的具体详情如下:
包路径:org.bukkit.entity.Entity
类名称:Entity
方法名:setMetadata
暂无
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public void setMetadata(String arg0, MetadataValue arg1) {
base.setMetadata(arg0, arg1);
}
代码示例来源:origin: bergerkiller/BKCommonLib
public void setMetadata(String arg0, MetadataValue arg1) {
entity.setMetadata(arg0, arg1);
}
代码示例来源:origin: elBukkit/MagicPlugin
public static void track(Plugin plugin, Entity tracked) {
tracked.setMetadata("tracking", new FixedMetadataValue(plugin, true));
}
代码示例来源:origin: elBukkit/MagicPlugin
public static boolean checkTracking(Plugin plugin, Entity tracked, Entity target, Block block) {
if (tracked == null || !tracked.hasMetadata("tracking")) {
return false;
}
if (target != null) {
tracked.setMetadata("hit", new FixedMetadataValue(plugin, new WeakReference<>(target)));
} else if (!tracked.hasMetadata("hit")) {
tracked.setMetadata("hit", new FixedMetadataValue(plugin, block));
}
return true;
}
代码示例来源:origin: elBukkit/MagicPlugin
public static void setUndoList(Plugin plugin, Entity entity, com.elmakers.mine.bukkit.api.block.UndoList list) {
if (entity != null) {
if (list != null) {
entity.setMetadata("MagicBlockList", new FixedMetadataValue(plugin, list));
} else {
entity.removeMetadata("MagicBlockList", plugin);
}
}
}
代码示例来源:origin: elBukkit/MagicPlugin
@Override
public void add(Entity entity)
{
if (entity == null) return;
if (entities == null) entities = new HashSet<>();
if (worldName != null && !entity.getWorld().getName().equals(worldName)) return;
entities.add(entity);
if (this.isScheduled()) {
entity.setMetadata("temporary", new FixedMetadataValue(plugin, true));
}
watch(entity);
contain(entity.getLocation().toVector());
modifiedTime = System.currentTimeMillis();
}
代码示例来源:origin: BigScary/GriefPrevention
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onFallingBlockEnterPortal(EntityPortalEnterEvent event)
{
if (event.getEntityType() != EntityType.FALLING_BLOCK)
return;
event.getEntity().setMetadata("GP_FELLTHROUGHPORTAL", new FixedMetadataValue(GriefPrevention.instance, true));
}
代码示例来源:origin: NyaaCat/RPGItems-reloaded
@EventHandler
public void onBowShoot(EntityShootBowEvent e) {
e.getProjectile().setMetadata("rpgitems.force", new FixedMetadataValue(plugin, e.getForce()));
}
代码示例来源:origin: elBukkit/MagicPlugin
@Nullable
@Override
public Entity undo() {
Entity entity = this.getEntity();
// Re-spawn if dead or missing
if (respawn && !isTemporary && uuid != null && (entity == null || !entity.isValid() || entity.isDead()) && !(entity instanceof Player)) {
// Avoid re-re-spawning an entity
WeakReference<Entity> respawnedEntity = respawned.get(uuid);
if (respawnedEntity != null) {
entity = respawnedEntity.get();
} else {
entity = trySpawn(null, null);
if (entity != null) {
respawned.put(uuid, new WeakReference<>(entity));
// Undo'ing an entity won't drop loot
entity.setMetadata("nodrops", new FixedMetadataValue(MagicPlugin.getAPI().getPlugin(), true));
}
}
setEntity(entity);
} else if (entity != null) {
modify(entity);
}
return entity;
}
代码示例来源:origin: CitizensDev/CitizensAPI
@Override
public void set(String key, Object data) {
super.set(key, data);
if (getEntity() != null) {
getEntity().setMetadata(key, new FixedMetadataValue(CitizensAPI.getPlugin(), data));
}
}
代码示例来源:origin: CitizensDev/CitizensAPI
@Override
public void setPersistent(String key, Object data) {
super.setPersistent(key, data);
if (getEntity() != null) {
getEntity().setMetadata(key, new FixedMetadataValue(CitizensAPI.getPlugin(), data));
}
}
};
代码示例来源:origin: mcMMO-Dev/mcMMO
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityShootBow(EntityShootBowEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
if(event.getEntity() instanceof Player)
{
Player player = (Player) event.getEntity();
/* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded())
{
if(!WorldGuardManager.getInstance().hasMainFlag(player))
return;
}
}
Entity projectile = event.getProjectile();
if (!(projectile instanceof Arrow)) {
return;
}
ItemStack bow = event.getBow();
if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
}
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
}
代码示例来源:origin: elBukkit/MagicPlugin
mount.setMetadata("notarget", new FixedMetadataValue(context.getController().getPlugin(), true));
entity.setMetadata("notarget", new FixedMetadataValue(context.getController().getPlugin(), true));
代码示例来源:origin: mcMMO-Dev/mcMMO
/**
* Monitor CreatureSpawn events.
*
* @param event
* The event to watch
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onCreatureSpawn(CreatureSpawnEvent event) {
/* WORLD BLACKLIST CHECK */
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
return;
LivingEntity entity = event.getEntity();
switch (event.getSpawnReason()) {
case NETHER_PORTAL:
case SPAWNER:
case SPAWNER_EGG:
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
Entity passenger = entity.getPassenger();
if (passenger != null) {
passenger.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
}
return;
case BREEDING:
entity.setMetadata(mcMMO.bredMetadataKey, mcMMO.metadataValue);
return;
default:
return;
}
}
代码示例来源: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: NyaaCat/RPGItems-reloaded
if (e != player) {
if (e instanceof ItemFrame || e instanceof Painting) {
e.setMetadata("RPGItems.Rumble", new FixedMetadataValue(RPGItems.plugin, null)); // Add metadata to protect hanging entities from the explosion
continue;
代码示例来源:origin: InventivetalentDev/AnimatedFrames
itemFrameUUIDs[x1][y1] = entity.getUniqueId();
entity.setMetadata("ANIMATED_FRAMES_META", new FixedMetadataValue(plugin, AnimatedFrame.this));
代码示例来源:origin: Co0sh/BetonQuest
entity.setMetadata("betonquest-drops-" + j,
new FixedMetadataValue(BetonQuest.getInstance(), item.getID().getFullID() + ":"
+ item.getAmount().getInt(playerID)));
entity.setMetadata("betonquest-marked", new FixedMetadataValue(BetonQuest.getInstance(), marked));
代码示例来源:origin: AddstarMC/Minigames
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
private void physicalBlock(EntityChangeBlockEvent event)
{
if(hasRegenArea() && blockInRegenArea(event.getBlock().getLocation()))
{
if(minigame.isRegenerating()){
event.setCancelled(true);
return;
}
if(event.getTo() == Material.SAND ||
event.getTo() == Material.GRAVEL ||
event.getTo() == Material.DRAGON_EGG ||
event.getTo() == Material.ANVIL)
{
if(minigame.hasPlayers() || event.getEntity().hasMetadata("FellInMinigame"))
{
addEntity(event.getEntity(), null, true);
}
}
else if(event.getEntityType() == EntityType.FALLING_BLOCK && minigame.hasPlayers())
{
event.getEntity().setMetadata("FellInMinigame", new FixedMetadataValue(Minigames.getPlugin(), true));
addEntity(event.getEntity(), null, true);
}
}
}
代码示例来源:origin: mcMMO-Dev/mcMMO
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
内容来源于网络,如有侵权,请联系作者删除!