Ir para conteúdo
  • 0

[Resolvido] cuboid + Blocos


LuizB

Pergunta

2 respostass a esta questão

Posts Recomendados

https://bukkit.org/threads/protection-region-cuboid-creation.164161/


Nao vou explicar pois estou meio ocupado



FileConfiguration configpos = Main.getMain().GetConfig("posicoes");
FileConfiguration configpos2 = Main.getMain().GetConfig("posicoes2");


@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
public void onPlayerInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (e.getItem() != null) {
if (e.getItem().getType() == Material.GOLD_AXE) {

configpos.set("Pos1.X" , e.getClickedBlock().getX());
configpos.set("Pos1.Y" , e.getClickedBlock().getY());
configpos.set("Pos1.Z" , e.getClickedBlock().getZ());
configpos.set("Pos1.Mundo" , p.getWorld().getName());
Main.getMain().SaveConfig("posicoes");
p.sendMessage("§2Posicao 1 setada em: §aX: " + e.getClickedBlock().getX() + " §aY: " + e.getClickedBlock().getY() + " Z: " + e.getClickedBlock().getZ());

}
}
} else if (e.getAction() == Action.LEFT_CLICK_BLOCK){
if (e.getItem() != null) {
if (e.getItem().getType() == Material.GOLD_AXE) {

configpos2.set("Pos2.X" , e.getClickedBlock().getX());
configpos2.set("Pos2.Y" , e.getClickedBlock().getY());
configpos2.set("Pos2.Z" , e.getClickedBlock().getZ());
configpos2.set("Pos2.Mundo" , p.getWorld().getName());
Main.getMain().SaveConfig("posicoes2");
p.sendMessage("§2Posicao 2 setada em: §aX: " + e.getClickedBlock().getX() + " §aY: " + e.getClickedBlock().getY() + " Z: " + e.getClickedBlock().getZ());

}
}
}
}



Location loc1 = new Location(
Bukkit.getWorld(configpos.getString("Pos1.Mundo")),
configpos.getDouble("Pos1.X"),
configpos.getDouble("Pos1.Y"),
configpos.getDouble("Pos1.Z"));

Location loc2 = new Location(
Bukkit.getServer().getWorld(configpos2.getString("Pos2.Mundo")),
configpos2.getDouble("Pos2.X"),
configpos2.getDouble("Pos2.Y"),
configpos2.getDouble("Pos2.Z"));

Cuboid cuboid = new Cuboid(loc1, loc2);
for (Block block : cuboid)
block.setType(Material.getMaterial(7));
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...