Guest User

Untitled

a guest
Oct 3rd, 2014
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. String item = "";
  2. if (stack.hasItemMeta())
  3. {
  4. item = stack.getItemMeta().getDisplayName();
  5. }
  6. else
  7. {
  8. String[] stringArray = stack.getType()
  9. .toString().split("_");
  10. for (int i = 0; i < stringArray.length; i++)
  11. {
  12. item = item +
  13. stringArray[i].charAt(0) +
  14. stringArray[i].substring(1)
  15. .toLowerCase() + (
  16. i == stringArray.length - 1 ? "" :
  17. " ");
  18. }
  19. }
  20.  
  21. CHANGED TO
  22.  
  23. String item = "";
  24. if (stack.hasItemMeta())
  25. {
  26. if (stack.getItemMeta().getDisplayName() != null)
  27. {
  28. item = stack.getItemMeta().getDisplayName();
  29. }
  30. else
  31. {
  32. String[] stringArray = stack.getType()
  33. .toString().split("_");
  34. for (int i = 0; i < stringArray.length; i++)
  35. {
  36. item = item +
  37. stringArray[i].charAt(0) +
  38. stringArray[i].substring(1)
  39. .toLowerCase() + (
  40. i == stringArray.length - 1 ? "" :
  41. " ");
  42. }
  43. }
  44. }
  45. else
  46. {
  47. String[] stringArray = stack.getType()
  48. .toString().split("_");
  49. for (int i = 0; i < stringArray.length; i++)
  50. {
  51. item = item +
  52. stringArray[i].charAt(0) +
  53. stringArray[i].substring(1)
  54. .toLowerCase() + (
  55. i == stringArray.length - 1 ? "" :
  56. " ");
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment