Two small things I need help with.

Discussion in 'Spigot Plugin Development' started by VinexAx789, Jun 17, 2015.

  1. LandMine Part: What I want to do is make a "ssssssssss" sound when a player steps on the landmine then the explosion will be delayed for 1 second then explode who ever places the land mine it shouldn't hurt them nor there teammates I have four teams red team, green team, blue team then purple team I also do not want it damaging blocks just players it should almost kill them too but not the team that uses it.

    LandMine Code:

    Code (Java):
        private List<Location> mines = new ArrayList<Location>();
       
        @EventHandler
        public void onActivate(final PlayerInteractEvent event) {
            final Player p = event.getPlayer();
            if(event.getAction().equals(Action.PHYSICAL)) {
                if(event.getClickedBlock().getType().equals(Material.STONE_PLATE)) {
                    if(mines.contains(event.getClickedBlock().getLocation())) {
                        event.getClickedBlock().setType(Material.AIR);
                        mines.remove(event.getClickedBlock().getLocation());
                        Bukkit.getScheduler().scheduleSyncDelayedTask(
                                Bukkit.getPluginManager().getPlugin(
                                        "MyTestPlugin"), new Runnable() {
                            public void run(){
                                p.playSound(p.getLocation(), Sound.FUSE, 50F, 50F);
                                event.getClickedBlock().getWorld().createExplosion(event.getClickedBlock().getLocation(), 2, false);
                            }
                        },1L);
                    }
                }
            }
        }
       
            @EventHandler
            public void onPlaceMine(BlockPlaceEvent event) {
                if(event.getBlock().getType().equals(Material.STONE_PLATE)) {
                    mines.add(event.getBlock().getLocation());
                    event.getPlayer().sendMessage(ChatColor.YELLOW + "You have placed a" + ChatColor.RED + " landmine!");
                }
            }
    Team Players Code:

    I use this to sort who gets certain things.

    Code (Java):
        ArrayList<Player> redplayers = new ArrayList<Player>();
        ArrayList<Player> greenplayers = new ArrayList<Player>();
        ArrayList<Player> blueplayers = new ArrayList<Player>();
        ArrayList<Player> purpleplayers = new ArrayList<Player>();
       
    Pyro Kit: So I have a small issue when a bow with flame 2 is shot at tnt it turns into primed and blows up so I can't have that happen so what I need to do is make it so when a player gets hit with an arrow from kit pyro they get fire on them for the amount of time the fire ticks stay on so this is what I did.

    Pyro Code:

    Code (Java):
        @EventHandler
        public void onEntityDamageByEntity11(EntityDamageByEntityEvent event) {
            Entity entity = event.getDamager();
            if ((entity instanceof Arrow)) {
                Arrow arrow = (Arrow) entity;
                Entity shooter = arrow.getShooter();
                if(kitselected.get(arrow).equals("pyro")){
                if ((shooter instanceof Player)) {
                        Entity entity1 = event.getEntity();
                        if (players.contains(((Player) shooter).getPlayer().getName())) {
                            entity1.setFireTicks(80);
                        }

                    }
                }
    Please help me fix my buggy code thanks!


     
  2. Well, what is the problem? Any errors?
     
  3. Sorry lol the problems are when a player with the kit pyro shoots a player it doesn't light them on fire. Now with the land mines I need help making it not damage the player nor it's teammates or damage blocks just do hearts damage so when a player steps on the landmine it makes a hissing noise then after a second kaboom! So it's delayed.
     
  4. Just let me know if you can help me out.