Browse Source

Merge branch 'master' of github.com:mcMMO-Dev/mcMMO

nossr50 13 years ago
parent
commit
f850c0ead6

+ 22 - 14
src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java

@@ -71,6 +71,7 @@ public class mcBlockListener implements Listener
     		block = event.getBlock();
     	
     	int id = block.getTypeId();
+    	Material mat = block.getType();
     	
     	//TNT placement checks - needed for Blast Mining
     	if(id == 46 && mcPermissions.getInstance().blastmining(player))
@@ -80,22 +81,29 @@ public class mcBlockListener implements Listener
     	}
     	
     	//Check if the blocks placed should be monitored so they do not give out XP in the future
-    	if(m.shouldBeWatched(block))
+    	if(m.shouldBeWatched(mat))
     	{	
     		//Only needed for blocks that use their block data (wood, pumpkins, etc.)
-    		if (id == 17 || id == 73 || id == 74 || id == 81 || id == 83 || id == 86 || id == 91 || id == 106 || id == 98)
+    		switch(mat){
+    		case CACTUS:
+    		case GLOWING_REDSTONE_ORE:
+    		case JACK_O_LANTERN:
+    		case LOG:
+    		case PUMPKIN:
+    		case REDSTONE_ORE:
+    		case SUGAR_CANE_BLOCK:
+    		case VINE:
     			plugin.misc.blockWatchList.add(block);
-    		else
-    		{
-    			//block.setData((byte) 5); //Change the byte
-    			//The following is a method to get around a breakage in 1.1-R2 and onward
-    			//it should be removed as soon as functionality to change a block
-    			//in this event returns.
-    			if(id == 39 || id == 40 || id == 37 || id == 38 || id == 111 || id == 106)	// ids of blocks that can be mined very quickly and need to be worked on fast
-    				plugin.fastChangeQueue.push(block);
-    			else
-    				plugin.changeQueue.push(block);
+    			break;
+    		case BROWN_MUSHROOM:
+    		case RED_MUSHROOM:
+    		case RED_ROSE:
+    		case YELLOW_FLOWER:
+    		case WATER_LILY:
+    			plugin.fastChangeQueue.push(block);
+    			break;
     		}
+    		plugin.changeQueue.push(block); 			
     	}
     	
     	if(id == LoadProperties.anvilID && LoadProperties.anvilmessages)
@@ -187,7 +195,7 @@ public class mcBlockListener implements Listener
     	}
     	
     	//Change the byte back when broken
-    	if(block.getData() == 5 && m.shouldBeWatched(block))
+    	if(block.getData() == 5 && m.shouldBeWatched(block.getType()))
     	{
     		block.setData((byte) 0);
     		if(plugin.misc.blockWatchList.contains(block))
@@ -339,7 +347,7 @@ public class mcBlockListener implements Listener
     {
         Block blockFrom = event.getBlock();
         Block blockTo = event.getToBlock();
-        if(m.shouldBeWatched(blockFrom) && blockFrom.getData() == (byte)5)
+        if(m.shouldBeWatched(blockFrom.getType()) && blockFrom.getData() == (byte)5)
         {
         	blockTo.setData((byte)5);
         }

+ 0 - 8
src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java

@@ -35,7 +35,6 @@ import org.bukkit.event.entity.EntityExplodeEvent;
 import org.bukkit.event.entity.EntityTameEvent;
 import org.bukkit.event.entity.ExplosionPrimeEvent;
 import org.bukkit.event.entity.FoodLevelChangeEvent;
-import org.bukkit.inventory.ItemStack;
 
 import com.gmail.nossr50.Combat;
 import com.gmail.nossr50.Users;
@@ -345,13 +344,6 @@ public class mcEntityListener implements Listener
 	    }
 	}
 	
