Ir para conteúdo
  • 0

Dúvida - Item


Daimonte

Pergunta

15 respostass a esta questão

Posts Recomendados

Eu não falei ISSO, eu falei simplesmente que quando eu digitar um comando como:

 

/pedra

Uma pedra ser colocado onde o jogador está!!!

 

player.getLocation().getBlock().setType(Material.STONE);

 

 

No caso enderchest é tipo:

player.getLocation().getBlock().setType(Material.ENDER_CHEST);

Eu já falei, até você já falou..

quer pegar o material pelo comando? Material.valueOf("STONE");

Link para o comentário
Compartilhar em outros sites

Ainda não entendi oq quer :headbang: é bloco ou é item? já falei os 2

Tem servidores,que embaixo do holograma,tem um item flutuando,dropado,embaixo do holograma soq no ar.E n da para pegar este item,e tipo um holograma na loja com um catalogo de blocos e ele qr por uma stone.Resumindo,tipo um holograma soq de item,mas vai ter os 2

Link para o comentário
Compartilhar em outros sites

Achei aqui uma classe

 

 

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
 
public class FlyingItems {
 
        private ArmorStand armorstand;
        private Location location;
        private String text = null;
        private Boolean h = false;
        private ItemStack itemstack;
        private double height = -1.3;

        FlyingItems(){
               
        }
       
        public void setLocation(Location location){
                this.location = location;
        }
       
        public void setText(String text){
                this.text = text;
        }
       
        public void setItemStack(ItemStack itemstack){
                this.itemstack = itemstack;
        }
       
        public void setHeight(double height){
                this.height = height - 1.3;
                if(this.location != null){
                        this.location.setY(this.location.getY() + this.height);
                        h = true;
                }
        }
       
        public void remove(){
                this.location = null;
                this.armorstand.remove();
                this.armorstand.getPassenger().remove();
                this.armorstand = null;
                this.h = false;
                this.height = 0;
                this.text = null;
                this.itemstack = null;
        }
       
        public void teleport(Location location){
                if(this.location != null){
                        armorstand.teleport(location);
                        this.location = location;
                }
        }
       
        public void spawn(){
                if(!h){
                        this.location.setY(this.location.getY()+this.height);
                        h = true;
                }
                armorstand = (ArmorStand)this.location.getWorld().spawn(this.location, ArmorStand.class);
                armorstand.setGravity(false);
                armorstand.setVisible(false);
                Item i = this.location.getWorld().dropItem(this.getLocation(), this.itemstack);
                i.setPickupDelay(2147483647);
                if(this.text != null){
                i.setCustomName(this.text);
                i.setCustomNameVisible(true);
                }
                armorstand.setPassenger(i);
        }
       
        public Location getLocation(){
                return this.location;
        }
       
        public ItemStack getItemStack(){
                return this.itemstack;
        }
       
        public double getHeight(){
                return this.height;
        }
       
        public String getText(){
                return this.text;
        }
       
} 

 

 

FlyingItems fly = new FlyingItems();
                fly.setLocation(location);
                fly.setHeight(0.85);
                fly.setMaterial(Material.WOOD);
                fly.setText("§4Holz §b25$");
                fly.spawn();

Créditos

Link para o comentário
Compartilhar em outros sites

Achei aqui uma classe

 

 

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
 
public class FlyingItems {
 
        private ArmorStand armorstand;
        private Location location;
        private String text = null;
        private Boolean h = false;
        private ItemStack itemstack;
        private double height = -1.3;

        FlyingItems(){
               
        }
       
        public void setLocation(Location location){
                this.location = location;
        }
       
        public void setText(String text){
                this.text = text;
        }
       
        public void setItemStack(ItemStack itemstack){
                this.itemstack = itemstack;
        }
       
        public void setHeight(double height){
                this.height = height - 1.3;
                if(this.location != null){
                        this.location.setY(this.location.getY() + this.height);
                        h = true;
                }
        }
       
        public void remove(){
                this.location = null;
                this.armorstand.remove();
                this.armorstand.getPassenger().remove();
                this.armorstand = null;
                this.h = false;
                this.height = 0;
                this.text = null;
                this.itemstack = null;
        }
       
        public void teleport(Location location){
                if(this.location != null){
                        armorstand.teleport(location);
                        this.location = location;
                }
        }
       
        public void spawn(){
                if(!h){
                        this.location.setY(this.location.getY()+this.height);
                        h = true;
                }
                armorstand = (ArmorStand)this.location.getWorld().spawn(this.location, ArmorStand.class);
                armorstand.setGravity(false);
                armorstand.setVisible(false);
                Item i = this.location.getWorld().dropItem(this.getLocation(), this.itemstack);
                i.setPickupDelay(2147483647);
                if(this.text != null){
                i.setCustomName(this.text);
                i.setCustomNameVisible(true);
                }
                armorstand.setPassenger(i);
        }
       
        public Location getLocation(){
                return this.location;
        }
       
        public ItemStack getItemStack(){
                return this.itemstack;
        }
       
        public double getHeight(){
                return this.height;
        }
       
        public String getText(){
                return this.text;
        }
       
} 

 

 

FlyingItems fly = new FlyingItems();
                fly.setLocation(location);
                fly.setHeight(0.85);
                fly.setMaterial(Material.WOOD);
                fly.setText("§4Holz §b25$");
                fly.spawn();

Créditos

Eu não falei ISSO, eu falei simplesmente que quando eu digitar um comando como:

 

/pedra

Uma pedra ser colocado onde o jogador está!!!

Link para o comentário
Compartilhar em outros sites

Eu não falei ISSO, eu falei simplesmente que quando eu digitar um comando como:

 

/pedra

Uma pedra ser colocado onde o jogador está!!!

Desculpa me intrometer, mas ele já falou como fazer isso:

 

player.getLocation().getBlock().setType(Material.STONE);
Link para o comentário
Compartilhar em outros sites

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