BlockChecks.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package com.gmail.nossr50;
  2. import org.bukkit.Material;
  3. import com.gmail.nossr50.config.LoadProperties;
  4. public class BlockChecks {
  5. /**
  6. * Checks to see if a block type awards XP.
  7. *
  8. * @param material The type of Block to check
  9. * @return true if the block type awards XP, false otherwise
  10. */
  11. public static boolean shouldBeWatched(Material material) {
  12. switch (material) {
  13. case BROWN_MUSHROOM:
  14. case CACTUS:
  15. case CLAY:
  16. case COAL_ORE:
  17. case DIAMOND_ORE:
  18. case DIRT:
  19. case ENDER_STONE:
  20. case GLOWING_REDSTONE_ORE:
  21. case GLOWSTONE:
  22. case GOLD_ORE:
  23. case GRASS:
  24. case GRAVEL:
  25. case IRON_ORE:
  26. case JACK_O_LANTERN:
  27. case LAPIS_ORE:
  28. case LOG:
  29. case MELON_BLOCK:
  30. case MOSSY_COBBLESTONE:
  31. case MYCEL:
  32. case NETHERRACK:
  33. case OBSIDIAN:
  34. case PUMPKIN:
  35. case RED_MUSHROOM:
  36. case RED_ROSE:
  37. case REDSTONE_ORE:
  38. case SAND:
  39. case SANDSTONE:
  40. case SOUL_SAND:
  41. case STONE:
  42. case SUGAR_CANE_BLOCK:
  43. case VINE:
  44. case WATER_LILY:
  45. case YELLOW_FLOWER:
  46. return true;
  47. default:
  48. return false;
  49. }
  50. }
  51. /**
  52. * Check if a block should allow for the activation of abilities.
  53. *
  54. * @param material The type of Block to check
  55. * @return true if the block should allow ability activation, false otherwise
  56. */
  57. public static boolean abilityBlockCheck(Material material) {
  58. switch (material) {
  59. case BED_BLOCK:
  60. case BREWING_STAND:
  61. case BOOKSHELF:
  62. case BURNING_FURNACE:
  63. case CAKE_BLOCK:
  64. case CHEST:
  65. case DISPENSER:
  66. case ENCHANTMENT_TABLE:
  67. case FENCE_GATE:
  68. case FURNACE:
  69. case IRON_DOOR_BLOCK:
  70. case JUKEBOX:
  71. case LEVER:
  72. case NOTE_BLOCK:
  73. case STONE_BUTTON:
  74. case TRAP_DOOR:
  75. case WALL_SIGN:
  76. case WOODEN_DOOR:
  77. case WORKBENCH:
  78. return false;
  79. default:
  80. break;
  81. }
  82. if (Material.getMaterial(LoadProperties.anvilID).equals(material)) {
  83. return false;
  84. }
  85. else {
  86. return true;
  87. }
  88. }
  89. /**
  90. * Check if a block type is an ore.
  91. *
  92. * @param material The type of Block to check
  93. * @return true if the Block is an ore, false otherwise
  94. */
  95. public static boolean isOre(Material material) {
  96. switch (material) {
  97. case COAL_ORE:
  98. case DIAMOND_ORE:
  99. case GLOWING_REDSTONE_ORE:
  100. case GOLD_ORE:
  101. case IRON_ORE:
  102. case LAPIS_ORE:
  103. case REDSTONE_ORE:
  104. return true;
  105. default:
  106. return false;
  107. }
  108. }
  109. }