-	public boolean isBow(ItemStack is){
-		if (is.getTypeId() == 261){
-			return true;
-		} else {
-			return false;
-		}
-	}
 	public boolean isPlayer(Entity entity){
     	if (entity instanceof Player) {
     	    return true;

+ 175 - 49
src/main/java/com/gmail/nossr50/m.java

@@ -23,6 +23,7 @@ import java.util.logging.Logger;
 
 import org.bukkit.Bukkit;
 import org.bukkit.Location;
+import org.bukkit.Material;
 import org.bukkit.block.Block;
 import org.bukkit.entity.*;
 import org.bukkit.inventory.ItemStack;
@@ -31,6 +32,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
 import com.gmail.nossr50.datatypes.SkillType;
 import com.gmail.nossr50.events.FakeBlockBreakEvent;
 import com.gmail.nossr50.events.McMMOItemSpawnEvent;
+import com.gmail.nossr50.skills.Repair;
 
 public class m 
 {
@@ -52,13 +54,9 @@ public class m
 	public static int getInt(String string)
 	{
 		if(isInt(string))
-		{
 			return Integer.parseInt(string);
-		}
 		else
-		{
 			return 0;
-		}
 	}
 	
 	public static boolean isDouble(String string)
@@ -73,16 +71,51 @@ public class m
 		return true;
 	}
 	
-	public static boolean shouldBeWatched(Block block)
+	/**
+	 * Checks to see if a block type awards XP.
+	 * 
+	 * @param material Block type to check
+	 * @return true if the block type awards XP, false otherwise
+	 */
+	public static boolean shouldBeWatched(Material material)
 	{
-		int id = block.getTypeId();
-		return shouldBeWatched(id);
-	}
-	public static boolean shouldBeWatched(int id) {
-		return id == 2 || id == 3 || id == 12 || id == 13 || id == 82 || //Excavation
-				id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89 || id == 112 || id == 121 || id == 48 || id == 98 || //Mining
-				id == 17 || id == 37 || id == 38 || id == 39 || id == 40 || id == 81 || id == 83 || id == 86 || id == 91 || id == 103 || id == 106 || id == 111 || //Woodcutting & Herbalism
-				id == LoadProperties.anvilID; //Anvil
+		switch(material){
+		case BROWN_MUSHROOM:
+		case CACTUS:
+		case CLAY:
+		case COAL_ORE:
+		case DIAMOND_ORE:
+		case DIRT:
+		case ENDER_STONE:
+		case GLOWING_REDSTONE_ORE:
+		case GLOWSTONE:
+		case GOLD_ORE:
+		case GRASS:
+		case GRAVEL:
+		case IRON_ORE:
+		case JACK_O_LANTERN:
+		case LAPIS_ORE:
+		case LOG:
+		case MELON_BLOCK:
+		case MOSSY_COBBLESTONE:
+		case MYCEL:
+		case NETHERRACK:
+		case OBSIDIAN:
+		case PUMPKIN:
+		case RED_MUSHROOM:
+		case RED_ROSE:
+		case REDSTONE_ORE:
+		case SAND:
+		case SANDSTONE:
+		case SOUL_SAND:
+		case STONE:
+		case SUGAR_CANE_BLOCK:
+		case VINE:
+		case WATER_LILY:
+		case YELLOW_FLOWER:
+			return true;
+		}
+		return false;
 	}
 	
 	public static int getPowerLevel(Player player)
@@ -134,20 +167,19 @@ public class m
 	
 	public static Integer getTier(Player player)
 	{
-		int i = player.getItemInHand().getTypeId();
-		if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){
-			return 1; //WOOD
-		} else if (i == 272 || i == 273 || i == 274 || i == 275 || i == 291){
-			return 2; //STONE
-		} else if (i == 256 || i == 257 || i == 258 || i == 267 || i == 292){
-			return 3; //IRON
-		} else if (i == 283 || i == 284 || i == 285 || i == 286 || i == 294){
-			return 1; //GOLD
-		} else if (i == 276 || i == 277 || i == 278 || i == 279 || i == 293){
-			return 4; //DIAMOND
-		} else {
-			return 1; //UNRECOGNIZED
-		}
+		ItemStack is = player.getItemInHand();
+		if(Repair.isWoodTools(is))
+			return 1;
+		if(Repair.isStoneTools(is))
+			return 2;
+		if(Repair.isIronTools(is))
+			return 3;
+		if(Repair.isGoldTools(is))
+			return 1;
+		if(Repair.isDiamondTools(is))
+			return 4;
+		
+		return 1;
 	}
 
 	public static double getDistance(Location loca, Location locb)
@@ -158,12 +190,32 @@ public class m
 
 	public static boolean abilityBlockCheck(Block block)
 	{
-		int i = block.getTypeId();
-		if(i == 107 ||i == 117 || i == 116 || i == 96 || i == 68 || i == 355 || i == 26 || i == 323 || i == 25 || i == 54 || i == 69 || i == 92 || i == 77 || i == 58 || i == 61 || i == 62 || i == LoadProperties.anvilID || i == 71 || i == 64 || i == 84 || i == 324 || i == 330){
+		switch(block.getType()){
+		case BED_BLOCK:
+		case BREWING_STAND:
+		case BURNING_FURNACE:
+		case CAKE_BLOCK:
+		case CHEST:
+		case DISPENSER:
+		case ENCHANTMENT_TABLE:
+		case FENCE_GATE:
+		case FURNACE:
+		case IRON_DOOR_BLOCK:
+		case JUKEBOX:
+		case LEVER:
+		case NOTE_BLOCK:
+		case STONE_BUTTON:
+		case TRAP_DOOR:
+		case WALL_SIGN:
+		case WOODEN_DOOR:
+		case WORKBENCH:
 			return false;
-		} else {
-			return true;
 		}
+		
+		if(block.getTypeId() == LoadProperties.anvilID)
+			return false;
+		
+		return true;
 	}
 	
 	public static boolean isInt(String string)
@@ -208,56 +260,130 @@ public class m
 
 	public static boolean isSwords(ItemStack is)
 	{
-		int id = is.getTypeId();
-		return id == 268 || id == 267 || id == 272 || id == 283 || id == 276;
+		switch(is.getType()){
+		case DIAMOND_SWORD:
+		case GOLD_SWORD:
+		case IRON_SWORD:
+		case STONE_SWORD:
+		case WOOD_SWORD:
+			return true;
+		}
+		return false;
 	}
 	
 	public static boolean isHoe(ItemStack is)
 	{
-		int id = is.getTypeId();
-		return id == 290 || id == 291 || id == 292 || id == 293 || id == 294;
+		switch(is.getType()){
+		case DIAMOND_HOE:
+		case GOLD_HOE:
+		case IRON_HOE:
+		case STONE_HOE:
+		case WOOD_HOE:
+			return true;
+		}
+		return false;
 	}
 	
 	public static boolean isShovel(ItemStack is)
 	{	
-		int id = is.getTypeId();
-		return id == 269 || id == 273 || id == 277 || id == 284 || id == 256;
+		switch(is.getType()){
+		case DIAMOND_SPADE:
+		case GOLD_SPADE:
+		case IRON_SPADE:
+		case STONE_SPADE:
+		case WOOD_SPADE:
+			return true;
+		}
+		return false;
 	}
 	
 	public static boolean isAxes(ItemStack is)
 	{	
-		int id = is.getTypeId();
-		return id == 271 || id == 258 || id == 286 || id == 279 || id == 275;
+		switch(is.getType()){
+		case DIAMOND_AXE:
+		case GOLD_AXE:
+		case IRON_AXE:
+		case STONE_AXE:
+		case WOOD_AXE:
+			return true;
+		}
+		return false;
 	}
 	
 	public static boolean isMiningPick(ItemStack is)
 	{
-		int id = is.getTypeId();
-		return id == 270 || id == 274 || id == 285 || id == 257 || id == 278;
+		switch(is.getType()){
+		case DIAMOND_PICKAXE:
+		case GOLD_PICKAXE:
+		case IRON_PICKAXE:
+		case STONE_PICKAXE:
+		case WOOD_PICKAXE:
+			return true;
+		}
+		return false;
 	}
 	
 	public static boolean isHelmet(ItemStack is)
 	{
-		int id = is.getTypeId();
-		return id == 298 || id == 306 || id == 310 || id == 314;
+		switch(is.getType()){
+		case DIAMOND_HELMET:
+		case GOLD_HELMET:
+		case IRON_HELMET:
+		case LEATHER_HELMET:
+			return true;
+		}
+		return false;
 	}
 	
 	public static boolean isChestplate(ItemStack is)
 	{
-		int id = is.getTypeId();
-		return id == 299 || id == 307 || id == 311 || id == 315;
+		switch(is.getType()){
+		case DIAMOND_CHESTPLATE:
+		case GOLD_CHESTPLATE:
+		case IRON_CHESTPLATE:
+		case LEATHER_CHESTPLATE:
+			return true;
+		}
+		return false;
 	}
 	
 	public static boolean isPants(ItemStack is)
 	{
-		int id = is.getTypeId();
-		return id == 300 || id == 308 || id == 312 || id == 316;
+		switch(is.getType()){
+		case DIAMOND_LEGGINGS:
+		case GOLD_LEGGINGS:
+		case IRON_LEGGINGS:
+		case LEATHER_LEGGINGS:
+			return true;
+		}
+		return false;
 	}
 	
 	public static boolean isBoots(ItemStack is)
 	{
-		int id = is.getTypeId();
-		return id == 301 || id == 305 || id == 313 || id == 317;
+		switch(is.getType()){
+		case DIAMOND_BOOTS:
+		case GOLD_BOOTS:
+		case IRON_BOOTS:
+		case LEATHER_BOOTS:
+			return true;
+		}
+		return false;
+	}
+	
+	public static boolean isOre(Block block)
+	{
+		switch (block.getType()) {
+		case COAL_ORE:
+		case DIAMOND_ORE:
+		case GLOWING_REDSTONE_ORE:
+		case GOLD_ORE:
+		case IRON_ORE:
+		case LAPIS_ORE:
+		case REDSTONE_ORE:
+			return true;
+		}
+		return false;
 	}
 	
 	public static void convertToMySQL()

+ 4 - 8
src/main/java/com/gmail/nossr50/skills/BlastMining.java

@@ -35,12 +35,6 @@ public class BlastMining{
 	{
     	int id = block.getTypeId();
 		ItemStack item = new ItemStack(id, 1);
-		
-		if(id != 89 && id != 73 && id != 74 && id != 56 && id != 21 && id != 1 && id != 16 && id != 112 && id != 121 && id != 48)
-		{
-			m.mcDropItem(loc, item);
-			return;
-		}
 			
 		switch (id){
 		//GLOWSTONE
@@ -81,6 +75,9 @@ public class BlastMining{
 			item = new ItemStack(263, 1);
 			m.mcDropItem(loc, item);
 			break;
+		default:
+			m.mcDropItem(loc, item);
+			break;	
 		}
 	}
 	
@@ -128,10 +125,9 @@ public class BlastMining{
 		while(iterator.hasNext())
 		{
 			Block temp = iterator.next();
-			int id = temp.getTypeId();
 			if(temp.getData() != 5 && !plugin.misc.blockWatchList.contains(temp))
 			{
-				if(id == 14 || id == 15 || id == 16 || id == 21 || id == 56 || id == 73 || id == 74)
+				if(m.isOre(temp))
 					ores.add(temp);
 				else
 					debris.add(temp);

+ 13 - 2
src/main/java/com/gmail/nossr50/skills/Excavation.java

@@ -71,11 +71,22 @@ public class Excavation
 	    	
 	    }
 	}
+	
 	public static boolean canBeGigaDrillBroken(Block block)
 	{
-		Material t = block.getType();
-		return t == Material.DIRT || t == Material.GRASS || t == Material.SAND || t == Material.GRAVEL || t == Material.CLAY || t == Material.MYCEL || t == Material.SOUL_SAND;
+		switch(block.getType()){
+		case CLAY:
+		case DIRT:
+		case GRASS:
+		case GRAVEL:
+		case MYCEL:
+		case SAND:
+		case SOUL_SAND:
+			return true;
+		}
+		return false;
 	}
+	
 	public static void excavationProcCheck(Block block, Player player)
 	{
 		Material type = block.getType();

+ 30 - 19
src/main/java/com/gmail/nossr50/skills/Herbalism.java

@@ -89,8 +89,25 @@ public class Herbalism
 	}
 	
 	public static Boolean canBeGreenTerra(Block block){
-    	int t = block.getTypeId();
-    	return t == 103 || t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38;
+    	switch(block.getType()){
+    	case BROWN_MUSHROOM:
+    	case CACTUS:
+    	case COBBLESTONE:
+    	case CROPS:
+    	case DIRT:
+    	case JACK_O_LANTERN:
+    	case MELON_BLOCK:
+    	case PUMPKIN:
+    	case RED_MUSHROOM:
+    	case RED_ROSE:
+    	case SMOOTH_BRICK:
+    	case SUGAR_CANE_BLOCK:
+    	case VINE:
+    	case WATER_LILY:
+    	case YELLOW_FLOWER:
+    		return true;
+    	}
+    	return false;
     }
 	
 	public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin)
@@ -112,8 +129,7 @@ public class Herbalism
     	//Wheat
     	if(type == 59 && block.getData() == (byte) 0x7)
     	{
-    		mat = Material.getMaterial(296);
-			is = new ItemStack(mat, 1, (byte)0, (byte)0);
+			is = new ItemStack(Material.WHEAT, 1);
     		PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
     		
     		if(player != null)
@@ -128,8 +144,7 @@ public class Herbalism
     			event.setCancelled(true);
     			m.mcDropItem(loc, is);
     			//DROP SOME SEEDS
-    			mat = Material.SEEDS;
-    			is = new ItemStack(mat, 1, (byte)0, (byte)0);
+    			is = new ItemStack(Material.SEEDS, 1);
     			m.mcDropItem(loc, is);
     			
     			Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@@ -158,8 +173,7 @@ public class Herbalism
     	//Nether Wart
     	if(type == 115 && block.getData() == (byte) 0x3)
     	{
-    		mat = Material.getMaterial(372);
-			is = new ItemStack(mat, 1, (byte)0, (byte)0);
+			is = new ItemStack(Material.NETHER_STALK, 1);
     		PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
     		if(player != null)
     		{
@@ -200,7 +214,7 @@ public class Herbalism
 	    		{
 	    			if(materialArray[x] == Material.CACTUS)
 	    			{
-	    				is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0);
+	    				is = new ItemStack(Material.CACTUS, 1);
 	    				if(byteArray[x] != (byte) 5)
 	    				{
 	    					if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
@@ -238,7 +252,7 @@ public class Herbalism
 	    		{
 	    			if(materialArray[x] == Material.SUGAR_CANE_BLOCK)
 	    			{
-	    				is = new ItemStack(Material.SUGAR_CANE, 1, (byte)0, (byte)0);
+	    				is = new ItemStack(Material.SUGAR_CANE, 1);
 	    				//Check for being placed by the player
 	    				if(byteArray[x] != (byte) 5)
 	    				{
@@ -257,7 +271,7 @@ public class Herbalism
 	    	if((type == 91 || type == 86))
 	    	{
 	    		mat = Material.getMaterial(block.getTypeId());
-				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+				is = new ItemStack(mat, 1);
 	    		if(player != null)
 	    		{
 	    		    if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
@@ -270,8 +284,7 @@ public class Herbalism
 	    	//Melon
 	    	if(type == 103)
 	    	{
-	    		mat = Material.getMaterial(360);
-				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+				is = new ItemStack(Material.MELON, 1);
 				if(player != null)
 	    		{
 				    if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
@@ -286,7 +299,7 @@ public class Herbalism
 	    	if(type == 39 || type == 40)
 	    	{
 	    		mat = Material.getMaterial(block.getTypeId());
-				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+				is = new ItemStack(mat, 1);
 	    		if(player != null)
 	    		{
 	    		    if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
@@ -299,7 +312,7 @@ public class Herbalism
 	    	//Flower
 	    	if(type == 37 || type == 38){
 	    		mat = Material.getMaterial(block.getTypeId());
-				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+				is = new ItemStack(mat, 1);
 	    		if(player != null){
 	    		    if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
 		    			m.mcDropItem(loc, is);
@@ -309,8 +322,7 @@ public class Herbalism
 	    	//Lily Pads
 	    	if(type == 111)
 	    	{
-	    		mat = Material.getMaterial(block.getTypeId());
-				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+				is = new ItemStack(Material.WATER_LILY, 1);
 	    		if(player != null){
 	    		    if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
 		    			m.mcDropItem(loc, is);
@@ -319,8 +331,7 @@ public class Herbalism
 	    	}
 	    	//Vines
 	    	if(type == 106){
-	    		mat = Material.getMaterial(block.getTypeId());
-				is = new ItemStack(mat, 1, (byte)0, (byte)0);
+				is = new ItemStack(Material.VINE, 1, (byte)0, (byte)0);
 	    		if(player != null){
 	    		    if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
 		    			m.mcDropItem(loc, is);

+ 28 - 17
src/main/java/com/gmail/nossr50/skills/Mining.java

@@ -18,7 +18,6 @@ package com.gmail.nossr50.skills;
 
 import org.bukkit.Bukkit;
 import org.bukkit.Location;
-import org.bukkit.Material;
 import org.bukkit.block.Block;
 import org.bukkit.entity.Player;
 import org.bukkit.inventory.ItemStack;
@@ -73,14 +72,7 @@ public class Mining
 	{
     	Location loc = block.getLocation();
     	int id = block.getTypeId();
-    	Material mat = Material.getMaterial(id);
-		byte damage = 0;
-		ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
-		
-		if(id != 89 && id != 73 && id != 74 && id != 56 && id != 21 && id != 1 && id != 16 && id != 112 && id != 121 && id != 48) {
-			m.mcDropItem(loc, item);
-			return;
-		}
+		ItemStack item = new ItemStack(id, 1);
 		
 		//Drop natural block with Silk Touch
 		if(player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)){
@@ -91,18 +83,18 @@ public class Mining
 		switch (id){
 			//GLOWSTONE
 			case 89:
-				item = new ItemStack(348, 1, (byte)0, damage);
+				item = new ItemStack(348, 1);
 				m.mcDropItems(loc, item, 2);
 				m.mcRandomDropItems(loc, item, 50, 2);
 				break;
 			//REDSTONE
 			case 73:
-				item = new ItemStack(331, 1, (byte)0, damage);
+				item = new ItemStack(331, 1);
 				m.mcDropItems(loc, item, 4);
 				m.mcRandomDropItem(loc, item, 50);
 				break;
 			case 74:
-				item = new ItemStack(331, 1, (byte)0, damage);
+				item = new ItemStack(331, 1);
 				m.mcDropItems(loc, item, 4);
 				m.mcRandomDropItem(loc, item, 50);
 				break;
@@ -114,17 +106,20 @@ public class Mining
 				break;
 			//DIAMOND
 			case 56:
-				item = new ItemStack(264, 1, (byte)0, damage);
+				item = new ItemStack(264, 1);
 				m.mcDropItem(loc, item);
 				break;
 			//STONE
 			case 1:
-				item = new ItemStack(4, 1, (byte)0, damage);
+				item = new ItemStack(4, 1);
 				m.mcDropItem(loc, item);
 				break;
 			//COAL
 			case 16:
-				item = new ItemStack(263, 1, (byte)0, damage);
+				item = new ItemStack(263, 1);
+				m.mcDropItem(loc, item);
+				break;
+			default:
 				m.mcDropItem(loc, item);
 				break;
 		}
@@ -215,8 +210,24 @@ public class Mining
      */
     public static Boolean canBeSuperBroken(Block block)
     {
-    	int id = block.getTypeId();
-    	return id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89 || id == 112 || id == 121 || id == 48 || id == 98;
+    	switch(block.getType()){
+    	case COAL_ORE:
+    	case DIAMOND_ORE:
+    	case ENDER_STONE:
+    	case GLOWING_REDSTONE_ORE:
+    	case GLOWSTONE:
+    	case GOLD_ORE:
+    	case IRON_ORE:
+    	case LAPIS_ORE:
+    	case MOSSY_COBBLESTONE:
+    	case NETHERRACK:
+    	case OBSIDIAN:
+    	case REDSTONE_ORE:
+    	case SANDSTONE:
+    	case STONE:
+    		return true;
+    	}
+    	return false;
     }
     
     public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)

+ 86 - 10
src/main/java/com/gmail/nossr50/skills/Repair.java

@@ -17,6 +17,7 @@
 package com.gmail.nossr50.skills;
 
 import org.bukkit.ChatColor;
+import org.bukkit.Material;
 import org.bukkit.block.Block;
 import org.bukkit.enchantments.Enchantment;
 import org.bukkit.entity.Player;
@@ -341,39 +342,114 @@ public class Repair {
 	public static boolean isArmor(ItemStack is){
 		return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
 	}
+	
 	public static boolean isLeatherArmor(ItemStack is){
-		return is.getTypeId() == 298 || is.getTypeId() == 299 || is.getTypeId() == 300 || is.getTypeId() == 301;
+		switch(is.getType()){
+		case LEATHER_BOOTS:
+		case LEATHER_CHESTPLATE:
+		case LEATHER_HELMET:
+		case LEATHER_LEGGINGS:
+			return true;
+		}
+		return false;
 	}
+	
 	public static boolean isGoldArmor(ItemStack is){
-		return is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317;
+		switch(is.getType()){
+		case GOLD_BOOTS:
+		case GOLD_CHESTPLATE:
+		case GOLD_HELMET:
+		case GOLD_LEGGINGS:
+			return true;
+		}
+		return false;
 	}
+	
 	public static boolean isIronArmor(ItemStack is){
-		return is.getTypeId() == 306 || is.getTypeId() == 307 || is.getTypeId() == 308 || is.getTypeId() == 309;
+		switch(is.getType()){
+		case IRON_BOOTS:
+		case IRON_CHESTPLATE:
+		case IRON_HELMET:
+		case IRON_LEGGINGS:
+			return true;
+		}
+		return false;
 	}
+	
 	public static boolean isDiamondArmor(ItemStack is){
-		return is.getTypeId() == 310 || is.getTypeId() == 311 || is.getTypeId() == 312 || is.getTypeId() == 313;
+		switch(is.getType()){
+		case DIAMOND_BOOTS:
+		case DIAMOND_CHESTPLATE:
+		case DIAMOND_HELMET:
+		case DIAMOND_LEGGINGS:
+			return true;
+		}
+		return false;
 	}
+	
 	public static boolean isTools(ItemStack is)
 	{
 		return isStoneTools(is) || isWoodTools(is) || isGoldTools(is) || isIronTools(is) || isDiamondTools(is) || isBow(is);
 	}
+	
 	public static boolean isStoneTools(ItemStack is){
-		return is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275 || is.getTypeId() == 291;
+		switch(is.getType()){
+		case STONE_AXE:
+		case STONE_HOE:
+		case STONE_PICKAXE:
+		case STONE_SPADE:
+		case STONE_SWORD:
+			return true;
+		}
+		return false;
 	}
 	public static boolean isWoodTools(ItemStack is){
-		return is.getTypeId() == 268 || is.getTypeId() == 269 || is.getTypeId() == 270 || is.getTypeId() == 271 || is.getTypeId() == 290;
+		switch(is.getType()){
+		case WOOD_AXE:
+		case WOOD_HOE:
+		case WOOD_PICKAXE:
+		case WOOD_SPADE:
+		case WOOD_SWORD:
+			return true;
+		}
+		return false;
 	}
 	public static boolean isGoldTools(ItemStack is){
-		return is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294;
+		switch(is.getType()){
+		case GOLD_AXE:
+		case GOLD_HOE:
+		case GOLD_PICKAXE:
+		case GOLD_SPADE:
+		case GOLD_SWORD:
+			return true;
+		}
+		return false;
 	}
 	public static boolean isIronTools(ItemStack is){
-		return is.getTypeId() == 359 || is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292;
+		switch(is.getType()){
+		case IRON_AXE:
+		case IRON_HOE:
+		case IRON_PICKAXE:
+		case IRON_SPADE:
+		case IRON_SWORD:
+		case SHEARS:
+			return true;
+		}
+		return false;
 	}
 	public static boolean isDiamondTools(ItemStack is){
-		return is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293;
+		switch(is.getType()){
+		case DIAMOND_AXE:
+		case DIAMOND_HOE:
+		case DIAMOND_PICKAXE:
+		case DIAMOND_SPADE:
+		case DIAMOND_SWORD:
+			return true;
+		}
+		return false;
 	}
 	public static boolean isBow(ItemStack is){
-		return is.getTypeId() == 261;
+		return is.getType() == Material.BOW;
 	}
 	
 	/**