Started moving stuff from mcBlockListener into their respective skill

files.
This commit is contained in:
gmcferrin 2012-02-04 00:22:10 -05:00
parent 3d401ac4cb
commit 3e62697567
3 changed files with 37 additions and 29 deletions

View File

@ -1,7 +1,7 @@
Changelog: Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code #Versions without changelogs probably had very small misc fixes, like tweaks to the source code
Version 1.2.10 Version 2.0-dev
Version 1.2.09 Version 1.2.09
- Fixed issue with Repair Mastery (Issue #47) - Fixed issue with Repair Mastery (Issue #47)

View File

@ -157,6 +157,7 @@ public class mcBlockListener implements Listener
/* /*
* MINING * MINING
*/ */
if(mcPermissions.getInstance().mining(player)) if(mcPermissions.getInstance().mining(player))
{ {
if(LoadProperties.miningrequirespickaxe) if(LoadProperties.miningrequirespickaxe)
@ -170,47 +171,24 @@ public class mcBlockListener implements Listener
Mining.miningBlockCheck(player, block, plugin); Mining.miningBlockCheck(player, block, plugin);
} }
} }
/* /*
* WOOD CUTTING * WOOD CUTTING
*/ */
if(player != null && block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)) if(mcPermissions.getInstance().woodcutting(player))
{ {
if(LoadProperties.woodcuttingrequiresaxe) if(LoadProperties.woodcuttingrequiresaxe)
{ {
if(m.isAxes(inhand)) if(m.isAxes(inhand))
{ {
if(!plugin.misc.blockWatchList.contains(block)) WoodCutting.woodcuttingBlockCheck(player, block, plugin);
{
WoodCutting.woodCuttingProcCheck(player, block);
//Default
if(block.getData() == (byte)0)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine, player);
//Spruce
if(block.getData() == (byte)1)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce, player);
//Birch
if(block.getData() == (byte)2)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch, player);
}
} }
} else } else
{ {
if(!plugin.misc.blockWatchList.contains(block)) WoodCutting.woodcuttingBlockCheck(player, block, plugin);
{
WoodCutting.woodCuttingProcCheck(player, block);
//Default
if(block.getData() == (byte)0)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mpine, player);
//Spruce
if(block.getData() == (byte)1)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mspruce, player);
//Birch
if(block.getData() == (byte)2)
PP.addXP(SkillType.WOODCUTTING, LoadProperties.mbirch, player);
} }
}
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
/* /*
* IF PLAYER IS USING TREEFELLER * IF PLAYER IS USING TREEFELLER

View File

@ -166,4 +166,34 @@ public class WoodCutting
isdone = false; isdone = false;
} }
} }
public static void woodcuttingBlockCheck(Player player, Block block, mcMMO plugin)
{
PlayerProfile PP = Users.getProfile(player);
int xp = 0;
byte data = block.getData();
if(plugin.misc.blockWatchList.contains(block))
return;
switch(data)
{
case 0:
xp += LoadProperties.mpine;
break;
case 1:
xp += LoadProperties.mspruce;
break;
case 2:
xp += LoadProperties.mbirch;
break;
}
if(block.getTypeId() == 17)
WoodCutting.woodCuttingProcCheck(player, block);
PP.addXP(SkillType.WOODCUTTING, xp, player);
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
}
}
} }