Guest User

Untitled

a guest
Apr 26th, 2020
2,829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. package me.jet315.prisonmines;
  2.  
  3. public class JetsPrisonMinesAPI {
  4.  
  5. /**
  6. * Mine manager
  7. */
  8. @Inject
  9. private MineManager mineManager;
  10. @Inject
  11. private Properties properties;
  12. @Inject
  13. private Messages messages;
  14. @Inject
  15. private HologramManager hologramManager;
  16.  
  17. @Inject
  18. public JetsPrisonMinesAPI(){}
  19.  
  20.  
  21. /**
  22. *
  23. * @return Returns the properties of the plugin
  24. */
  25. public Properties getProperties(){ return this.properties; }
  26.  
  27. /**
  28. *
  29. * @return Returns the properties of the plugin
  30. */
  31. public MineManager getMineManager(){ return this.mineManager; }
  32.  
  33.  
  34. /**
  35. *
  36. * @return All current active mines
  37. */
  38. public Collection<Mine> getMines(){
  39. return mineManager.getActiveMines().values();
  40. }
  41.  
  42. /**
  43. *
  44. * @param block The block at the location you are searching for mines for
  45. * @return A mine arraylist of mines that contain this block location
  46. */
  47. public ArrayList<Mine> getMinesByBlock(Block block){
  48. return mineManager.getMinesByBlock(block);
  49. }
  50. /**
  51. *
  52. * @param loc The location at which you are searching for mines for
  53. * @return A mine arraylist of mines that contain this location
  54. */
  55. public ArrayList<Mine> getMinesByLocation(Location loc){
  56. return mineManager.getMinesByLocation(loc);
  57. }
  58.  
  59. /**
  60. * @param mineName The mine you are trying to get
  61. * @return The mine object, or null if it does not exist
  62. */
  63. public Mine getMineByName(String mineName) {
  64. return mineManager.getMineByName(mineName);
  65. }
  66.  
  67. /**
  68. * This method should be called if you are removing a block from a certain/possible mine (it will locate the mine automatically)
  69. * @param block The block that is being broken
  70. */
  71. public void blockBreak(Block block){
  72. mineManager.blockBreak(block);
  73. }
  74. /**
  75. * This method should be called if you are removing a block from a certain/possible mine (it will locate the mine automatically)
  76. * @param blocks The blocks that is being broken
  77. */
  78. public void blockBreak(List<Block> blocks){
  79. mineManager.breakBlocks(blocks);
  80. }
  81. /**
  82. * This method should be called if you are placing a block to a certain/possible mine (it will locate the mine automatically)
  83. * @param block The block that is being placed
  84. */
  85. public void blockPlace(Block block){
  86. mineManager.blockPlace(block);
  87. }
  88.  
  89. /**
  90. *
  91. * @return False if mine failed to create, true otherwise
  92. */
  93. public boolean createMine(String mineName, Location min, Location max){
  94. //check if mine name is already in use
  95. if (mineManager.doesMineNameExist(mineName)) {
  96. return false;
  97. }
  98.  
  99. MineRegion mineRegion = new MineRegion(min, max);
  100. Mine mine = new Mine(mineName, ((JetsPrisonMines) Bukkit.getPluginManager().getPlugin("JetsPrisonMines")), messages, mineRegion, false,properties,hologramManager);
  101. mine.save();
  102. mineManager.addActiveMine(mine);
  103. return true;
  104. }
  105.  
  106. /**
  107. *
  108. * @param mineName
  109. * @return Whether mine is resetting
  110. */
  111. public boolean isMineResetting(String mineName){
  112. return isMineResetting(getMineByName(mineName));
  113. }
  114.  
  115. /**
  116. *
  117. * @param mine
  118. * @return Whether mine is resetting
  119. */
  120. public boolean isMineResetting(Mine mine) {
  121. if (mine == null) return false;
  122. return mine.getResetManager().isResetting();
  123. }
  124.  
  125. /**
  126. * Add block to mine
  127. */
  128.  
  129. public void addBlockToMine(Mine mine, ItemStack item, float chance){
  130. mine.getBlockManager().modifyBlockChanceInRegion(item,chance);
  131. }
  132.  
  133. }
Advertisement
Add Comment
Please, Sign In to add comment