mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-03 10:33:43 +01:00 
			
		
		
		
	Updates for repairing bows & leather armor.
This commit is contained in:
		@@ -249,7 +249,26 @@ public class Repair {
 | 
				
			|||||||
						//CLANG CLANG
 | 
											//CLANG CLANG
 | 
				
			||||||
						if(LoadProperties.spoutEnabled)
 | 
											if(LoadProperties.spoutEnabled)
 | 
				
			||||||
							SpoutStuff.playRepairNoise(player);
 | 
												SpoutStuff.playRepairNoise(player);
 | 
				
			||||||
					} 
 | 
										}
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
										//BOW
 | 
				
			||||||
 | 
										else if(isBow(is) && hasItem(player, rString)){
 | 
				
			||||||
 | 
											removeItem(player, rString);
 | 
				
			||||||
 | 
											repairItem(player, enchants, enchantsLevel);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											durabilityAfter = player.getItemInHand().getDurability();
 | 
				
			||||||
 | 
											dif = (short) (durabilityBefore - durabilityAfter);
 | 
				
			||||||
 | 
											
 | 
				
			||||||
 | 
											//STRING NERF
 | 
				
			||||||
 | 
											dif = (short) (dif / 2);
 | 
				
			||||||
 | 
											
 | 
				
			||||||
 | 
											PP.addXP(SkillType.REPAIR, dif*10, player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											
 | 
				
			||||||
 | 
											//CLANG CLANG
 | 
				
			||||||
 | 
											if(LoadProperties.spoutEnabled)
 | 
				
			||||||
 | 
												SpoutStuff.playRepairNoise(player);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					//UNABLE TO REPAIR
 | 
										//UNABLE TO REPAIR
 | 
				
			||||||
					else {
 | 
										else {
 | 
				
			||||||
@@ -401,7 +420,8 @@ public class Repair {
 | 
				
			|||||||
				is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293 || //DIAMOND
 | 
									is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293 || //DIAMOND
 | 
				
			||||||
				is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294 || //GOLD
 | 
									is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294 || //GOLD
 | 
				
			||||||
				is.getTypeId() == 268 || is.getTypeId() == 269 || is.getTypeId() == 270 || is.getTypeId() == 271 || is.getTypeId() == 290 ||//WOOD
 | 
									is.getTypeId() == 268 || is.getTypeId() == 269 || is.getTypeId() == 270 || is.getTypeId() == 271 || is.getTypeId() == 290 ||//WOOD
 | 
				
			||||||
				is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275|| is.getTypeId() == 291;  //STONE
 | 
									is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275|| is.getTypeId() == 291 ||  //STONE
 | 
				
			||||||
 | 
									is.getTypeId() == 261; //BOW
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	public static boolean isStoneTools(ItemStack is){
 | 
						public static boolean isStoneTools(ItemStack is){
 | 
				
			||||||
		return is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275 || is.getTypeId() == 291;
 | 
							return is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275 || is.getTypeId() == 291;
 | 
				
			||||||
@@ -418,6 +438,9 @@ public class Repair {
 | 
				
			|||||||
	public static boolean isDiamondTools(ItemStack is){
 | 
						public static boolean isDiamondTools(ItemStack is){
 | 
				
			||||||
		return is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293;
 | 
							return is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						public static boolean isBow(ItemStack is){
 | 
				
			||||||
 | 
							return is.getTypeId() == 261;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	public static void removeItem(Player player, int typeid)
 | 
						public static void removeItem(Player player, int typeid)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		ItemStack[] inventory = player.getInventory().getContents();
 | 
							ItemStack[] inventory = player.getInventory().getContents();
 | 
				
			||||||
@@ -472,6 +495,11 @@ public class Repair {
 | 
				
			|||||||
			ramt = Material.SHEARS.getMaxDurability() / 2;
 | 
								ramt = Material.SHEARS.getMaxDurability() / 2;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
 | 
							//BOW
 | 
				
			||||||
 | 
							case 261:
 | 
				
			||||||
 | 
								ramt = Material.BOW.getMaxDurability() / 3;
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
								
 | 
				
			||||||
		/* WOOD TOOLS */
 | 
							/* WOOD TOOLS */
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		//WOOD SWORD
 | 
							//WOOD SWORD
 | 
				
			||||||
@@ -646,6 +674,25 @@ public class Repair {
 | 
				
			|||||||
		case 317:
 | 
							case 317:
 | 
				
			||||||
			ramt = Material.GOLD_BOOTS.getMaxDurability() / 4;
 | 
								ramt = Material.GOLD_BOOTS.getMaxDurability() / 4;
 | 
				
			||||||
			break;			
 | 
								break;			
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/* LEATHER ARMOR */
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							//LEATHER HELMET
 | 
				
			||||||
 | 
							case 298:
 | 
				
			||||||
 | 
								ramt = Material.LEATHER_HELMET.getMaxDurability() / 5;
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							//LEATHER CHESTPLATE
 | 
				
			||||||
 | 
							case 299:
 | 
				
			||||||
 | 
								ramt = Material.LEATHER_CHESTPLATE.getMaxDurability() / 8;
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							//LEATHER LEGGINGS
 | 
				
			||||||
 | 
							case 300:
 | 
				
			||||||
 | 
								ramt = Material.LEATHER_LEGGINGS.getMaxDurability() / 7;
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							//LEATHER BOOTS
 | 
				
			||||||
 | 
							case 301:
 | 
				
			||||||
 | 
								ramt = Material.LEATHER_BOOTS.getMaxDurability() / 4;
 | 
				
			||||||
 | 
								break;			
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		return repairCalculate(player, durability, ramt);
 | 
							return repairCalculate(player, durability, ramt);
 | 
				
			||||||
@@ -676,6 +723,8 @@ public class Repair {
 | 
				
			|||||||
			player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+ nGold);
 | 
								player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.GOLD+ nGold);
 | 
				
			||||||
		} else if (isLeatherArmor(is) && !hasItem(player, rLeather)){
 | 
							} else if (isLeatherArmor(is) && !hasItem(player, rLeather)){
 | 
				
			||||||
			player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nLeather);
 | 
								player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nLeather);
 | 
				
			||||||
 | 
							} else if (isBow(is) && !hasItem(player, rString)){
 | 
				
			||||||
 | 
								player.sendMessage(mcLocale.getString("Skills.NeedMore")+" "+ChatColor.YELLOW+ nString);
 | 
				
			||||||
		} else if (is.getAmount() > 1)
 | 
							} else if (is.getAmount() > 1)
 | 
				
			||||||
			player.sendMessage(mcLocale.getString("Skills.StackedItems"));
 | 
								player.sendMessage(mcLocale.getString("Skills.StackedItems"));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user