mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 02:04:44 +02:00
Merge pull request #392 from TfT-02/master
Various fixed for issues in the issue tracker
This commit is contained in:
@ -28,6 +28,7 @@ public class McmmoCommand implements CommandExecutor {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + "Donation Info:");
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "mcmmodev@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||
}
|
||||
sender.sendMessage(ChatColor.YELLOW + "Running version: " + ChatColor.DARK_AQUA + mcMMO.p.getDescription().getVersion());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class mcMMO extends JavaPlugin {
|
||||
|
||||
//Check if Repair Anvil and Salvage Anvil have different itemID's
|
||||
if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()){
|
||||
System.out.println("[WARNING!] Can't use the same itemID for Repair/Salvage Anvils!" );
|
||||
getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!");
|
||||
}
|
||||
|
||||
if (!configInstance.getUseMySQL()) {
|
||||
@ -182,7 +182,7 @@ public class mcMMO extends JavaPlugin {
|
||||
Users.addUser(player); //In case of reload add all users back into PlayerProfile
|
||||
}
|
||||
|
||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!" );
|
||||
getLogger().info("Version " + pdfFile.getVersion() + " is enabled!");
|
||||
|
||||
BukkitScheduler scheduler = getServer().getScheduler();
|
||||
|
||||
@ -301,7 +301,7 @@ public class mcMMO extends JavaPlugin {
|
||||
getLogger().severe(e.toString());
|
||||
}
|
||||
|
||||
System.out.println("mcMMO was disabled."); //How informative!
|
||||
getLogger().info("Was disabled."); //How informative!
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.skills.combat;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -16,7 +17,6 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.ItemChecks;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
@ -40,7 +40,7 @@ public class Axes {
|
||||
final int MAX_LEVEL = advancedConfig.getBonusDamageAxesMaxBonusLevel();
|
||||
final int INCREASE_LEVEL = MAX_LEVEL / MAX_BONUS;
|
||||
|
||||
/* Add 1 DMG for every 50 skill levels */
|
||||
/* Add 1 DMG for every 50 skill levels (default value) */
|
||||
int bonus = (int) ((double) Users.getProfile(attacker).getSkillLevel(SkillType.AXES) / (double) INCREASE_LEVEL);
|
||||
|
||||
if (bonus > MAX_BONUS) {
|
||||
@ -129,7 +129,7 @@ public class Axes {
|
||||
Player targetPlayer = (Player) target;
|
||||
short durabilityDamage = 1; //Start with 1 durability damage
|
||||
|
||||
/* Every 30 Skill Levels you gain 1 durability damage */
|
||||
/* Every 50 Skill Levels you gain 1 durability damage (default values) */
|
||||
int impactIncreaseLevel = advancedConfig.getArmorImpactIncreaseLevel();
|
||||
float impactMaxDamage = (float) advancedConfig.getArmorImpactMaxDurabilityDamage() / 100F;
|
||||
short maxDurability;
|
||||
@ -141,9 +141,19 @@ public class Axes {
|
||||
else {
|
||||
for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) {
|
||||
if(Math.random() * 100 > 75) {
|
||||
maxDurability = (short) (ItemChecks.getMaxDurabilityArmor(armor) * impactMaxDamage);
|
||||
if (durabilityDamage > maxDurability) durabilityDamage = (short) maxDurability;
|
||||
armor.setDurability((short) (armor.getDurability() + durabilityDamage)); //Damage armor piece
|
||||
int lowerdamage = 0;
|
||||
for (int i = 0; i <= durabilityDamage; i ++) {
|
||||
if (armor.containsEnchantment(Enchantment.DURABILITY)) {
|
||||
int level = armor.getEnchantmentLevel(Enchantment.DURABILITY);
|
||||
if (random.nextInt(level + 1) > 0) {
|
||||
lowerdamage++;
|
||||
}
|
||||
}
|
||||
}
|
||||
int newDurabilityDamage = durabilityDamage - lowerdamage;
|
||||
maxDurability = (short) (armor.getType().getMaxDurability() * impactMaxDamage);
|
||||
if (newDurabilityDamage > maxDurability) newDurabilityDamage = (short) maxDurability;
|
||||
armor.setDurability((short) (armor.getDurability() + newDurabilityDamage)); //Damage armor piece
|
||||
}
|
||||
}
|
||||
targetPlayer.updateInventory();
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.TreeSpecies;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -65,9 +66,13 @@ public class WoodCutting {
|
||||
return;
|
||||
}
|
||||
|
||||
int durabilityLoss = durabilityLossCalulate(toBeFelled);
|
||||
int xp = 0;
|
||||
ItemStack inHand = player.getItemInHand();
|
||||
int level = 0;
|
||||
if (inHand.containsEnchantment(Enchantment.DURABILITY)) {
|
||||
level = inHand.getEnchantmentLevel(Enchantment.DURABILITY);
|
||||
}
|
||||
int durabilityLoss = durabilityLossCalulate(toBeFelled, level);
|
||||
|
||||
/* This is to prevent using wood axes everytime you tree fell */
|
||||
if (ModChecks.isCustomTool(inHand)) {
|
||||
@ -79,7 +84,6 @@ public class WoodCutting {
|
||||
if (health >= 2) {
|
||||
Combat.dealDamage(player, random.nextInt(health - 1));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ((inHand.getDurability() + durabilityLoss >= inHand.getType().getMaxDurability()) || inHand.getType().equals(Material.AIR)) {
|
||||
@ -90,7 +94,6 @@ public class WoodCutting {
|
||||
if (health >= 2) {
|
||||
Combat.dealDamage(player, random.nextInt(health - 1));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Damage the tool */
|
||||
@ -493,11 +496,11 @@ public class WoodCutting {
|
||||
}
|
||||
}
|
||||
|
||||
private static int durabilityLossCalulate(ArrayList<Block> toBeFelled) {
|
||||
private static int durabilityLossCalulate(ArrayList<Block> toBeFelled, int level) {
|
||||
int durabilityLoss = 0;
|
||||
for (Block x : toBeFelled) {
|
||||
if (x.getType().equals(Material.LOG) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLogBlock(x))) {
|
||||
durabilityLoss++;
|
||||
if (random.nextInt(level + 1) > 0) {}//Don't add durabilityLoss, because Unbreaking enchantment does it's work.
|
||||
else if (x.getType().equals(Material.LOG) || (Config.getInstance().getBlockModsEnabled() && ModChecks.isCustomLogBlock(x))) {
|
||||
durabilityLoss = durabilityLoss + Config.getInstance().getAbilityToolDamage();
|
||||
}
|
||||
}
|
||||
|
@ -474,39 +474,4 @@ public class ItemChecks {
|
||||
public static boolean isEnchantable(ItemStack is) {
|
||||
return isArmor(is) || isSword(is) || isAxe(is) || isShovel(is) || isPickaxe(is) || (is.getType() == Material.BOW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum durability of an armor type.
|
||||
*
|
||||
* @param is Item to check
|
||||
* @return maximum durability value.
|
||||
*/
|
||||
public static int getMaxDurabilityArmor(ItemStack is) {
|
||||
int durability = 0;
|
||||
if (isDiamondArmor(is)) {
|
||||
if (isHelmet(is)) durability = 364;
|
||||
else if (isChestplate(is)) durability = 529;
|
||||
else if (isPants(is)) durability = 496;
|
||||
else if (isBoots(is)) durability = 430;
|
||||
}
|
||||
else if (isIronArmor(is)) {
|
||||
if (isHelmet(is)) durability = 166;
|
||||
else if (isChestplate(is)) durability = 242;
|
||||
else if (isPants(is)) durability = 226;
|
||||
else if (isBoots(is)) durability = 196;
|
||||
}
|
||||
else if (isGoldArmor(is)) {
|
||||
if (isHelmet(is)) durability = 78;
|
||||
else if (isChestplate(is)) durability = 114;
|
||||
else if (isPants(is)) durability = 106;
|
||||
else if (isBoots(is)) durability = 92;
|
||||
}
|
||||
else if (isLeatherArmor(is)) {
|
||||
if (isHelmet(is)) durability = 56;
|
||||
else if (isChestplate(is)) durability = 82;
|
||||
else if (isPants(is)) durability = 76;
|
||||
else if (isBoots(is)) durability = 66;
|
||||
}
|
||||
return durability;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user