コード例 #1
0
ファイル: RainbowClay.java プロジェクト: JoniMega/Minicat
 @Override
 protected void onBlockHitByProjectile(ProjectileHitEvent evt, Block b, Projectile proj) {
   // TODO Auto-generated method stub
   super.onBlockHitByProjectile(evt, b, proj);
   // sendGlobalMessage("Pilotassa");
   Material t = b.getType();
   if (t == Material.GLASS
       || t == Material.STAINED_GLASS
       || t == Material.STAINED_GLASS_PANE
       || t == Material.THIN_GLASS
       || t == Material.GLOWSTONE) {
     b.setType(Material.AIR);
     getWorld().playSound(b.getLocation(), Sound.GLASS, 15F, 1.2F);
     proj.remove();
     for (BlockFace f : BlockFace.values()) {
       if (GUtils.Possibilitat(58)) continue;
       Block relative = b.getRelative(f);
       t = relative.getType();
       if (t == Material.GLASS
           || t == Material.STAINED_GLASS
           || t == Material.STAINED_GLASS_PANE
           || t == Material.THIN_GLASS
           || t == Material.GLOWSTONE) {
         relative.setType(Material.AIR);
       }
     }
   }
 }
コード例 #2
0
ファイル: RainbowClay.java プロジェクト: JoniMega/Minicat
  @Override
  protected void onBlockBreak(BlockBreakEvent evt, Block blk) {
    // TODO Auto-generated method stub
    super.onBlockBreak(evt, blk);
    Player ply = evt.getPlayer();

    Cuboid cub = pMapaActual().ObtenirCuboid("RegC", getWorld());
    if (cub.contains(blk)) {
      evt.setCancelled(true);
    }
    if (blk.getType() != Material.HARD_CLAY && blk.getData() != 11) {
      //			if(blk.getType() == Material.BEACON){
      //				for (Objectiu obj : obtenirObjectiusPly(ply)){
      //
      //	//Bukkit.broadcastMessage(Double.toString(obj.getLocation().distance(blk.getLocation())));
      //					if (obj.getLocation().distance(blk.getLocation()) < 2){
      //						obj.complete(ply);
      //
      //					}
      //
      //				}
      //			}else{
      //
      //			}
      //			//Bukkit.broadcastMessage("Retard!");
    } else {
      evt.setCancelled(true);
    }
  }
コード例 #3
0
ファイル: RainbowClay.java プロジェクト: JoniMega/Minicat
 @Override
 protected void onBlockPlace(BlockPlaceEvent evt, Block blk) {
   // TODO Auto-generated method stub
   super.onBlockPlace(evt, blk);
   Player ply = evt.getPlayer();
   // Bukkit.broadcastMessage(Boolean.toString(evt.isCancelled()));
   Cuboid cub = pMapaActual().ObtenirCuboid("RegC", getWorld());
   if (cub.contains(blk)) {
     evt.setCancelled(true);
   }
   if (blk.getType() == Material.OBSIDIAN) {
     evt.setCancelled(true);
     evt.getPlayer().damage(15);
   }
   //		if (blk.getType() == Material.WOOL){
   //
   //			for (Objectiu obj : obtenirObjectiusPly(ply)){
   //				Bukkit.broadcastMessage(Double.toString(obj.getLocation().distance(blk.getLocation())));
   //				if (obj.getLocation().distance(blk.getLocation()) < 2){
   //					Wool wool = new Wool(DyeColor.getByWoolData(blk.getData()));
   //	    			Location blkLoc = blk.getLocation();
   //	    			if(wool.getColor().getWoolData() == ((DyeColor) obj.getInfo()).getWoolData()){
   //	    				obj.complete(ply);
   //	    			}else{
   //	    				evt.setCancelled(true);
   //	    			}
   //
   //				}
   //
   //			}
   //		}
 }
コード例 #4
0
ファイル: RainbowClay.java プロジェクト: JoniMega/Minicat
 @Override
 protected void customJocIniciat() {
   super.customJocIniciat();
   setBlockBreakPlace(true);
   setGiveStartingItemsRespawn(true);
   ProgTask();
 }
コード例 #5
0
ファイル: RainbowClay.java プロジェクト: JoniMega/Minicat
 @Override
 protected void onCreatureSpawn(CreatureSpawnEvent evt) {
   // TODO Auto-generated method stub
   super.onCreatureSpawn(evt);
   if (evt.getEntityType() == EntityType.GHAST) {
     evt.getEntity().setMaxHealth(350);
   }
 }
コード例 #6
0
ファイル: RainbowClay.java プロジェクト: JoniMega/Minicat
 @Override
 protected void donarEfectesInicials(Player ply) {
   // TODO Auto-generated method stub
   super.donarEfectesInicials(ply);
   double m = getBalancingMultiplier(obtenirEquip(ply));
   ply.addPotionEffect(
       new PotionEffect(PotionEffectType.ABSORPTION, (int) (30 * 10 * (m - 0.5)), 5, true), true);
   ply.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20 * 3, 1, true), true);
   ply.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 20 * 30, 0, true), true);
   ply.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20 * 5, 3, true), true);
   ply.addPotionEffect(
       new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, (int) (20 * 19 * m), 1, true), true);
 }
コード例 #7
0
ファイル: RainbowClay.java プロジェクト: JoniMega/Minicat
  //	@Override
  //	protected void onPlayerDeath(PlayerDeathEvent evt, Player killed) {
  //		// TODO Auto-generated method stub
  //		super.onPlayerDeath(evt, killed);
  //		ArrayList<ItemStack> startingItems = getStartingItems(killed);
  //		evt.getDrops().removeAll(startingItems);
  //		ArrayList<ItemStack> rem = new ArrayList<ItemStack>();
  //		for(ItemStack i : evt.getDrops()){
  //			Material t = i.getType();
  //			boolean cname = false;
  //			if(i.hasItemMeta()){
  //				cname = i.getItemMeta().hasDisplayName();
  //			}
  //			for(ItemStack starti : startingItems){
  //				if (i.getType() == starti.getType()){
  //					ItemStack remi = i.clone();
  //					remi.setAmount(starti.getAmount());
  //					rem.add(remi);
  //				}
  //			}
  //			//			boolean valid = (t == Material.WOOL || t == Material.TNT || t == Material.DIAMOND ||
  // cname);
  //			//			if(valid){
  //			//				rem.add(i);
  //			//			}
  //		}
  //		evt.getDrops().removeAll(rem);
  //		//		evt.getDrops().clear();
  //		//		//evt.getDrops().add(new ItemStack(Material.DIAMOND));
  //		//		evt.getDrops().addAll(rem);
  //
  //	}
  @Override
  protected void onPlayerDeathByPlayer(PlayerDeathEvent evt, Player killed, Player killer) {
    // TODO Auto-generated method stub
    super.onPlayerDeathByPlayer(evt, killed, killer);

    //		double distance = killed.getLocation().distance(killer.getLocation());
    //		boolean lluny = distance > 50;
    //		if (lluny){
    //			evt.setDeathMessage(killed.getName() + " ha estat assassinat per " + killer.getName() + "
    // desde "+ Long.toString(Math.round(distance)) +" blocs");
    //		}
    //		if (!lluny && !isPlayerLookingAtAnother(killed, killer)){
    //			evt.setDeathMessage(killed.getName() + " ha estat assassinat per l'esquena per " +
    // killer.getName());
    //
    //		}

  }
コード例 #8
0
ファイル: RainbowClay.java プロジェクト: JoniMega/Minicat
  @Override
  protected void onPlayerMove(PlayerMoveEvent evt, Player P) {
    // TODO Auto-generated method stub
    super.onPlayerMove(evt, P);
    Player ply = evt.getPlayer();
    if (isSpectator(ply)) return;
    if (JocIniciat) {
      Player plyr = evt.getPlayer();

      Location to = evt.getTo();
      Location from = evt.getFrom();

      int equip = obtenirEquip(ply).getId() + 1;
      if (ply.getLocation().getY() < 102) {
        ply.setFireTicks(5000);
      }
      if (ply.getLocation().getY() < 60) {
        ply.damage(10000);
      }

      // Torres escuts
      int e = 1;
      while (e <= 2) {
        int i = 0;
        while (i <= 1) {
          Cuboid cub =
              pMapaActual()
                  .ObtenirCuboid("RegT" + Integer.toString(e) + Integer.toString(i), getWorld());
          Location center = cub.getCenter();
          if (cub.contains(to.getBlock())) {
            if (e == equip) {
              Vector vec = Utils.CrearVector(center, from).normalize().add(new Vector(0, 1, 0));
              getWorld().playSound(to, Sound.IRONGOLEM_HIT, 1F, 2.2F);
              getWorld().playEffect(to, Effect.MOBSPAWNER_FLAMES, 3);
              getWorld()
                  .playEffect(to.clone().add(new Vector(0, 1, 0)), Effect.MOBSPAWNER_FLAMES, 3);
              if (cub.contains(from.getBlock()) && plyr.getVelocity().length() >= 1) {
                plyr.teleport(from.add(vec));
                // Bukkit.broadcastMessage("ha entrat");
              } else {
                plyr.setVelocity(vec);
              }
              // evt.setCancelled(true);

            }
          }
          i = i + 1;
        }
        e = e + 1;
      }
      // SECURE NO-FALL
      //
      boolean isNoFallActive = false;

      ItemStack itemInHand = ply.getItemInHand();
      if (itemInHand.hasItemMeta()) {
        ItemMeta itemMeta = itemInHand.getItemMeta();
        if (itemMeta.hasDisplayName()) {
          if (itemMeta.getDisplayName().equals(getBridgeToolName())) {
            isNoFallActive = true;
          }
        }
      }

      if (isNoFallActive) {
        Vector v = Utils.CrearVector(evt.getFrom(), evt.getTo());
        v.multiply(1.45D);
        v.setY(0);
        Block bDown = evt.getTo().add(v).getBlock().getRelative(BlockFace.DOWN);
        if (bDown.isEmpty() && bDown.getRelative(BlockFace.DOWN).isEmpty()) {
          ItemStack placeableItemStack = getPlaceableItemStack(ply);
          if (placeableItemStack != null) {
            bDown.setType(placeableItemStack.getType());
            bDown.setData(placeableItemStack.getData().getData());
            ItemStack sampleIt = new ItemStack(placeableItemStack);
            sampleIt.setAmount(1);
            ply.getInventory().removeItem(sampleIt);
            itemInHand.setDurability((short) (itemInHand.getDurability() + 3));
          }
        }
      }
    }
  }
コード例 #9
0
ファイル: RainbowClay.java プロジェクト: JoniMega/Minicat
 @Override
 protected void customJocFinalitzat() {
   super.customJocFinalitzat();
   setBlockBreakPlace(false);
 }