org.bukkit.event.entity.EntityDespawnInVoidEvent Java Examples

The following examples show how to use org.bukkit.event.entity.EntityDespawnInVoidEvent. 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: RaindropListener.java    From ProjectAres with GNU Affero General Public License v3.0 6 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR)
public void handleItemDespawn(final EntityDespawnInVoidEvent event) {
    Entity entity = event.getEntity();
    if (!(entity instanceof Item)) return;
    ItemStack stack = ((Item) entity).getItemStack();

    PlayerId playerId = this.droppedWools.remove(entity);
    if (playerId == null) return;

    ParticipantState player = PGM.getMatchManager().getParticipantState(playerId);
    if (player == null) return;

    if(isDestroyableWool(stack, player.getParty())) {
        giveWoolDestroyRaindrops(player, ((Wool) stack.getData()).getColor());
    }
}
 
Example #2
Source File: Snowflakes.java    From CardinalPGM with MIT License 5 votes vote down vote up
@EventHandler
public void onItemDespawnInVoid(EntityDespawnInVoidEvent event) {
    if (!(event.getEntity() instanceof Item) || !event.getEntity().hasMetadata(ITEM_THROWER_META)) return;
    Player player = Bukkit.getPlayer((UUID) event.getEntity().getMetadata(ITEM_THROWER_META).get(0).value());
    Item item = (Item) event.getEntity();
    if (testDestroy(player, item.getItemStack())) {
        addDestroyed(player, ((Wool) item.getItemStack().getData()).getColor());
    }
}
 
Example #3
Source File: BlockDropsMatchModule.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockFallInVoid(EntityDespawnInVoidEvent event) {
  if (event.getEntity() instanceof FallingBlock) {
    this.fallingBlocksThatWillNotLand.remove(event.getEntity());
  }
}
 
Example #4
Source File: BlockDropsMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockFallInVoid(EntityDespawnInVoidEvent event) {
    if(event.getEntity() instanceof FallingBlock) {
        this.fallingBlocksThatWillNotLand.remove(event.getEntity());
    }
}