when boots are equipped and you are not in creative this will return null, if boots are equipped and

Discussion in 'Plugin Development' started by GigabyteDX, Dec 12, 2013.

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

    GigabyteDX

    when boots are equipped and you are not in creative this will return null, if boots are equipped and your are in creative it will work. Any ideas?

    Code:java
    1. try {
    2. ItemStack is = player.getInventory().getBoots();
    3. System.out.println("BOOTS ARE" + is);
    4. switch (is.getItemMeta().getDisplayName()) {
    5.  
    6. case "Boots of Speed":
    7. if (player.getInventory().getBoots().equals(is))
    8. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 99999, 0));
    9. break;
    10. default:
    11. break;
    12. }
    13. } catch (NullPointerException e) {
    14. DebugAndNotification.sendDebugInfo("Nullpointer fired because armor slot is null");
    15. }
    16. }
     
  2. Offline

    LarsNitro

    Code:java
    1. if (player.getGameMode().equals(GameMode.CREATIVE))) {
    2.  
    3. //dostuff
    4.  
    5. }
    6.  
    7.  
     
Thread Status:
Not open for further replies.

Share This Page