PlotSquared API

Discussion in 'Plugin Development' started by DavidK1412, Jul 28, 2020.

  1. Offline

    DavidK1412

    Hello!, I want to do a plugin with the plotsquared api (https://github.com/boy0001/PlotSqua...om/intellectualcrafters/plot/api/PlotAPI.java), I want to limit the entitys/armorstands on a plot without flags, but i can't found the journey for this in the api...

    Sorry for the english, but i'm spanish...
    I've tried with this:
    Code:
    public class limitar implements Listener {
    
    
            private Main plugin;
            public limitar(Main plugin){
                    this.plugin = plugin;
            }
    
    
            @EventHandler
            public void PonerBloque(BlockPlaceEvent event){
    
    
    
    
    
                    Player p = event.getPlayer();
                    PlotPlayer plotPlayer = PlotPlayer.wrap(p);
                    Block block = event.getBlock();
                    Plot atPlayer = Plot.getPlot(plotPlayer.getLocation());
    
    
    
    
                    List<Entity> entities = (List<Entity>) atPlayer;
                    int armors = 0;
                    for(Entity entity : entities){
                            if(entity.getType() == EntityType.ARMOR_STAND) {
                                    armors++;
                            }
    
    
    
                    if(block.getType().equals(Material.ARMOR_STAND)){
    
                            if (armors == 5){
    
                                    event.setCancelled(true);
                                    p.sendMessage(ChatColor.AQUA.BOLD + "¬°Ya hay cinco estandartes de armadura en la parcela!");
                                    return;
                            } else {
                            }
    
                    } else {
    
                    }
    
    
            }
    
            }
    }
     
  2. Offline

    DavidK1412

Share This Page