From 0d208a6f1b9014343ff92d2aac399676aed4d429 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 24 Feb 2011 01:37:19 -0800 Subject: [PATCH] All changes up to 0.7.5, fixed herbalism mainly. --- mcMMO/Changelog.txt | 3 +++ mcMMO/com/gmail/nossr50/mcBlockListener.java | 16 ++++++------- mcMMO/com/gmail/nossr50/mcm.java | 25 ++++++++++---------- mcMMO/plugin.yml | 2 +- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 00e3859a1..56a8dd7f6 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,8 @@ Changelog: #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 Work around for a bukkit bug that broke my onBlockDamage event Added /clearmyspawn diff --git a/mcMMO/com/gmail/nossr50/mcBlockListener.java b/mcMMO/com/gmail/nossr50/mcBlockListener.java index 0f60112c5..43c3385af 100644 --- a/mcMMO/com/gmail/nossr50/mcBlockListener.java +++ b/mcMMO/com/gmail/nossr50/mcBlockListener.java @@ -48,6 +48,13 @@ public class mcBlockListener extends BlockListener { int type = block.getTypeId(); Location loc = block.getLocation(); int dmg = event.getDamageLevel().getLevel(); + /* + * HERBALISM + */ + if(dmg == 3){ + if(mcPermissions.getInstance().herbalism(player)) + mcm.getInstance().herbalismProcCheck(block, player); + } /* * MINING */ @@ -57,8 +64,7 @@ public class mcBlockListener extends BlockListener { /* * WOOD CUTTING */ - if(block.getTypeId() == 17 - && mcPermissions.getInstance().woodcutting(player)){ + if(block.getTypeId() == 17 && mcPermissions.getInstance().woodcutting(player)){ mcm.getInstance().woodCuttingProcCheck(player, block, loc); mcUsers.getProfile(player).addWoodcuttingGather(2); } @@ -67,12 +73,6 @@ public class mcBlockListener extends BlockListener { */ if(mcPermissions.getInstance().excavation(player) && block != null && player != null) 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 */ diff --git a/mcMMO/com/gmail/nossr50/mcm.java b/mcMMO/com/gmail/nossr50/mcm.java index 932f66f35..40ef164ee 100644 --- a/mcMMO/com/gmail/nossr50/mcm.java +++ b/mcMMO/com/gmail/nossr50/mcm.java @@ -1508,21 +1508,11 @@ public class mcm { Location loc = block.getLocation(); ItemStack is = null; Material mat = null; - if(!mcConfig.getInstance().isBlockWatched(block)){ - 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); - } - } + //player.sendMessage("mcMMO DEBUG: Data ("+block.getData()+")"+" TYPEID ("+block.getTypeId()+")"); if(type == 59 && block.getData() == (byte) 0x7){ mat = Material.getMaterial(296); is = new ItemStack(mat, 1, (byte)0, (byte)0); - if(Math.random() * 100 > 80){ mcUsers.getProfile(player).addHerbalismGather(3); - } if(mcUsers.getProfile(player).getHerbalismInt() >= 50 && mcUsers.getProfile(player).getHerbalismInt() < 150){ if(Math.random() * 10 > 8) loc.getWorld().dropItemNaturally(loc, is); @@ -1540,6 +1530,18 @@ public class mcm { 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){ int skillups = 0; 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()+")"); } - } } public void excavationProcCheck(Block block, Player player){ int type = block.getTypeId(); diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index 49e526c2b..8638dac61 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 0.7.4 \ No newline at end of file +version: 0.7.5 \ No newline at end of file