mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Fixed bug with being unable to repair Gold Hoe. Fixed bug with item durability - now uses getMaxDurability from org.bukkit.material
This commit is contained in:
parent
523db7f0a2
commit
da9a4b80e4
@ -13,7 +13,7 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with mcMMO. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
package com.gmail.nossr50.skills;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@ -211,6 +211,7 @@ public class Repair {
|
||||
SpoutStuff.playRepairNoise(player);
|
||||
|
||||
}
|
||||
|
||||
//GOLD TOOLS
|
||||
else if(isGoldTools(is) && hasItem(player, rGold)){
|
||||
removeItem(player, rGold);
|
||||
@ -242,34 +243,33 @@ public class Repair {
|
||||
else {
|
||||
player.sendMessage(mcLocale.getString("Skills.FullDurability"));
|
||||
}
|
||||
//player.updateInventory();
|
||||
|
||||
/*
|
||||
* GIVE SKILL IF THERE IS ENOUGH XP
|
||||
*/
|
||||
Skills.XpCheckSkill(SkillType.REPAIR, player);
|
||||
}
|
||||
}
|
||||
public static int getArcaneForgingRank(PlayerProfile PP)
|
||||
{
|
||||
}
|
||||
|
||||
public static int getArcaneForgingRank(PlayerProfile PP){
|
||||
int rank = 0;
|
||||
|
||||
if(PP.getSkillLevel(SkillType.REPAIR) >= 750)
|
||||
{
|
||||
rank = 4;
|
||||
} else if (PP.getSkillLevel(SkillType.REPAIR) >= 500)
|
||||
{
|
||||
|
||||
else if (PP.getSkillLevel(SkillType.REPAIR) >= 500)
|
||||
rank = 3;
|
||||
} else if(PP.getSkillLevel(SkillType.REPAIR) >= 250)
|
||||
{
|
||||
|
||||
else if(PP.getSkillLevel(SkillType.REPAIR) >= 250)
|
||||
rank = 2;
|
||||
} else if (PP.getSkillLevel(SkillType.REPAIR) >= 100)
|
||||
{
|
||||
|
||||
else if (PP.getSkillLevel(SkillType.REPAIR) >= 100)
|
||||
rank = 1;
|
||||
}
|
||||
|
||||
return rank;
|
||||
}
|
||||
public static void addEnchants(ItemStack is, Enchantment[] enchants, int[] enchantsLvl, PlayerProfile PP, Player player)
|
||||
{
|
||||
|
||||
public static void addEnchants(ItemStack is, Enchantment[] enchants, int[] enchantsLvl, PlayerProfile PP, Player player){
|
||||
if(is.getEnchantments().keySet().size() == 0)
|
||||
return;
|
||||
|
||||
@ -328,8 +328,7 @@ public class Repair {
|
||||
player.sendMessage(mcLocale.getString("Repair.Downgraded"));
|
||||
}
|
||||
}
|
||||
public static int getEnchantChance(int rank)
|
||||
{
|
||||
public static int getEnchantChance(int rank){
|
||||
switch(rank)
|
||||
{
|
||||
case 4:
|
||||
@ -361,9 +360,9 @@ public class Repair {
|
||||
}
|
||||
}
|
||||
public static boolean isArmor(ItemStack is){
|
||||
return is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 ||
|
||||
is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 ||
|
||||
is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317;
|
||||
return is.getTypeId() == 306 || is.getTypeId() == 307 ||is.getTypeId() == 308 ||is.getTypeId() == 309 || //IRON
|
||||
is.getTypeId() == 310 ||is.getTypeId() == 311 ||is.getTypeId() == 312 ||is.getTypeId() == 313 || //DIAMOND
|
||||
is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317; //GOLD
|
||||
}
|
||||
public static boolean isGoldArmor(ItemStack is){
|
||||
return is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317;
|
||||
@ -378,7 +377,7 @@ public class Repair {
|
||||
{
|
||||
return is.getTypeId() == 359 || is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292 || //IRON
|
||||
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 || //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() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275|| is.getTypeId() == 291; //STONE
|
||||
}
|
||||
@ -394,14 +393,8 @@ public class Repair {
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
return is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293;
|
||||
}
|
||||
public static void removeItem(Player player, int typeid)
|
||||
{
|
||||
@ -437,9 +430,7 @@ public class Repair {
|
||||
if(checkPlayerProcRepair(player)){
|
||||
ramt = (short) (ramt * 2);
|
||||
}
|
||||
//player.sendMessage(ChatColor.DARK_RED + "test " +ChatColor.BLUE+ );
|
||||
durability-=ramt;
|
||||
// player.sendMessage(ChatColor.DARK_RED + "durability " +ChatColor.BLUE+ durability);
|
||||
if(durability < 0){
|
||||
durability = 0;
|
||||
}
|
||||
@ -453,13 +444,17 @@ public class Repair {
|
||||
/*
|
||||
* TOOLS
|
||||
*/
|
||||
|
||||
//SHEARS
|
||||
case 359:
|
||||
ramt = Material.SHEARS.getMaxDurability();
|
||||
ramt = Material.SHEARS.getMaxDurability() / 2;
|
||||
break;
|
||||
|
||||
/* WOOD TOOLS */
|
||||
|
||||
//WOOD SWORD
|
||||
case 268:
|
||||
ramt = Material.WOOD_SWORD.getMaxDurability();
|
||||
ramt = Material.WOOD_SWORD.getMaxDurability() / 2;
|
||||
break;
|
||||
//WOOD SHOVEL
|
||||
case 269:
|
||||
@ -467,19 +462,22 @@ public class Repair {
|
||||
break;
|
||||
//WOOD PICKAXE
|
||||
case 270:
|
||||
ramt = Material.WOOD_PICKAXE.getMaxDurability();
|
||||
ramt = Material.WOOD_PICKAXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//WOOD AXE
|
||||
case 271:
|
||||
ramt = Material.WOOD_AXE.getMaxDurability();
|
||||
ramt = Material.WOOD_AXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//WOOD HOE
|
||||
case 290:
|
||||
ramt = Material.WOOD_HOE.getMaxDurability();
|
||||
ramt = Material.WOOD_HOE.getMaxDurability() / 2;
|
||||
break;
|
||||
|
||||
/* STONE TOOLS */
|
||||
|
||||
//STONE SWORD
|
||||
case 272:
|
||||
ramt = Material.STONE_SWORD.getMaxDurability();
|
||||
ramt = Material.STONE_SWORD.getMaxDurability() / 2;
|
||||
break;
|
||||
//STONE SHOVEL
|
||||
case 273:
|
||||
@ -487,129 +485,150 @@ public class Repair {
|
||||
break;
|
||||
//STONE PICKAXE
|
||||
case 274:
|
||||
ramt = Material.STONE_PICKAXE.getMaxDurability();
|
||||
ramt = Material.STONE_PICKAXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//STONE AXE
|
||||
case 275:
|
||||
ramt = Material.STONE_AXE.getMaxDurability();
|
||||
ramt = Material.STONE_AXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//STONE HOE
|
||||
case 291:
|
||||
ramt = Material.STONE_HOE.getMaxDurability();
|
||||
ramt = Material.STONE_HOE.getMaxDurability() / 2;
|
||||
break;
|
||||
//GOLD SHOVEL
|
||||
case 284:
|
||||
ramt = Material.GOLD_SPADE.getMaxDurability();
|
||||
|
||||
/* IRON TOOLS */
|
||||
|
||||
//IRON SWORD
|
||||
case 267:
|
||||
ramt = Material.IRON_SWORD.getMaxDurability() / 2;
|
||||
break;
|
||||
//IRON SHOVEL
|
||||
case 256:
|
||||
ramt = Material.IRON_SPADE.getMaxDurability();
|
||||
break;
|
||||
//IRON PICK
|
||||
case 257:
|
||||
ramt = Material.IRON_PICKAXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//IRON AXE
|
||||
case 258:
|
||||
ramt = Material.IRON_AXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//IRON HOE
|
||||
case 292:
|
||||
ramt = Material.IRON_HOE.getMaxDurability() / 2;
|
||||
break;
|
||||
|
||||
/* DIAMOND TOOLS */
|
||||
|
||||
//DIAMOND SWORD
|
||||
case 276:
|
||||
ramt = Material.DIAMOND_SWORD.getMaxDurability() / 2;
|
||||
break;
|
||||
//DIAMOND SHOVEL
|
||||
case 277:
|
||||
ramt = Material.DIAMOND_SPADE.getMaxDurability();
|
||||
break;
|
||||
//IRON PICK
|
||||
case 257:
|
||||
ramt = Material.IRON_PICKAXE.getMaxDurability();
|
||||
break;
|
||||
//IRON AXE
|
||||
case 258:
|
||||
ramt = Material.IRON_AXE.getMaxDurability();
|
||||
break;
|
||||
//IRON SWORD
|
||||
case 267:
|
||||
ramt = Material.IRON_SWORD.getMaxDurability();
|
||||
break;
|
||||
//IRON HOE
|
||||
case 292:
|
||||
ramt = Material.IRON_HOE.getMaxDurability();
|
||||
break;
|
||||
//DIAMOND SWORD
|
||||
case 276:
|
||||
ramt = Material.DIAMOND_SWORD.getMaxDurability();
|
||||
break;
|
||||
//DIAMOND PICK
|
||||
case 278:
|
||||
ramt = Material.DIAMOND_PICKAXE.getMaxDurability();
|
||||
ramt = Material.DIAMOND_PICKAXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//DIAMOND AXE
|
||||
case 279:
|
||||
ramt = Material.DIAMOND_AXE.getMaxDurability();
|
||||
ramt = Material.DIAMOND_AXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//DIAMOND HOE
|
||||
case 293:
|
||||
ramt = Material.DIAMOND_HOE.getMaxDurability();
|
||||
ramt = Material.DIAMOND_HOE.getMaxDurability() / 2;
|
||||
break;
|
||||
|
||||
/* GOLD TOOLS */
|
||||
|
||||
//GOLD SWORD
|
||||
case 283:
|
||||
ramt = Material.GOLD_SWORD.getMaxDurability();
|
||||
ramt = Material.GOLD_SWORD.getMaxDurability() / 2;
|
||||
break;
|
||||
//GOLD SHOVEL
|
||||
case 284:
|
||||
ramt = Material.GOLD_SPADE.getMaxDurability();
|
||||
break;
|
||||
//GOLD PICK
|
||||
case 285:
|
||||
ramt = Material.GOLD_PICKAXE.getMaxDurability();
|
||||
ramt = Material.GOLD_PICKAXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//GOLD AXE
|
||||
case 286:
|
||||
ramt = Material.GOLD_AXE.getMaxDurability();
|
||||
ramt = Material.GOLD_AXE.getMaxDurability() / 3;
|
||||
break;
|
||||
//GOLD HOE
|
||||
case 294:
|
||||
ramt = Material.GOLD_HOE.getMaxDurability();
|
||||
ramt = Material.GOLD_HOE.getMaxDurability() / 2;
|
||||
break;
|
||||
/*
|
||||
* ARMOR
|
||||
*/
|
||||
|
||||
/* IRON ARMOR */
|
||||
|
||||
//IRON HELMET
|
||||
case 306:
|
||||
ramt = 27;
|
||||
ramt = Material.IRON_HELMET.getMaxDurability() / 5;
|
||||
break;
|
||||
|
||||
case 310:
|
||||
ramt = 55;
|
||||
break;
|
||||
|
||||
//IRON CHESTPLATE
|
||||
case 307:
|
||||
ramt = 24;
|
||||
ramt = Material.IRON_CHESTPLATE.getMaxDurability() / 8;
|
||||
break;
|
||||
|
||||
case 311:
|
||||
ramt = 48;
|
||||
break;
|
||||
|
||||
//IRON LEGGINGS
|
||||
case 308:
|
||||
ramt = 27;
|
||||
ramt = Material.IRON_LEGGINGS.getMaxDurability() / 7;
|
||||
break;
|
||||
|
||||
case 312:
|
||||
ramt = 53;
|
||||
break;
|
||||
|
||||
//IRON BOOTS
|
||||
case 309:
|
||||
ramt = 40;
|
||||
ramt = Material.IRON_BOOTS.getMaxDurability() / 4;
|
||||
break;
|
||||
|
||||
/* DIAMOND ARMOR */
|
||||
|
||||
//DIAMOND HELMET
|
||||
case 310:
|
||||
ramt = Material.DIAMOND_HELMET.getMaxDurability() / 5;
|
||||
break;
|
||||
//DIAMOND CHESTPLATE
|
||||
case 311:
|
||||
ramt = Material.DIAMOND_CHESTPLATE.getMaxDurability() / 8;
|
||||
break;
|
||||
//DIAMOND LEGGINGS
|
||||
case 312:
|
||||
ramt = Material.DIAMOND_LEGGINGS.getMaxDurability() / 7;
|
||||
break;
|
||||
//DIAMOND BOOTS
|
||||
case 313:
|
||||
ramt = 80;
|
||||
ramt = Material.DIAMOND_BOOTS.getMaxDurability() / 4;
|
||||
break;
|
||||
|
||||
/* GOLD ARMOR */
|
||||
|
||||
//GOLD HELMET
|
||||
case 314:
|
||||
ramt = 13;
|
||||
ramt = Material.GOLD_HELMET.getMaxDurability() / 5;
|
||||
break;
|
||||
|
||||
//GOLD CHESTPLATE
|
||||
case 315:
|
||||
ramt = 12;
|
||||
ramt = Material.GOLD_CHESTPLATE.getMaxDurability() / 8;
|
||||
break;
|
||||
|
||||
//GOLD LEGGINGS
|
||||
case 316:
|
||||
ramt = 14;
|
||||
ramt = Material.GOLD_LEGGINGS.getMaxDurability() / 7;
|
||||
break;
|
||||
|
||||
//GOLD BOOTS
|
||||
case 317:
|
||||
ramt = 20;
|
||||
ramt = Material.GOLD_BOOTS.getMaxDurability() / 4;
|
||||
break;
|
||||
}
|
||||
|
||||
return repairCalculate(player, durability, ramt);
|
||||
}
|
||||
|
||||
public static void needMoreVespeneGas(ItemStack is, Player player)
|
||||
{
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
Loading…
Reference in New Issue
Block a user