Fiz esse codigo faz um tempo, e desisti de continuar ;-;
Quem quiser continuar e fazer um plugin de terreno sem problemas.
public static void criarterreno(int tamanho , final Player p) {
for(int x = 0; x < tamanho; x++) {
for(int y = 0; y < 1; y++) {
for(int z = 0; z < tamanho; z++) {
Block x1 = p.getLocation().clone().add(x, y, z).getBlock();
x1.setType(Material.getMaterial(85));
}
}
}
for(int x = 1; x < tamanho - 1; x++) {
for(int y = 0; y < 1; y++) {
for(int z = 1; z < tamanho - 1; z++) {
Block x1 = p.getLocation().clone().add(x, y, z).getBlock();
x1.setType(Material.AIR);
Vector terrenotodo = Vector.toBlockPoint(x1.getX(), x1.getY(), x1.getZ());
Vector terrenotopo = Vector.toBlockPoint(x1.getX() - tamanho + 3, x1.getY() + 256, x1.getZ() - tamanho + 3);
ProtectedCuboidRegion region = new ProtectedCuboidRegion("Terreno_de_" + p.getName(),new BlockVector(terrenotodo),new BlockVector(terrenotopo));
DefaultDomain owners = new DefaultDomain();
owners.addPlayer(getWorldGuard().wrapPlayer(p));
region.setOwners(owners);
getWorldGuard().getRegionManager(p.getWorld()).addRegion(region);
}
}
}
}
Função:
- Cria um terreno em volta com o tamanho desejado e automaticamente seta o bloco como Cerca;
- Protege automaticamente ( WorldGuard API )
- SE VOCE USAR ESSE CODIGO NO PLUGIN DE TERRENO, DE OS CREDITOS =D -q
- =D
Acho q n ta na area certa(so acho)