Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.jet315.prisonmines;
- public class JetsPrisonMinesAPI {
- /**
- * Mine manager
- */
- @Inject
- private MineManager mineManager;
- @Inject
- private Properties properties;
- @Inject
- private Messages messages;
- @Inject
- private HologramManager hologramManager;
- @Inject
- public JetsPrisonMinesAPI(){}
- /**
- *
- * @return Returns the properties of the plugin
- */
- public Properties getProperties(){ return this.properties; }
- /**
- *
- * @return Returns the properties of the plugin
- */
- public MineManager getMineManager(){ return this.mineManager; }
- /**
- *
- * @return All current active mines
- */
- public Collection<Mine> getMines(){
- return mineManager.getActiveMines().values();
- }
- /**
- *
- * @param block The block at the location you are searching for mines for
- * @return A mine arraylist of mines that contain this block location
- */
- public ArrayList<Mine> getMinesByBlock(Block block){
- return mineManager.getMinesByBlock(block);
- }
- /**
- *
- * @param loc The location at which you are searching for mines for
- * @return A mine arraylist of mines that contain this location
- */
- public ArrayList<Mine> getMinesByLocation(Location loc){
- return mineManager.getMinesByLocation(loc);
- }
- /**
- * @param mineName The mine you are trying to get
- * @return The mine object, or null if it does not exist
- */
- public Mine getMineByName(String mineName) {
- return mineManager.getMineByName(mineName);
- }
- /**
- * This method should be called if you are removing a block from a certain/possible mine (it will locate the mine automatically)
- * @param block The block that is being broken
- */
- public void blockBreak(Block block){
- mineManager.blockBreak(block);
- }
- /**
- * This method should be called if you are removing a block from a certain/possible mine (it will locate the mine automatically)
- * @param blocks The blocks that is being broken
- */
- public void blockBreak(List<Block> blocks){
- mineManager.breakBlocks(blocks);
- }
- /**
- * This method should be called if you are placing a block to a certain/possible mine (it will locate the mine automatically)
- * @param block The block that is being placed
- */
- public void blockPlace(Block block){
- mineManager.blockPlace(block);
- }
- /**
- *
- * @return False if mine failed to create, true otherwise
- */
- public boolean createMine(String mineName, Location min, Location max){
- //check if mine name is already in use
- if (mineManager.doesMineNameExist(mineName)) {
- return false;
- }
- MineRegion mineRegion = new MineRegion(min, max);
- Mine mine = new Mine(mineName, ((JetsPrisonMines) Bukkit.getPluginManager().getPlugin("JetsPrisonMines")), messages, mineRegion, false,properties,hologramManager);
- mine.save();
- mineManager.addActiveMine(mine);
- return true;
- }
- /**
- *
- * @param mineName
- * @return Whether mine is resetting
- */
- public boolean isMineResetting(String mineName){
- return isMineResetting(getMineByName(mineName));
- }
- /**
- *
- * @param mine
- * @return Whether mine is resetting
- */
- public boolean isMineResetting(Mine mine) {
- if (mine == null) return false;
- return mine.getResetManager().isResetting();
- }
- /**
- * Add block to mine
- */
- public void addBlockToMine(Mine mine, ItemStack item, float chance){
- mine.getBlockManager().modifyBlockChanceInRegion(item,chance);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment