Example #1
0
  @EventHandler(priority = EventPriority.LOW)
  public void mobDeath(EntityDeathEvent event) {
    int length = MCListeners.getSpawnDist();
    LivingEntity mob = event.getEntity();
    Player play = null;

    if (mob.getKiller() instanceof Player) play = mob.getKiller();
    else return;

    if (BlockSpawners.isSpawnerNearby(mob.getLocation(), length) && !MCListeners.isPaySpawner()) {
      //            play.sendMessage("Spawner nearby, not paying.");
      return;
    }

    if (MCListeners.isMultiWorld()) {
      if (!play.hasPermission("mcjobs.world.all")
          && !play.hasPermission("mcjobs.world." + play.getWorld().getName())) return;
    }

    if (play.getGameMode() == GameMode.CREATIVE) {
      if (!play.hasPermission("mcjobs.paycreative")) return;
    }

    //        if(!PlayerJobs.hasJobs(play) && !PlayerJobs.hasDefaultJobs(play))
    //            return;

    Iterator<Map.Entry<String, PlayerJobs>> it = PlayerJobs.getJobsList().entrySet().iterator();
    String sJob = null;

    while (it.hasNext()) {
      Map.Entry<String, PlayerJobs> pair = it.next();
      sJob = pair.getKey();

      if (PlayerCache.hasJob(play.getName(), sJob)) {
        CompCache comp = new CompCache(sJob, mob.getLocation(), play, mob.getType(), "defeat");
        CompData.getCompCache().add(comp);

        //
        // if(PlayerJobs.joblist.get(sJob).getData().compJob().compEntity(mob.getType(), play,
        // "defeat")){
        //                    play.sendMessage("You killed him!");
        //                }
      }
    }
  }
Example #2
0
  @EventHandler(priority = EventPriority.LOW)
  public void fishEvent(PlayerFishEvent event) {
    Player play = event.getPlayer();
    if (event.getCaught() == null) return;

    EntityType fish = event.getCaught().getType();

    if ((MCListeners.isMultiWorld())
        && (!play.hasPermission("mcjobs.world.all"))
        && (!play.hasPermission("mcjobs.world." + play.getWorld().getName()))) return;

    for (Map.Entry<String, PlayerJobs> en : PlayerJobs.getJobsList().entrySet()) {
      if (PlayerCache.hasJob(play.getName(), en.getKey())) {
        CompCache comp = new CompCache(en.getKey(), play.getLocation(), play, fish, "fishing");
        CompData.getCompCache().add(comp);
      }
    }
  }