コード例 #1
0
ファイル: HumanNPC.java プロジェクト: MiniDigger/Dragons-Lair
 public void startAttacking(final LivingEntity e) {
   if (this.attackingID != -1) this.stopAttacking();
   this.attackingID =
       Bukkit.getScheduler()
           .scheduleSyncRepeatingTask(
               DragonsLairMain.getInstance(), new NPCAttackTask(this, e), 0, 10L);
 }
コード例 #2
0
  // @EventHandler(priority = EventPriority.NORMAL)
  public void explodingArrow(ProjectileHitEvent event) {
    Entity projectile = event.getEntity();
    World w = projectile.getWorld();
    Location hit = projectile.getLocation();

    if (w.getName().equals(name)) {

      if (projectile instanceof Arrow) {
        Arrow arrow = (Arrow) projectile;
        Entity shooter = arrow.getShooter();
        Location l = shooter.getLocation();
        Block bl = l.getBlock();
        Block b = bl.getRelative(BlockFace.DOWN, 2);
        Material mat = b.getType();

        if (shooter instanceof Player) {
          Player p = (Player) shooter;
          ItemStack is = p.getItemInHand();
          Material i = is.getType();
          if (i == Material.BOW && mat == Material.SPONGE) {
            p.getInventory().removeItem(new ItemStack(Material.ARROW, 20));
            w.createExplosion(hit, 8);
            int strikes = 0;
            while (strikes < 20) {
              strikes++;
              w.strikeLightning(hit);
            }
          }
          Bukkit.getWorld(name).playEffect(arrow.getLocation(), Effect.STEP_SOUND, 10);
        }
      }
    }
  }
コード例 #3
0
  /** Creates a new server. */
  public GlowServer(ServerConfig config) {
    this.config = config;
    // stuff based on selected config directory
    opsList = new UuidListFile(config.getFile("ops.json"));
    whitelist = new UuidListFile(config.getFile("whitelist.json"));
    nameBans = new GlowBanList(this, BanList.Type.NAME);
    ipBans = new GlowBanList(this, BanList.Type.IP);

    Bukkit.setServer(this);
    loadConfig();
  }
コード例 #4
0
ファイル: HumanNPC.java プロジェクト: MiniDigger/Dragons-Lair
 public SpoutPlayer getSpoutPlayer() {
   try {
     Class.forName("org.getspout.spout.Spout");
     if (!(this.getEntity().getBukkitEntity() instanceof SpoutCraftPlayer))
       ((NPCEntity) this.getEntity())
           .setBukkitEntity(
               new SpoutCraftPlayer(
                   (CraftServer) Bukkit.getServer(), (EntityPlayer) this.getEntity()));
     return (SpoutPlayer) this.getEntity().getBukkitEntity();
   } catch (final ClassNotFoundException e) {
     return null;
   }
 }
コード例 #5
0
ファイル: HumanNPC.java プロジェクト: MiniDigger/Dragons-Lair
 public void stopAttacking() {
   if (this.attackingID != -1) Bukkit.getScheduler().cancelTask(this.attackingID);
 }