All changes up to 0.7.5, fixed herbalism mainly.

This commit is contained in:
nossr50 2011-02-24 01:37:19 -08:00
parent f875f1d1c0
commit 0d208a6f1b
4 changed files with 25 additions and 21 deletions

View File

@ -1,5 +1,8 @@
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 0.7.5
Removed random checks for herbalism XP
Herbalism is now called properly (This should fix gaining no xp or double drops)
Version 0.7.4 Version 0.7.4
Work around for a bukkit bug that broke my onBlockDamage event Work around for a bukkit bug that broke my onBlockDamage event
Added /clearmyspawn Added /clearmyspawn

View File

@ -48,6 +48,13 @@ public class mcBlockListener extends BlockListener {
int type = block.getTypeId(); int type = block.getTypeId();
Location loc = block.getLocation(); Location loc = block.getLocation();
int dmg = event.getDamageLevel().getLevel(); int dmg = event.getDamageLevel().getLevel();
/*
* HERBALISM
*/
if(dmg == 3){
if(mcPermissions.getInstance().herbalism(player))
mcm.getInstance().herbalismProcCheck(block, player);
}
/* /*
* MINING * MINING
*/ */
@ -57,8 +64,7 @@ public class mcBlockListener extends BlockListener {
/* /*
* WOOD CUTTING * WOOD CUTTING
*/ */
if(block.getTypeId() == 17 if(block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){
&& mcPermissions.getInstance().woodcutting(player)){
mcm.getInstance().woodCuttingProcCheck(player, block, loc); mcm.getInstance().woodCuttingProcCheck(player, block, loc);
mcUsers.getProfile(player).addWoodcuttingGather(2); mcUsers.getProfile(player).addWoodcuttingGather(2);
} }
@ -67,12 +73,6 @@ public class mcBlockListener extends BlockListener {
*/ */
if(mcPermissions.getInstance().excavation(player) && block != null && player != null) if(mcPermissions.getInstance().excavation(player) && block != null && player != null)
mcm.getInstance().excavationProcCheck(block, player); mcm.getInstance().excavationProcCheck(block, player);
/*
* HERBALISM
*/
if(!(type == 39 || type == 40 || type == 37 || type == 38)
&& mcPermissions.getInstance().herbalism(player));
mcm.getInstance().herbalismProcCheck(block, player); //You place the blocks so we wont check if they are being watched
/* /*
* EXPLOIT COUNTERMEASURES * EXPLOIT COUNTERMEASURES
*/ */

View File

@ -1508,21 +1508,11 @@ public class mcm {
Location loc = block.getLocation(); Location loc = block.getLocation();
ItemStack is = null; ItemStack is = null;
Material mat = null; Material mat = null;
if(!mcConfig.getInstance().isBlockWatched(block)){ //player.sendMessage("mcMMO DEBUG: Data ("+block.getData()+")"+" TYPEID ("+block.getTypeId()+")");
if(type == 39 || type == 40){
mcUsers.getProfile(player).addHerbalismGather(20);
}
if(type == 37 || type == 38){
if(Math.random() * 10 > 8){
mcUsers.getProfile(player).addHerbalismGather(2);
}
}
if(type == 59 && block.getData() == (byte) 0x7){ if(type == 59 && block.getData() == (byte) 0x7){
mat = Material.getMaterial(296); mat = Material.getMaterial(296);
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(Math.random() * 100 > 80){
mcUsers.getProfile(player).addHerbalismGather(3); mcUsers.getProfile(player).addHerbalismGather(3);
}
if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){ if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){
if(Math.random() * 10 > 8) if(Math.random() * 10 > 8)
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
@ -1540,6 +1530,18 @@ public class mcm {
loc.getWorld().dropItemNaturally(loc, is); loc.getWorld().dropItemNaturally(loc, is);
} }
} }
/*
* We need to check not-wheat stuff for if it was placed by the player or not
*/
if(!mcConfig.getInstance().isBlockWatched(block)){
//player.sendMessage("DEBUG CODE 2");
if(type == 39 || type == 40){
mcUsers.getProfile(player).addHerbalismGather(20);
}
if(type == 37 || type == 38){
mcUsers.getProfile(player).addHerbalismGather(2);
}
}
if(mcUsers.getProfile(player).getHerbalismGatherInt() >= (mcUsers.getProfile(player).getHerbalismInt() + 5) * mcLoadProperties.xpmodifier){ if(mcUsers.getProfile(player).getHerbalismGatherInt() >= (mcUsers.getProfile(player).getHerbalismInt() + 5) * mcLoadProperties.xpmodifier){
int skillups = 0; int skillups = 0;
while(mcUsers.getProfile(player).getHerbalismGatherInt() >= (mcUsers.getProfile(player).getHerbalismInt() +5) * mcLoadProperties.xpmodifier){ while(mcUsers.getProfile(player).getHerbalismGatherInt() >= (mcUsers.getProfile(player).getHerbalismInt() +5) * mcLoadProperties.xpmodifier){
@ -1549,7 +1551,6 @@ public class mcm {
} }
player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")"); player.sendMessage(ChatColor.YELLOW+"Herbalism skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(player).getHerbalism()+")");
} }
}
} }
public void excavationProcCheck(Block block, Player player){ public void excavationProcCheck(Block block, Player player){
int type = block.getTypeId(); int type = block.getTypeId();

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 0.7.4 version: 0.7.5