2 Questions (new API?)

Discussion in 'Plugin Development' started by xDjBomber, Feb 24, 2014.

Thread Status:
Not open for further replies.
  1. Code:
    (e.getClickedBlock().getTypeId() == Material.SIGN.getId()) || (e.getClickedBlock().getTypeId() == Material.SIGN_POST.getId()) || (e.getClickedBlock().getTypeId() == Material.WALL_SIGN.getId())))
     
     
    p.getInventory().setChestplate(new ItemStack(chest));
    Why this lines giving me errors now? (Latest Craftbukkit.jar - updated the Build path today from 1.6.2 to 1.6.4)

    Anyone can me say how to fix that?
     
  2. Offline

    ThePlayerPaul

    What's the error?
     

  3. Ich sehe du sprichst Deutsch, das ist ja kein Error es sind nur Warnings, dass .getTypeID(); nicht mehr existiert etc.

    /

    Just warnings, no errors -> .getTypeID(); undefined
     
  4. Offline

    ThePlayerPaul

    Also solang es nur gelb unterstrichen ist, kannst du es noch benutzen.
     
  5. Offline

    qlimax5000

    You're doing too much, just do:

    (e.getClickedBlock().getType() == Material.SIGN) || (e.getClickedBlock().getType() == Material.SIGN_POST) || (e.getClickedBlock().getType() == Material.WALL_SIGN)))
     
  6. It works, thank you.

    Maybe you know what it with this?

    Code:
    p.getInventory().setChestplate(new ItemStack(chest));
    ItemStack warnings
     
  7. Offline

    qlimax5000

    xDjBomber
    What warnings? A workaround would be p.getInventory().setItem(38, chest);
    Slots:
    Boots - 36
    Leggins - 37
    Chestplates - 38
    Helmets - 39
    I think. let me know
     
  8. Code:
                        
    int chest = this.plugin.getConfig().getInt("EasyPVP.PVPArmor.Chest");
    p.getInventory().setChestplate(new ItemStack(chest));
    It was with config, won't work since i updated the craftbukkit.jar in the Java Build Path

    The constructor ItemStack(int) is deprecated <- This is the warning
     
  9. Offline

    qlimax5000

    xDjBomber
    Using numeric IDs for items will get removed, you should use name instead. But for now just put @SuppressWarnings("deprecation") above
     

  10. IDK but it says: Unnecessary @SuppressWarnings("deprecation")
     
  11. Offline

    desht

    Yeah, and also get rid of the "(e.getClickedBlock().getType() == Material.SIGN)" part, because it is completely useless. Material.SIGN is for the sign item and will never match a block type, which will always be either SIGN_POST or WALL_SIGN.
     
Thread Status:
Not open for further replies.

Share This Page