How to generate a wall in front of player? Where player is facing?

Discussion in 'Plugin Development' started by darknoneee, May 9, 2023.

Thread Status:
Not open for further replies.
  1. Offline

    darknoneee

    Hello everyone, i want to generate a wall in front of player, where it is facing, so i don't know how can i do it. Does anyone can help me? Here is my code:


    Code:
                        double x1 = p.getLocation().getX();
                        double y1 = p.getLocation().getY();
                        double z1 = p.getLocation().getZ();
                       
    
                        double x;
                        double y;
                        double z;
                        for (x = x1; x < x1 + 7; x++) {
                            for (y = y1; y < y1 + 2; y++) {
                                for (z = z1; z < z1 + 1; z++) {
                                    Location loc = new Location(p.getWorld(), x, y, z);
                                    Block b = loc.getBlock();
                                    b.setType(Material.PORTAL);
                                    warderPortal.add(b);
                                    b.getWorld().playEffect(b.getLocation(), Effect.PORTAL, 4);
    
                                    Bukkit.getScheduler().scheduleSyncDelayedTask(kHungerBukkit.getInstance(),
                                            new Runnable() {
    
                                                @Override
                                                public void run() {
                                                    b.setType(Material.AIR);
                                                }
                                            }, 5 * 20);
     
  2. Offline

    KarimAKL

Thread Status:
Not open for further replies.

Share This Page