org.bukkit.event.block.BlockDispenseEntityEvent Java Examples

The following examples show how to use org.bukkit.event.block.BlockDispenseEntityEvent. 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: TNTTracker.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDispense(BlockDispenseEntityEvent event) {
  if (event.getEntity() instanceof TNTPrimed) {
    ParticipantState owner = blocks().getOwner(event.getBlock());
    if (owner != null) {
      entities()
          .trackEntity(event.getEntity(), new TNTInfo(owner, event.getEntity().getLocation()));
    }
  }
}
 
Example #2
Source File: OwnedMobTracker.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onMobDispense(BlockDispenseEntityEvent event) {
  if (event.getEntity() instanceof LivingEntity) {
    ParticipantState owner = blocks().getOwner(event.getBlock());
    if (owner != null) {
      entities()
          .trackEntity(event.getEntity(), new MobInfo((LivingEntity) event.getEntity(), owner));
    }
  }
}
 
Example #3
Source File: TNTTracker.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDispense(BlockDispenseEntityEvent event) {
    if(event.getEntity() instanceof TNTPrimed) {
        ParticipantState owner = blocks().getOwner(event.getBlock());
        if(owner != null) {
            entities().trackEntity(event.getEntity(), new TNTInfo(owner, event.getEntity().getLocation()));
        }
    }
}
 
Example #4
Source File: OwnedMobTracker.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onMobDispense(BlockDispenseEntityEvent event) {
    if(event.getEntity() instanceof LivingEntity) {
        ParticipantState owner = blocks().getOwner(event.getBlock());
        if(owner != null) {
            entities().trackEntity(event.getEntity(), new MobInfo((LivingEntity) event.getEntity(), owner));
        }
    }
}
 
Example #5
Source File: TntTracker.java    From CardinalPGM with MIT License 5 votes vote down vote up
@EventHandler
public void onEntityDispense(BlockDispenseEntityEvent event){
    if (event.getBlock().getType() == Material.DISPENSER){
        if (event.getEntity().getType() == EntityType.PRIMED_TNT) {
            Location location = event.getBlock().getLocation();
            if (dispenserPlaced.containsKey(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ())) {
                UUID player = dispenserPlaced.get(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ());
                event.getEntity().setMetadata("source", new FixedMetadataValue(GameHandler.getGameHandler().getPlugin(), player));
            }
        }
    }
}
 
Example #6
Source File: WorldFreeze.java    From CardinalPGM with MIT License 4 votes vote down vote up
@EventHandler
public void onBlockDispense(BlockDispenseEntityEvent event) {
    if (!match.isRunning()) {
        event.setCancelled(true);
    }
}