-
-
Notifications
You must be signed in to change notification settings - Fork 6
API Mine Factory
UntouchedOdin0 edited this page Jan 24, 2022
·
4 revisions
First of all you're going to need to get the Private Mines Factory instance by using
MineFactory mineFactory = privateMinesAPI().getMineFactory();
You'd also need the Storage by using
MineStorage mineStorage = privateMines.getMineStorage();
Then to get a WorldEditMineType object of which you'd pass through the
WorldEditMineType worldEditMineType = privateMinesAPI.getWorldEditMineType("name");
This'll then give you a WorldEditMineType object of which you can pass through in the mine factory.
You can then use this to do
Player target;
Location location;
mineFactory.createMine(target, location, worldEditMineType, replaceOld? true / false);
And then it should create and add your new mine to the storage, but if you want to do a check to make sure they have a mine already you can do
if (mineStorage.hasWorldEditMine(target.getUniqueId())) {
privateMines.getLogger().info("Player already has a mine!");
return;
} else {
mineFactory.createMine(target, location, worldEditMineType, false);
}
}