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) { for (Block block : xp) {
if (!mcMMO.placeStore.isTrue(block)) { 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 player The player to award XP to
* @param block The block to award XP for * @param block The block to award XP for
*/ */
public static void miningXP(Player player, Block block) { protected static void miningXP(Player player, PlayerProfile profile, Block block, Material type) {
PlayerProfile profile = Users.getProfile(player);
Material type = block.getType();
int xp = 0; int xp = 0;
switch (type) { switch (type) {

View File

@ -44,4 +44,8 @@ public class MiningBlockEventHandler {
Mining.miningDrops(block, blockLocation, blockType); 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; return;
} }
Mining.miningXP(player, block); MiningBlockEventHandler eventHandler = new MiningBlockEventHandler(this, block);
eventHandler.processXP();
if (!Permissions.miningDoubleDrops(player)) { if (!Permissions.miningDoubleDrops(player)) {
return; return;
} }
MiningBlockEventHandler eventHandler = new MiningBlockEventHandler(this, block);
int randomChance = 100; int randomChance = 100;
if (Permissions.luckyMining(player)) { if (Permissions.luckyMining(player)) {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
@ -63,4 +63,8 @@ public class MiningManager {
protected Player getPlayer() { protected Player getPlayer() {
return player; return player;
} }
protected PlayerProfile getProfile() {
return profile;
}
} }