Przeglądaj źródła

All changes up to 0.7.5, fixed herbalism mainly.

nossr50 14 lat temu
rodzic
commit
0d208a6f1b

+ 3 - 0
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

+ 8 - 8
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
     		 */

+ 13 - 12
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();

+ 1 - 1
mcMMO/plugin.yml

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