Problem with metadata

Discussion in 'Plugin Development' started by tom_tomi14, Sep 25, 2014.

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

    tom_tomi14

    Please can anyone help with the metadata? This code doesnt work and I dont know why ;/


    [/CODE]
    Code:
    final FallingBlock b = ps.getPlayer().getWorld().spawnFallingBlock(loc, Material.DISPENSER, blockData
    b.setMetadata("1500", new FixedMetadataValue(this, b));
    


    [/CODE]

    Code:
    @EventHandler
    public void onInterg(PlayerInteractEvent e){
    Player x = e.getPlayer();
     
    Block target = x.getTargetBlock(null, 6);
     
    if(target.getType() == Material.DISPENSER){
    if(e.getAction() == Action.LEFT_CLICK_BLOCK){
    if(target.hasMetadata("1500")){
     
    x.sendMessage("§c§l1400§4/§c§l1500");
     
    target.setMetadata("1400", new FixedMetadataValue(this, target));
     
    }
    if(target.hasMetadata("1400")){
     
    x.sendMessage("§c§l1300§4/§c§l1500");
     
    target.setMetadata("1300", new FixedMetadataValue(this, target));
    }
     
  2. Offline

    adam753

    tom_tomi14
    Clean up the formatting, please. Paste things into a notepad file and then copy them out of there to remove the colours and fonts you get from Eclipse, and after that, put code in [syntax=java][/syntax] tags.
     
  3. Offline

    CoolGuy2001

    Please use the code tool!
     
Thread Status:
Not open for further replies.

Share This Page