Java Code Examples for org.bukkit.metadata.MetadataValue#getOwningPlugin()
The following examples show how to use
org.bukkit.metadata.MetadataValue#getOwningPlugin() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Game.java From HeavySpleef with GNU General Public License v3.0 | 6 votes |
public void onPlayerTeleport(PlayerTeleportEvent event, SpleefPlayer player) { Player bukkitPlayer = player.getBukkitPlayer(); if (bukkitPlayer.hasMetadata(SpleefPlayer.ALLOW_NEXT_TELEPORT_KEY)) { List<MetadataValue> values = bukkitPlayer.getMetadata(SpleefPlayer.ALLOW_NEXT_TELEPORT_KEY); for (MetadataValue value : values) { if (value.getOwningPlugin() != heavySpleef.getPlugin()) { continue; } if (value.asBoolean()) { return; } } } event.setCancelled(true); }
Example 2
Source File: FlagBowspleef.java From HeavySpleef with GNU General Public License v3.0 | 6 votes |
private void cancelBowSpleefEntityEvent(Entity entity, Cancellable cancellable) { boolean isBowspleefEntity = false; List<MetadataValue> metadatas = entity.getMetadata(BOWSPLEEF_METADATA_KEY); for (MetadataValue value : metadatas) { if (value.getOwningPlugin() != getHeavySpleef().getPlugin()) { continue; } isBowspleefEntity = value.asBoolean(); } if (isBowspleefEntity) { entity.remove(); cancellable.setCancelled(true); } }
Example 3
Source File: MainListener.java From ArmorStandTools with MIT License | 5 votes |
private boolean noCooldown(Entity e) { for(MetadataValue meta : e.getMetadata("lastDrop")) { if(meta.getOwningPlugin() == plugin) { return System.currentTimeMillis() - meta.asFloat() > 100; } } return true; }
Example 4
Source File: Main.java From ArmorStandTools with MIT License | 5 votes |
void returnArmorStand(ArmorStand as) { if(as.hasMetadata("startLoc")) { for (MetadataValue value : as.getMetadata("startLoc")) { if (value.getOwningPlugin() == this) { as.teleport((Location) value.value()); as.removeMetadata("startLoc", this); return; } } } as.remove(); }
Example 5
Source File: FlagSplegg.java From HeavySpleef with GNU General Public License v3.0 | 5 votes |
@EventHandler public void onEntityExplode(EntityExplodeEvent event) { Entity entity = event.getEntity(); Game game = null; List<MetadataValue> metadatas = entity.getMetadata(TNT_METADATA_KEY); for (MetadataValue value : metadatas) { if (value.getOwningPlugin() != getHeavySpleef().getPlugin()) { continue; } game = (Game) value.value(); } if (game != null) { List<Block> blocks = event.blockList(); for (Block block : blocks) { if (!game.canSpleef(block)) { continue; } block.setType(Material.AIR); } blocks.clear(); } }