More mining restructuring.

This commit is contained in:
gmcferrin 2013-01-08 09:42:37 -05:00
parent 159ec3f04d
commit aee4bcd65e
4 changed files with 13 additions and 8 deletions

View File

@ -178,7 +178,7 @@ public class BlastMining {
for (Block block : xp) {
if (!mcMMO.placeStore.isTrue(block)) {
Mining.miningXP(player, block);
Mining.miningXP(player, Users.getProfile(player), block, block.getType());
}
}
}

View File

@ -38,10 +38,7 @@ public class Mining {
* @param player The player to award XP to
* @param block The block to award XP for
*/
public static void miningXP(Player player, Block block) {
PlayerProfile profile = Users.getProfile(player);
Material type = block.getType();
protected static void miningXP(Player player, PlayerProfile profile, Block block, Material type) {
int xp = 0;
switch (type) {

View File

@ -44,4 +44,8 @@ public class MiningBlockEventHandler {
Mining.miningDrops(block, blockLocation, blockType);
}
}
protected void processXP() {
Mining.miningXP(manager.getPlayer(), manager.getProfile(), block, blockType);
}
}

View File

@ -32,14 +32,14 @@ public class MiningManager {
return;
}
Mining.miningXP(player, block);
MiningBlockEventHandler eventHandler = new MiningBlockEventHandler(this, block);
eventHandler.processXP();
if (!Permissions.miningDoubleDrops(player)) {
return;
}
MiningBlockEventHandler eventHandler = new MiningBlockEventHandler(this, block);
int randomChance = 100;
if (Permissions.luckyMining(player)) {
randomChance = (int) (randomChance * 0.75);
@ -63,4 +63,8 @@ public class MiningManager {
protected Player getPlayer() {
return player;
}
protected PlayerProfile getProfile() {
return profile;
}
}