Solved Lapis Lazuli

Discussion in 'Plugin Development' started by klofno1, Jul 21, 2013.

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

    klofno1

    Hi, how do I get lapis lazuli as a material?

    Code:java
    1. ItemStack stackToCheckFor = new ItemStack(Material."lapis", 10);
    2. if(player.getInventory().contains(stackToCheckFor)) {
    3. player.getInventory().remove(stackToCheckFor);


    IS there another way to add lapis lazuli?
     
  2. Offline

    turqmelon

    It'd be Material.INK_SAC, with a data value of 4.
     
  3. Offline

    klofno1

    How do I add a data value correctly? When I add it, it giges me an error it should not be there.
     
  4. Offline

    turqmelon

    ItemStack lapis = new ItemStack(Material.INK_SAC, 1, (byte)4);
    klofno1
     
  5. Offline

    klofno1

    Nothing happens!
    The heal spell should be activated and the lapis should be gone but it does not work

    Code:java
    1. private List<String> cantDoCommand11 =new ArrayList<>();
    2. @EventHandler
    3. public void onInteract11(final AsyncPlayerChatEvent event){
    4.  
    5. if(event.getPlayer().getItemInHand().getType()==Material.BOOK){
    6. Player player = event.getPlayer();
    7. ItemStack stackToCheckFor = new ItemStack(Material.INK_SACK, 1, (byte)4);
    8. if(player.getInventory().contains(stackToCheckFor)) {
    9.  
    10. final String name = player.getName();
    11. final String message = event.getMessage();
    12. if (message.trim().equalsIgnoreCase("Consano")){
    13. if (cantDoCommand11.contains(name)){
    14. event.setCancelled(true);
    15. return;
    16. }
    17. if(player.hasPermission("Venificus.Consano") || player.getPlayer().isOp()){
    18. player.getInventory().remove(stackToCheckFor);
    19. player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 100, 2));
    20. cantDoCommand11.add(name);
    21. new BukkitRunnable(){
    22. @Override
    23. public void run(){
    24. cantDoCommand11.remove(name);
    25. }
    26. }.runTaskLater(plugin, 0);
    27. }
    28. }
    29. }
    30. }
    31. }
     
  6. Offline

    PHILLIPS_71

    Try swap the (byte)4 and the 1 around klofno1
     
  7. Offline

    klofno1

    It is still not working
     
  8. Offline

    turqmelon

    In your code above, you're checking for exactly one of the lapis. Is that what you have as a stack in your inventory? klofno1
     
  9. Offline

    klofno1


    Nope, have a look at my other thread :p.
     
  10. Offline

    turqmelon

    Which "other thread"? You've updated many recently.
     
  11. Offline

    klofno1

    turqmelon

    I am sorry, it does not work! Somehow there is something wrong with selecting 'Lapis lazuli'.
     
Thread Status:
Not open for further replies.

Share This Page