コード例 #1
0
 @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
 public void onPaintingBreak(PaintingBreakEvent event) {
   // TODO: Should we fire a left click before firing the painting break?
   OccurredEvent drop = new OccurredEvent(event);
   Log.logInfo("PaintingBreak drop occurance created. (" + drop.toString() + ")", HIGHEST);
   parent.sectionManager.performDrop(drop);
 }
コード例 #2
0
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onEntityDeath(EntityDeathEvent event) {
    // TODO: use get getLastDamageCause rather than checking on each
    // getdamage?
    Log.logInfo(
        "*** OnEntityDeath, before checks (victim: " + event.getEntity().toString() + ")", HIGHEST);
    Entity entity = event.getEntity();

    // If there's no damage record, ignore
    if (entity.getLastDamageCause() == null) {
      Log.logWarning(
          "OnEntityDeath: entity " + entity.toString() + " has no 'lastDamageCause'.", HIGH);
      return;
    }

    OccurredEvent drop = new OccurredEvent(event);
    Log.logInfo("EntityDeath drop occurance created. (" + drop.toString() + ")", HIGHEST);
    parent.sectionManager.performDrop(drop);
  }
コード例 #3
0
  @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
  public void onEntityExplode(EntityExplodeEvent event) {
    // TODO: Why was this commented out?
    if (!parent.config.customDropsForExplosions) return;
    if (event.isCancelled()) return;

    // Disable certain types of drops temporarily since they can cause
    // feedback loops
    // Note: This will disable ALL plugins that create explosions in the
    // same way as the explosion event
    if (event.getEntity() == null) {
      Log.logInfo("EntityExplode - no entity found, skipping.", HIGHEST);
      return; // skip recursive explosions, for now (explosion event has
      // no entity) TODO: add an option?
    }

    // TODO: add a config item to enable enderdragon explosions if people
    // want to use it with v.low chance drops
    if (event.getEntity() instanceof EnderDragon)
      return; // Enderdragon explosion drops will lag out the server....

    Log.logInfo("Processing explosion...", HIGHEST);
    parent.sectionManager.performDrop(new OccurredEvent(event, event.getEntity()));

    Log.logInfo(
        "EntityExplode occurance detected - drop occurences will be created for each block.",
        HIGHEST);

    List<Block> blockListCopy = new ArrayList<Block>();
    blockListCopy.addAll(event.blockList());

    for (Block block : blockListCopy) {
      OccurredEvent drop = new OccurredEvent(event, block);
      parent.sectionManager.performDrop(drop);
      if (drop.isDenied()) event.blockList().remove(block);
    }
  }