2011-04-20 22:56:25 +02:00
package com.gmail.nossr50.skills ;
import org.bukkit.ChatColor ;
import org.bukkit.block.Block ;
import org.bukkit.entity.Player ;
import org.bukkit.inventory.ItemStack ;
import com.gmail.nossr50.Users ;
import com.gmail.nossr50.m ;
import com.gmail.nossr50.mcPermissions ;
import com.gmail.nossr50.config.LoadProperties ;
2011-08-14 10:37:03 +02:00
import com.gmail.nossr50.spout.SpoutStuff ;
2011-04-20 22:56:25 +02:00
import com.gmail.nossr50.datatypes.PlayerProfile ;
2011-07-19 16:17:14 +02:00
import com.gmail.nossr50.datatypes.SkillType ;
2011-07-16 09:12:26 +02:00
import com.gmail.nossr50.locale.mcLocale ;
2011-04-20 22:56:25 +02:00
public class Repair {
2011-04-29 20:54:03 +02:00
/ *
* Repair requirements for each material
* /
private static int rGold = LoadProperties . rGold ;
private static String nGold = LoadProperties . nGold ;
private static int rStone = LoadProperties . rStone ;
private static String nStone = LoadProperties . nStone ;
private static int rWood = LoadProperties . rWood ;
private static String nWood = LoadProperties . nWood ;
private static int rDiamond = LoadProperties . rDiamond ;
private static String nDiamond = LoadProperties . nDiamond ;
private static int rIron = LoadProperties . rIron ;
private static String nIron = LoadProperties . nIron ;
2011-04-20 22:56:25 +02:00
2011-07-16 09:12:26 +02:00
@SuppressWarnings ( " deprecation " )
2011-04-20 22:56:25 +02:00
public static void repairCheck ( Player player , ItemStack is , Block block ) {
PlayerProfile PP = Users . getProfile ( player ) ;
short durabilityBefore = player . getItemInHand ( ) . getDurability ( ) ;
short durabilityAfter = 0 ;
short dif = 0 ;
2011-07-10 02:18:00 +02:00
if ( block ! = null & & mcPermissions . getInstance ( ) . repair ( player ) ) {
2011-04-20 22:56:25 +02:00
if ( player . getItemInHand ( ) . getDurability ( ) > 0 & & player . getItemInHand ( ) . getAmount ( ) < 2 ) {
/ *
* ARMOR
* /
if ( isArmor ( is ) ) {
/ *
* DIAMOND ARMOR
* /
2011-07-19 16:17:14 +02:00
if ( isDiamondArmor ( is ) & & hasItem ( player , rDiamond ) & & PP . getSkillLevel ( SkillType . REPAIR ) > = LoadProperties . repairdiamondlevel ) {
2011-04-29 20:54:03 +02:00
removeItem ( player , rDiamond ) ;
2011-04-28 10:49:40 +02:00
player . getItemInHand ( ) . setDurability ( getRepairAmount ( is , player ) ) ;
2011-04-20 22:56:25 +02:00
durabilityAfter = player . getItemInHand ( ) . getDurability ( ) ;
dif = ( short ) ( durabilityBefore - durabilityAfter ) ;
dif = ( short ) ( dif * 6 ) ; //Boost XP
2011-08-21 07:58:25 +02:00
PP . addXP ( SkillType . REPAIR , dif * 10 ) ;
2011-08-14 10:37:03 +02:00
//CLANG CLANG
if ( LoadProperties . spoutEnabled )
SpoutStuff . playRepairNoise ( player ) ;
2011-04-28 10:49:40 +02:00
}
2011-04-29 20:54:03 +02:00
else if ( isIronArmor ( is ) & & hasItem ( player , rIron ) ) {
2011-04-20 22:56:25 +02:00
/ *
* IRON ARMOR
* /
2011-04-29 20:54:03 +02:00
removeItem ( player , rIron ) ;
2011-04-28 10:49:40 +02:00
player . getItemInHand ( ) . setDurability ( getRepairAmount ( is , player ) ) ;
2011-04-20 22:56:25 +02:00
durabilityAfter = player . getItemInHand ( ) . getDurability ( ) ;
dif = ( short ) ( durabilityBefore - durabilityAfter ) ;
dif = ( short ) ( dif * 2 ) ; //Boost XP
2011-08-21 07:58:25 +02:00
PP . addXP ( SkillType . REPAIR , dif * 10 ) ;
2011-08-14 10:37:03 +02:00
//CLANG CLANG
if ( LoadProperties . spoutEnabled )
SpoutStuff . playRepairNoise ( player ) ;
2011-04-20 22:56:25 +02:00
//GOLD ARMOR
2011-04-29 20:54:03 +02:00
} else if ( isGoldArmor ( is ) & & hasItem ( player , rGold ) ) {
removeItem ( player , rGold ) ;
2011-04-28 10:49:40 +02:00
player . getItemInHand ( ) . setDurability ( getRepairAmount ( is , player ) ) ;
2011-04-20 22:56:25 +02:00
durabilityAfter = player . getItemInHand ( ) . getDurability ( ) ;
dif = ( short ) ( durabilityBefore - durabilityAfter ) ;
dif = ( short ) ( dif * 4 ) ; //Boost XP of Gold to around Iron
2011-08-21 07:58:25 +02:00
PP . addXP ( SkillType . REPAIR , dif * 10 ) ;
2011-08-14 10:37:03 +02:00
//CLANG CLANG
if ( LoadProperties . spoutEnabled )
SpoutStuff . playRepairNoise ( player ) ;
2011-04-20 22:56:25 +02:00
} else {
needMoreVespeneGas ( is , player ) ;
}
}
/ *
* TOOLS
* /
if ( isTools ( is ) ) {
2011-04-29 20:54:03 +02:00
if ( isStoneTools ( is ) & & hasItem ( player , rStone ) ) {
removeItem ( player , rStone ) ;
2011-04-28 10:49:40 +02:00
/ *
* Repair Durability and calculate dif
* /
player . getItemInHand ( ) . setDurability ( getRepairAmount ( is , player ) ) ;
durabilityAfter = player . getItemInHand ( ) . getDurability ( ) ;
dif = ( short ) ( durabilityBefore - durabilityAfter ) ;
if ( m . isShovel ( is ) )
dif = ( short ) ( dif / 3 ) ;
if ( m . isSwords ( is ) )
dif = ( short ) ( dif / 2 ) ;
if ( m . isHoe ( is ) )
dif = ( short ) ( dif / 2 ) ;
//STONE NERF
dif = ( short ) ( dif / 2 ) ;
2011-08-21 07:58:25 +02:00
PP . addXP ( SkillType . REPAIR , dif * 10 ) ;
2011-04-29 20:54:03 +02:00
} else if ( isWoodTools ( is ) & & hasItem ( player , rWood ) ) {
removeItem ( player , rWood ) ;
2011-04-28 10:49:40 +02:00
/ *
* Repair Durability and calculate dif
* /
player . getItemInHand ( ) . setDurability ( getRepairAmount ( is , player ) ) ;
durabilityAfter = player . getItemInHand ( ) . getDurability ( ) ;
dif = ( short ) ( durabilityBefore - durabilityAfter ) ;
if ( m . isShovel ( is ) )
dif = ( short ) ( dif / 3 ) ;
if ( m . isSwords ( is ) )
dif = ( short ) ( dif / 2 ) ;
if ( m . isHoe ( is ) )
dif = ( short ) ( dif / 2 ) ;
//WOOD NERF
dif = ( short ) ( dif / 2 ) ;
2011-08-21 07:58:25 +02:00
PP . addXP ( SkillType . REPAIR , dif * 10 ) ;
2011-04-29 20:54:03 +02:00
} else if ( isIronTools ( is ) & & hasItem ( player , rIron ) ) {
removeItem ( player , rIron ) ;
2011-04-20 22:56:25 +02:00
/ *
* Repair Durability and calculate dif
* /
2011-04-28 10:49:40 +02:00
player . getItemInHand ( ) . setDurability ( getRepairAmount ( is , player ) ) ;
2011-04-20 22:56:25 +02:00
durabilityAfter = player . getItemInHand ( ) . getDurability ( ) ;
dif = ( short ) ( durabilityBefore - durabilityAfter ) ;
if ( m . isShovel ( is ) )
dif = ( short ) ( dif / 3 ) ;
if ( m . isSwords ( is ) )
dif = ( short ) ( dif / 2 ) ;
if ( m . isHoe ( is ) )
dif = ( short ) ( dif / 2 ) ;
2011-08-21 07:58:25 +02:00
PP . addXP ( SkillType . REPAIR , dif * 10 ) ;
2011-08-14 10:37:03 +02:00
//CLANG CLANG
if ( LoadProperties . spoutEnabled )
SpoutStuff . playRepairNoise ( player ) ;
2011-07-19 16:17:14 +02:00
} else if ( isDiamondTools ( is ) & & hasItem ( player , rDiamond ) & & PP . getSkillLevel ( SkillType . REPAIR ) > = LoadProperties . repairdiamondlevel ) { //Check if its diamond and the player has diamonds
2011-04-20 22:56:25 +02:00
/ *
* DIAMOND TOOLS
* /
2011-04-28 10:49:40 +02:00
player . getItemInHand ( ) . setDurability ( getRepairAmount ( is , player ) ) ;
2011-04-29 20:54:03 +02:00
removeItem ( player , rDiamond ) ;
2011-04-20 22:56:25 +02:00
durabilityAfter = player . getItemInHand ( ) . getDurability ( ) ;
dif = ( short ) ( durabilityBefore - durabilityAfter ) ;
if ( m . isShovel ( is ) )
dif = ( short ) ( dif / 3 ) ;
if ( m . isSwords ( is ) )
dif = ( short ) ( dif / 2 ) ;
if ( m . isHoe ( is ) )
dif = ( short ) ( dif / 2 ) ;
2011-08-21 07:58:25 +02:00
PP . addXP ( SkillType . REPAIR , dif * 10 ) ;
2011-08-14 10:37:03 +02:00
//CLANG CLANG
if ( LoadProperties . spoutEnabled )
SpoutStuff . playRepairNoise ( player ) ;
2011-04-29 20:54:03 +02:00
} else if ( isGoldTools ( is ) & & hasItem ( player , rGold ) ) {
2011-04-28 10:49:40 +02:00
player . getItemInHand ( ) . setDurability ( getRepairAmount ( is , player ) ) ;
2011-04-29 20:54:03 +02:00
removeItem ( player , rGold ) ;
2011-04-20 22:56:25 +02:00
durabilityAfter = player . getItemInHand ( ) . getDurability ( ) ;
dif = ( short ) ( durabilityBefore - durabilityAfter ) ;
dif = ( short ) ( dif * 7 . 6 ) ; //Boost XP for Gold to that of around Iron
if ( m . isShovel ( is ) )
dif = ( short ) ( dif / 3 ) ;
if ( m . isSwords ( is ) )
dif = ( short ) ( dif / 2 ) ;
if ( m . isHoe ( is ) )
dif = ( short ) ( dif / 2 ) ;
2011-08-21 07:58:25 +02:00
PP . addXP ( SkillType . REPAIR , dif * 10 ) ;
2011-08-14 10:37:03 +02:00
//CLANG CLANG
if ( LoadProperties . spoutEnabled )
SpoutStuff . playRepairNoise ( player ) ;
2011-04-20 22:56:25 +02:00
} else {
needMoreVespeneGas ( is , player ) ;
}
}
} else {
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.FullDurability " ) ) ;
2011-04-20 22:56:25 +02:00
}
player . updateInventory ( ) ;
/ *
* GIVE SKILL IF THERE IS ENOUGH XP
* /
2011-07-19 16:17:14 +02:00
Skills . XpCheckSkill ( SkillType . REPAIR , player ) ;
2011-04-20 22:56:25 +02:00
}
}
public static boolean isArmor ( ItemStack is ) {
2011-08-16 11:33:34 +02:00
return is . getTypeId ( ) = = 306 | | is . getTypeId ( ) = = 307 | | is . getTypeId ( ) = = 308 | | is . getTypeId ( ) = = 309 | |
2011-04-20 22:56:25 +02:00
is . getTypeId ( ) = = 310 | | is . getTypeId ( ) = = 311 | | is . getTypeId ( ) = = 312 | | is . getTypeId ( ) = = 313 | |
2011-08-16 11:33:34 +02:00
is . getTypeId ( ) = = 314 | | is . getTypeId ( ) = = 315 | | is . getTypeId ( ) = = 316 | | is . getTypeId ( ) = = 317 ;
2011-04-20 22:56:25 +02:00
}
public static boolean isGoldArmor ( ItemStack is ) {
2011-08-16 11:33:34 +02:00
return is . getTypeId ( ) = = 314 | | is . getTypeId ( ) = = 315 | | is . getTypeId ( ) = = 316 | | is . getTypeId ( ) = = 317 ;
2011-04-20 22:56:25 +02:00
}
public static boolean isIronArmor ( ItemStack is ) {
2011-08-16 11:33:34 +02:00
return is . getTypeId ( ) = = 306 | | is . getTypeId ( ) = = 307 | | is . getTypeId ( ) = = 308 | | is . getTypeId ( ) = = 309 ;
2011-04-20 22:56:25 +02:00
}
public static boolean isDiamondArmor ( ItemStack is ) {
2011-08-16 11:33:34 +02:00
return is . getTypeId ( ) = = 310 | | is . getTypeId ( ) = = 311 | | is . getTypeId ( ) = = 312 | | is . getTypeId ( ) = = 313 ;
2011-04-20 22:56:25 +02:00
}
2011-08-16 11:33:34 +02:00
public static boolean isTools ( ItemStack is )
{
return is . getTypeId ( ) = = 359 | | is . getTypeId ( ) = = 256 | | is . getTypeId ( ) = = 257 | | is . getTypeId ( ) = = 258 | | is . getTypeId ( ) = = 267 | | is . getTypeId ( ) = = 292 | | //IRON
2011-04-20 22:56:25 +02:00
is . getTypeId ( ) = = 276 | | is . getTypeId ( ) = = 277 | | is . getTypeId ( ) = = 278 | | is . getTypeId ( ) = = 279 | | is . getTypeId ( ) = = 293 | | //DIAMOND
2011-04-28 10:49:40 +02:00
is . getTypeId ( ) = = 283 | | is . getTypeId ( ) = = 285 | | is . getTypeId ( ) = = 286 | | is . getTypeId ( ) = = 284 | | //GOLD
2011-07-10 02:18:00 +02:00
is . getTypeId ( ) = = 268 | | is . getTypeId ( ) = = 269 | | is . getTypeId ( ) = = 270 | | is . getTypeId ( ) = = 271 | | is . getTypeId ( ) = = 290 | | //WOOD
2011-08-16 11:33:34 +02:00
is . getTypeId ( ) = = 272 | | is . getTypeId ( ) = = 273 | | is . getTypeId ( ) = = 274 | | is . getTypeId ( ) = = 275 | | is . getTypeId ( ) = = 291 ; //STONE
2011-04-20 22:56:25 +02:00
}
2011-04-28 10:49:40 +02:00
public static boolean isStoneTools ( ItemStack is ) {
2011-08-16 11:33:34 +02:00
return is . getTypeId ( ) = = 272 | | is . getTypeId ( ) = = 273 | | is . getTypeId ( ) = = 274 | | is . getTypeId ( ) = = 275 | | is . getTypeId ( ) = = 291 ;
2011-04-28 10:49:40 +02:00
}
public static boolean isWoodTools ( ItemStack is ) {
2011-08-16 11:33:34 +02:00
return is . getTypeId ( ) = = 268 | | is . getTypeId ( ) = = 269 | | is . getTypeId ( ) = = 270 | | is . getTypeId ( ) = = 271 | | is . getTypeId ( ) = = 290 ;
2011-04-28 10:49:40 +02:00
}
2011-04-20 22:56:25 +02:00
public static boolean isGoldTools ( ItemStack is ) {
2011-08-16 11:33:34 +02:00
return is . getTypeId ( ) = = 283 | | is . getTypeId ( ) = = 285 | | is . getTypeId ( ) = = 286 | | is . getTypeId ( ) = = 284 | | is . getTypeId ( ) = = 294 ;
2011-04-20 22:56:25 +02:00
}
public static boolean isIronTools ( ItemStack is ) {
2011-08-16 11:33:34 +02:00
return is . getTypeId ( ) = = 359 | | is . getTypeId ( ) = = 256 | | is . getTypeId ( ) = = 257 | | is . getTypeId ( ) = = 258 | | is . getTypeId ( ) = = 267 | | is . getTypeId ( ) = = 292 ;
2011-04-20 22:56:25 +02:00
}
public static boolean isDiamondTools ( ItemStack is ) {
if ( is . getTypeId ( ) = = 276 | | is . getTypeId ( ) = = 277 | | is . getTypeId ( ) = = 278 | | is . getTypeId ( ) = = 279 | | is . getTypeId ( ) = = 293 )
{
return true ;
} else {
return false ;
}
}
2011-07-10 02:18:00 +02:00
public static void removeItem ( Player player , int typeid )
{
2011-04-20 22:56:25 +02:00
ItemStack [ ] inventory = player . getInventory ( ) . getContents ( ) ;
for ( ItemStack x : inventory ) {
2011-04-28 10:49:40 +02:00
if ( x ! = null & & x . getTypeId ( ) = = typeid ) {
2011-04-20 22:56:25 +02:00
if ( x . getAmount ( ) = = 1 ) {
x . setTypeId ( 0 ) ;
x . setAmount ( 0 ) ;
player . getInventory ( ) . setContents ( inventory ) ;
} else {
x . setAmount ( x . getAmount ( ) - 1 ) ;
player . getInventory ( ) . setContents ( inventory ) ;
}
return ;
}
}
}
2011-04-28 10:49:40 +02:00
public static boolean hasItem ( Player player , int typeid ) {
2011-04-20 22:56:25 +02:00
ItemStack [ ] inventory = player . getInventory ( ) . getContents ( ) ;
for ( ItemStack x : inventory ) {
2011-04-28 10:49:40 +02:00
if ( x ! = null & & x . getTypeId ( ) = = typeid ) {
2011-04-20 22:56:25 +02:00
return true ;
}
}
return false ;
}
public static short repairCalculate ( Player player , short durability , short ramt ) {
PlayerProfile PP = Users . getProfile ( player ) ;
2011-07-19 16:17:14 +02:00
float bonus = ( PP . getSkillLevel ( SkillType . REPAIR ) / 500 ) ;
2011-04-20 22:56:25 +02:00
bonus = ( ramt * bonus ) ;
ramt = ramt + = bonus ;
if ( checkPlayerProcRepair ( player ) ) {
ramt = ( short ) ( ramt * 2 ) ;
}
2011-04-29 20:54:03 +02:00
//player.sendMessage(ChatColor.DARK_RED + "test " +ChatColor.BLUE+ );
2011-04-20 22:56:25 +02:00
durability - = ramt ;
2011-04-29 20:54:03 +02:00
// player.sendMessage(ChatColor.DARK_RED + "durability " +ChatColor.BLUE+ durability);
2011-04-20 22:56:25 +02:00
if ( durability < 0 ) {
durability = 0 ;
}
return durability ;
}
2011-04-28 10:49:40 +02:00
public static short getRepairAmount ( ItemStack is , Player player ) {
2011-04-20 22:56:25 +02:00
short durability = is . getDurability ( ) ;
short ramt = 0 ;
switch ( is . getTypeId ( ) )
{
2011-04-28 10:49:40 +02:00
/ *
* TOOLS
* /
2011-08-16 11:33:34 +02:00
//SHEARS
case 359 :
ramt = 119 ;
break ;
2011-04-28 10:49:40 +02:00
//WOOD SWORD
case 268 :
ramt = 30 ;
break ;
//WOOD SHOVEL
case 269 :
ramt = 60 ;
break ;
//WOOD PICKAXE
case 270 :
ramt = 20 ;
break ;
//WOOD AXE
case 271 :
ramt = 20 ;
break ;
2011-07-10 02:18:00 +02:00
//WOOD HOE
case 290 :
ramt = 30 ;
break ;
2011-04-28 10:49:40 +02:00
//STONE SWORD
case 272 :
2011-07-10 02:18:00 +02:00
ramt = 66 ;
2011-04-28 10:49:40 +02:00
break ;
//STONE SHOVEL
case 273 :
ramt = 132 ;
break ;
//STONE PICKAXE
case 274 :
ramt = 44 ;
break ;
//STONE AXE
case 275 :
ramt = 44 ;
break ;
2011-07-10 02:18:00 +02:00
//STONE HOE
case 291 :
ramt = 66 ;
break ;
2011-04-20 22:56:25 +02:00
//GOLD SHOVEL
case 284 :
ramt = 33 ;
break ;
//IRON SHOVEL
case 256 :
ramt = 251 ;
break ;
//DIAMOND SHOVEL
case 277 :
ramt = 1562 ;
break ;
//IRON PICK
case 257 :
ramt = 84 ;
break ;
//IRON AXE
case 258 :
ramt = 84 ;
break ;
//IRON SWORD
case 267 :
ramt = 126 ;
break ;
//IRON HOE
case 292 :
ramt = 126 ;
break ;
//DIAMOND SWORD
case 276 :
ramt = 781 ;
break ;
//DIAMOND PICK
case 278 :
ramt = 521 ;
break ;
//DIAMOND AXE
case 279 :
ramt = 521 ;
break ;
//DIAMOND HOE
case 293 :
ramt = 781 ;
break ;
//GOLD SWORD
case 283 :
ramt = 17 ;
break ;
//GOLD PICK
case 285 :
ramt = 11 ;
break ;
//GOLD AXE
case 286 :
ramt = 11 ;
break ;
//GOLD HOE
case 294 :
ramt = 17 ;
break ;
2011-04-28 10:49:40 +02:00
/ *
* ARMOR
* /
case 306 :
ramt = 27 ;
break ;
case 310 :
ramt = 55 ;
break ;
case 307 :
ramt = 24 ;
break ;
case 311 :
ramt = 48 ;
break ;
case 308 :
ramt = 27 ;
break ;
case 312 :
ramt = 53 ;
break ;
case 309 :
ramt = 40 ;
break ;
case 313 :
ramt = 80 ;
break ;
case 314 :
ramt = 13 ;
break ;
case 315 :
ramt = 12 ;
break ;
case 316 :
ramt = 14 ;
break ;
case 317 :
ramt = 20 ;
break ;
2011-04-20 22:56:25 +02:00
}
return repairCalculate ( player , durability , ramt ) ;
}
2011-07-19 16:17:14 +02:00
public static void needMoreVespeneGas ( ItemStack is , Player player )
{
2011-04-20 22:56:25 +02:00
PlayerProfile PP = Users . getProfile ( player ) ;
2011-07-19 16:17:14 +02:00
if ( ( isDiamondTools ( is ) | | isDiamondArmor ( is ) ) & & PP . getSkillLevel ( SkillType . REPAIR ) < LoadProperties . repairdiamondlevel )
{
2011-08-17 16:30:00 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.AdeptDiamond " ) ) ;
2011-04-29 20:54:03 +02:00
} else if ( isDiamondTools ( is ) & & ! hasItem ( player , rDiamond ) | | isIronTools ( is ) & & ! hasItem ( player , rIron ) | | isGoldTools ( is ) & & ! hasItem ( player , rGold ) ) {
if ( isDiamondTools ( is ) & & ! hasItem ( player , rDiamond ) )
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.NeedMore " ) + " " + ChatColor . BLUE + nDiamond ) ;
2011-04-29 20:54:03 +02:00
if ( isIronTools ( is ) & & ! hasItem ( player , rIron ) )
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.NeedMore " ) + " " + ChatColor . GRAY + nIron ) ;
2011-04-29 20:54:03 +02:00
if ( isGoldTools ( is ) & & ! hasItem ( player , rGold ) )
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.NeedMore " ) + " " + ChatColor . GOLD + nGold ) ;
2011-04-29 20:54:03 +02:00
if ( isWoodTools ( is ) & & ! hasItem ( player , rWood ) )
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.NeedMore " ) + " " + ChatColor . DARK_GREEN + nWood ) ;
2011-04-29 20:54:03 +02:00
if ( isStoneTools ( is ) & & ! hasItem ( player , rStone ) )
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.NeedMore " ) + " " + ChatColor . GRAY + nStone ) ;
2011-04-29 20:54:03 +02:00
} else if ( isDiamondArmor ( is ) & & ! hasItem ( player , rDiamond ) ) {
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.NeedMore " ) + " " + ChatColor . BLUE + nDiamond ) ;
2011-04-29 20:54:03 +02:00
} else if ( isIronArmor ( is ) & & ! hasItem ( player , rIron ) ) {
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.NeedMore " ) + " " + ChatColor . GRAY + nIron ) ;
2011-04-29 20:54:03 +02:00
} else if ( isGoldArmor ( is ) & & ! hasItem ( player , rGold ) ) {
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.NeedMore " ) + " " + ChatColor . GOLD + nGold ) ;
2011-04-20 22:56:25 +02:00
} else if ( is . getAmount ( ) > 1 )
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.StackedItems " ) ) ;
2011-04-20 22:56:25 +02:00
}
2011-07-19 16:17:14 +02:00
public static boolean checkPlayerProcRepair ( Player player )
{
2011-04-20 22:56:25 +02:00
PlayerProfile PP = Users . getProfile ( player ) ;
2011-07-19 16:17:14 +02:00
if ( player ! = null )
{
if ( Math . random ( ) * 1000 < = PP . getSkillLevel ( SkillType . REPAIR ) )
{
2011-07-16 09:12:26 +02:00
player . sendMessage ( mcLocale . getString ( " Skills.FeltEasy " ) ) ;
2011-04-20 22:56:25 +02:00
return true ;
}
}
return false ;
}
}