mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-03 18:43:43 +01:00 
			
		
		
		
	Merge branch 'master' of github.com:mcMMO-Dev/mcMMO
This commit is contained in:
		
							
								
								
									
										8
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								pom.xml
									
									
									
									
									
								
							@@ -250,6 +250,14 @@
 | 
				
			|||||||
            <groupId>com.sk89q.worldguard</groupId>
 | 
					            <groupId>com.sk89q.worldguard</groupId>
 | 
				
			||||||
            <artifactId>worldguard-core</artifactId>
 | 
					            <artifactId>worldguard-core</artifactId>
 | 
				
			||||||
            <version>7.0.1-SNAPSHOT</version>
 | 
					            <version>7.0.1-SNAPSHOT</version>
 | 
				
			||||||
 | 
					            <exclusions>
 | 
				
			||||||
 | 
					                <exclusion>
 | 
				
			||||||
 | 
					                    <!-- We use jetbrains instead. Excluding this -->
 | 
				
			||||||
 | 
					                    <!-- prevents us from using inconsistent annotations -->
 | 
				
			||||||
 | 
					                    <groupId>com.google.code.findbugs</groupId>
 | 
				
			||||||
 | 
					                    <artifactId>jsr305</artifactId>
 | 
				
			||||||
 | 
					                </exclusion>
 | 
				
			||||||
 | 
					            </exclusions>
 | 
				
			||||||
        </dependency>
 | 
					        </dependency>
 | 
				
			||||||
        <dependency>
 | 
					        <dependency>
 | 
				
			||||||
            <groupId>com.sk89q.worldguard</groupId>
 | 
					            <groupId>com.sk89q.worldguard</groupId>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,11 @@
 | 
				
			|||||||
package com.gmail.nossr50.api.exceptions;
 | 
					package com.gmail.nossr50.api.exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.jetbrains.annotations.NotNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class IncompleteNamespacedKeyRegister extends RuntimeException {
 | 
					public class IncompleteNamespacedKeyRegister extends RuntimeException {
 | 
				
			||||||
    public IncompleteNamespacedKeyRegister(String message) {
 | 
					    private static final long serialVersionUID = -6905157273569301219L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public IncompleteNamespacedKeyRegister(@NotNull String message) {
 | 
				
			||||||
        super(message);
 | 
					        super(message);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,12 @@
 | 
				
			|||||||
package com.gmail.nossr50.api.exceptions;
 | 
					package com.gmail.nossr50.api.exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					import org.jetbrains.annotations.NotNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class McMMOPlayerNotFoundException extends RuntimeException {
 | 
					public class McMMOPlayerNotFoundException extends RuntimeException {
 | 
				
			||||||
    private static final long serialVersionUID = 761917904993202836L;
 | 
					    private static final long serialVersionUID = 761917904993202836L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public McMMOPlayerNotFoundException(Player player) {
 | 
					    public McMMOPlayerNotFoundException(@NotNull Player player) {
 | 
				
			||||||
        super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId());
 | 
					        super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,6 +42,7 @@ import org.bukkit.event.Listener;
 | 
				
			|||||||
import org.bukkit.event.entity.*;
 | 
					import org.bukkit.event.entity.*;
 | 
				
			||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
 | 
					import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
 | 
				
			||||||
import org.bukkit.inventory.ItemStack;
 | 
					import org.bukkit.inventory.ItemStack;
 | 
				
			||||||
 | 
					import org.bukkit.inventory.meta.ItemMeta;
 | 
				
			||||||
import org.bukkit.inventory.meta.PotionMeta;
 | 
					import org.bukkit.inventory.meta.PotionMeta;
 | 
				
			||||||
import org.bukkit.metadata.FixedMetadataValue;
 | 
					import org.bukkit.metadata.FixedMetadataValue;
 | 
				
			||||||
import org.bukkit.potion.PotionEffect;
 | 
					import org.bukkit.potion.PotionEffect;
 | 
				
			||||||
@@ -1068,10 +1069,13 @@ public class EntityListener implements Listener {
 | 
				
			|||||||
        if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
 | 
					        if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(event.getPotion().getItem().getItemMeta() == null)
 | 
					        ItemMeta meta = event.getPotion().getItem().getItemMeta();
 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (PotionEffect effect : ((PotionMeta) event.getPotion().getItem().getItemMeta()).getCustomEffects()) {
 | 
					        if (meta == null) {
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        for (PotionEffect effect : ((PotionMeta) meta).getCustomEffects()) {
 | 
				
			||||||
            if (!effect.getType().equals(PotionEffectType.SATURATION)) {
 | 
					            if (!effect.getType().equals(PotionEffectType.SATURATION)) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,14 @@ import com.gmail.nossr50.config.AdvancedConfig;
 | 
				
			|||||||
import com.gmail.nossr50.config.Config;
 | 
					import com.gmail.nossr50.config.Config;
 | 
				
			||||||
import org.bukkit.Material;
 | 
					import org.bukkit.Material;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Salvage {
 | 
					public final class Salvage {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * This is a static utility class, therefore we don't want any instances of
 | 
				
			||||||
 | 
					     * this class. Making the constructor private prevents accidents like that.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private Salvage() {}
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    public static Material anvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
 | 
					    public static Material anvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*public static int    salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel();
 | 
					    /*public static int    salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel();
 | 
				
			||||||
@@ -15,7 +22,7 @@ public class Salvage {
 | 
				
			|||||||
    public static boolean arcaneSalvageDowngrades  = AdvancedConfig.getInstance().getArcaneSalvageEnchantDowngradeEnabled();
 | 
					    public static boolean arcaneSalvageDowngrades  = AdvancedConfig.getInstance().getArcaneSalvageEnchantDowngradeEnabled();
 | 
				
			||||||
    public static boolean arcaneSalvageEnchantLoss = AdvancedConfig.getInstance().getArcaneSalvageEnchantLossEnabled();
 | 
					    public static boolean arcaneSalvageEnchantLoss = AdvancedConfig.getInstance().getArcaneSalvageEnchantLossEnabled();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected static int calculateSalvageableAmount(short currentDurability, short maxDurability, int baseAmount) {
 | 
					    static int calculateSalvageableAmount(int currentDurability, short maxDurability, int baseAmount) {
 | 
				
			||||||
        double percentDamaged = (maxDurability <= 0) ? 1D : (double) (maxDurability - currentDurability) / maxDurability;
 | 
					        double percentDamaged = (maxDurability <= 0) ? 1D : (double) (maxDurability - currentDurability) / maxDurability;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return (int) Math.floor(baseAmount * percentDamaged);
 | 
					        return (int) Math.floor(baseAmount * percentDamaged);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,18 @@
 | 
				
			|||||||
package com.gmail.nossr50.skills.salvage;
 | 
					package com.gmail.nossr50.skills.salvage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					import java.util.Map.Entry;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.Location;
 | 
				
			||||||
 | 
					import org.bukkit.Material;
 | 
				
			||||||
 | 
					import org.bukkit.enchantments.Enchantment;
 | 
				
			||||||
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					import org.bukkit.inventory.ItemStack;
 | 
				
			||||||
 | 
					import org.bukkit.inventory.meta.Damageable;
 | 
				
			||||||
 | 
					import org.bukkit.inventory.meta.EnchantmentStorageMeta;
 | 
				
			||||||
 | 
					import org.bukkit.inventory.meta.ItemMeta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.gmail.nossr50.mcMMO;
 | 
				
			||||||
import com.gmail.nossr50.config.AdvancedConfig;
 | 
					import com.gmail.nossr50.config.AdvancedConfig;
 | 
				
			||||||
import com.gmail.nossr50.config.Config;
 | 
					import com.gmail.nossr50.config.Config;
 | 
				
			||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
 | 
					import com.gmail.nossr50.config.experience.ExperienceConfig;
 | 
				
			||||||
@@ -8,7 +21,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
 | 
				
			|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
 | 
					import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
 | 
				
			||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
 | 
					import com.gmail.nossr50.datatypes.skills.SubSkillType;
 | 
				
			||||||
import com.gmail.nossr50.locale.LocaleLoader;
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
import com.gmail.nossr50.mcMMO;
 | 
					 | 
				
			||||||
import com.gmail.nossr50.skills.SkillManager;
 | 
					import com.gmail.nossr50.skills.SkillManager;
 | 
				
			||||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
 | 
					import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
 | 
				
			||||||
import com.gmail.nossr50.util.EventUtils;
 | 
					import com.gmail.nossr50.util.EventUtils;
 | 
				
			||||||
@@ -22,15 +34,6 @@ import com.gmail.nossr50.util.skills.RankUtils;
 | 
				
			|||||||
import com.gmail.nossr50.util.skills.SkillUtils;
 | 
					import com.gmail.nossr50.util.skills.SkillUtils;
 | 
				
			||||||
import com.gmail.nossr50.util.sounds.SoundManager;
 | 
					import com.gmail.nossr50.util.sounds.SoundManager;
 | 
				
			||||||
import com.gmail.nossr50.util.sounds.SoundType;
 | 
					import com.gmail.nossr50.util.sounds.SoundType;
 | 
				
			||||||
import org.bukkit.Location;
 | 
					 | 
				
			||||||
import org.bukkit.Material;
 | 
					 | 
				
			||||||
import org.bukkit.enchantments.Enchantment;
 | 
					 | 
				
			||||||
import org.bukkit.entity.Player;
 | 
					 | 
				
			||||||
import org.bukkit.inventory.ItemStack;
 | 
					 | 
				
			||||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.Map;
 | 
					 | 
				
			||||||
import java.util.Map.Entry;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SalvageManager extends SkillManager {
 | 
					public class SalvageManager extends SkillManager {
 | 
				
			||||||
    private boolean placedAnvil;
 | 
					    private boolean placedAnvil;
 | 
				
			||||||
@@ -65,8 +68,9 @@ public class SalvageManager extends SkillManager {
 | 
				
			|||||||
        Player player = getPlayer();
 | 
					        Player player = getPlayer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Salvageable salvageable = mcMMO.getSalvageableManager().getSalvageable(item.getType());
 | 
					        Salvageable salvageable = mcMMO.getSalvageableManager().getSalvageable(item.getType());
 | 
				
			||||||
 | 
					        ItemMeta meta = item.getItemMeta();
 | 
				
			||||||
        if (item.getItemMeta() != null && item.getItemMeta().isUnbreakable()) {
 | 
					        
 | 
				
			||||||
 | 
					        if (meta != null && meta.isUnbreakable()) {
 | 
				
			||||||
            NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Anvil.Unbreakable");
 | 
					            NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Anvil.Unbreakable");
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -91,7 +95,8 @@ public class SalvageManager extends SkillManager {
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        int potentialSalvageYield = Salvage.calculateSalvageableAmount(item.getDurability(), salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
 | 
					        int durability = meta instanceof Damageable ? ((Damageable) meta).getDamage(): 0;
 | 
				
			||||||
 | 
					        int potentialSalvageYield = Salvage.calculateSalvageableAmount(durability, salvageable.getMaximumDurability(), salvageable.getMaximumQuantity());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (potentialSalvageYield <= 0) {
 | 
					        if (potentialSalvageYield <= 0) {
 | 
				
			||||||
            NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
 | 
					            NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.TooDamaged");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,13 @@ import com.gmail.nossr50.datatypes.skills.ItemType;
 | 
				
			|||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
 | 
					import com.gmail.nossr50.datatypes.skills.MaterialType;
 | 
				
			||||||
import org.bukkit.Material;
 | 
					import org.bukkit.Material;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SalvageableFactory {
 | 
					public final class SalvageableFactory {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * This is a static utility class, therefore we don't want any instances of
 | 
				
			||||||
 | 
					     * this class. Making the constructor private prevents accidents like that.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private SalvageableFactory() {}
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    public static Salvageable getSalvageable(Material itemMaterial, Material recipeMaterial, int maximumQuantity, short maximumDurability) {
 | 
					    public static Salvageable getSalvageable(Material itemMaterial, Material recipeMaterial, int maximumQuantity, short maximumDurability) {
 | 
				
			||||||
        return getSalvageable(itemMaterial, recipeMaterial, 0, maximumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
 | 
					        return getSalvageable(itemMaterial, recipeMaterial, 0, maximumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,14 +1,14 @@
 | 
				
			|||||||
package com.gmail.nossr50.skills.salvage.salvageables;
 | 
					package com.gmail.nossr50.skills.salvage.salvageables;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.HashMap;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.bukkit.Material;
 | 
					import org.bukkit.Material;
 | 
				
			||||||
import org.bukkit.inventory.ItemStack;
 | 
					import org.bukkit.inventory.ItemStack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.HashMap;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class SimpleSalvageableManager implements SalvageableManager {
 | 
					public class SimpleSalvageableManager implements SalvageableManager {
 | 
				
			||||||
    private final HashMap<Material, Salvageable> salvageables;
 | 
					    private final Map<Material, Salvageable> salvageables;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public SimpleSalvageableManager() {
 | 
					    public SimpleSalvageableManager() {
 | 
				
			||||||
        this(55);
 | 
					        this(55);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,6 +25,8 @@ import org.bukkit.block.BlockState;
 | 
				
			|||||||
import org.bukkit.entity.Player;
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
import org.bukkit.event.player.PlayerItemDamageEvent;
 | 
					import org.bukkit.event.player.PlayerItemDamageEvent;
 | 
				
			||||||
import org.bukkit.inventory.ItemStack;
 | 
					import org.bukkit.inventory.ItemStack;
 | 
				
			||||||
 | 
					import org.bukkit.inventory.meta.Damageable;
 | 
				
			||||||
 | 
					import org.bukkit.inventory.meta.ItemMeta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.HashSet;
 | 
					import java.util.HashSet;
 | 
				
			||||||
@@ -32,7 +34,6 @@ import java.util.List;
 | 
				
			|||||||
import java.util.Set;
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class WoodcuttingManager extends SkillManager {
 | 
					public class WoodcuttingManager extends SkillManager {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    private boolean treeFellerReachedThreshold = false;
 | 
					    private boolean treeFellerReachedThreshold = false;
 | 
				
			||||||
    private static int treeFellerThreshold; //TODO: Shared setting, will be removed in 2.2
 | 
					    private static int treeFellerThreshold; //TODO: Shared setting, will be removed in 2.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -207,11 +208,13 @@ public class WoodcuttingManager extends SkillManager {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private static boolean handleDurabilityLoss(Set<BlockState> treeFellerBlocks, ItemStack inHand, Player player) {
 | 
					    private static boolean handleDurabilityLoss(Set<BlockState> treeFellerBlocks, ItemStack inHand, Player player) {
 | 
				
			||||||
        //Treat the NBT tag for unbreakable and the durability enchant differently
 | 
					        //Treat the NBT tag for unbreakable and the durability enchant differently
 | 
				
			||||||
        if(inHand.getItemMeta() != null && inHand.getItemMeta().isUnbreakable()) {
 | 
					        ItemMeta meta = inHand.getItemMeta();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (meta != null && meta.isUnbreakable()) {
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        short durabilityLoss = 0;
 | 
					        int durabilityLoss = 0;
 | 
				
			||||||
        Material type = inHand.getType();
 | 
					        Material type = inHand.getType();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (BlockState blockState : treeFellerBlocks) {
 | 
					        for (BlockState blockState : treeFellerBlocks) {
 | 
				
			||||||
@@ -230,7 +233,8 @@ public class WoodcuttingManager extends SkillManager {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SkillUtils.handleDurabilityChange(inHand, durabilityLoss);
 | 
					        SkillUtils.handleDurabilityChange(inHand, durabilityLoss);
 | 
				
			||||||
        return (inHand.getDurability() < (mcMMO.getRepairableManager().isRepairable(type) ? mcMMO.getRepairableManager().getRepairable(type).getMaximumDurability() : type.getMaxDurability()));
 | 
					        int durability = meta instanceof Damageable ? ((Damageable) meta).getDamage(): 0;
 | 
				
			||||||
 | 
					        return (durability < (mcMMO.getRepairableManager().isRepairable(type) ? mcMMO.getRepairableManager().getRepairable(type).getMaximumDurability() : type.getMaxDurability()));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,10 @@ import org.jetbrains.annotations.NotNull;
 | 
				
			|||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public final class ItemUtils {
 | 
					public final class ItemUtils {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * This is a static utility class, therefore we don't want any instances of
 | 
				
			||||||
 | 
					     * this class. Making the constructor private prevents accidents like that.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private ItemUtils() {}
 | 
					    private ItemUtils() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,12 @@ import org.jetbrains.annotations.Nullable;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.util.Iterator;
 | 
					import java.util.Iterator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SkillUtils {
 | 
					public final class SkillUtils {
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * This is a static utility class, therefore we don't want any instances of
 | 
				
			||||||
 | 
					     * this class. Making the constructor private prevents accidents like that.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private SkillUtils() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static void applyXpGain(McMMOPlayer mcMMOPlayer, PrimarySkillType skill, float xp, XPGainReason xpGainReason) {
 | 
					    public static void applyXpGain(McMMOPlayer mcMMOPlayer, PrimarySkillType skill, float xp, XPGainReason xpGainReason) {
 | 
				
			||||||
        mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, XPGainSource.SELF);
 | 
					        mcMMOPlayer.beginXpGain(skill, xp, xpGainReason, XPGainSource.SELF);
 | 
				
			||||||
@@ -217,10 +222,8 @@ public class SkillUtils {
 | 
				
			|||||||
        if(compatLayer.isLegacyAbilityTool(itemStack)) {
 | 
					        if(compatLayer.isLegacyAbilityTool(itemStack)) {
 | 
				
			||||||
            ItemMeta itemMeta = itemStack.getItemMeta();
 | 
					            ItemMeta itemMeta = itemStack.getItemMeta();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //TODO: can be optimized
 | 
					            // This is safe to call without prior checks.
 | 
				
			||||||
            if(itemMeta.hasEnchant(Enchantment.DIG_SPEED)) {
 | 
					            itemMeta.removeEnchant(Enchantment.DIG_SPEED);
 | 
				
			||||||
                itemMeta.removeEnchant(Enchantment.DIG_SPEED);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            itemStack.setItemMeta(itemMeta);
 | 
					            itemStack.setItemMeta(itemMeta);
 | 
				
			||||||
            ItemUtils.removeAbilityLore(itemStack);
 | 
					            ItemUtils.removeAbilityLore(itemStack);
 | 
				
			||||||
@@ -264,7 +267,8 @@ public class SkillUtils {
 | 
				
			|||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected static Material getRepairAndSalvageItem(ItemStack inHand) {
 | 
					    @Nullable
 | 
				
			||||||
 | 
					    public static Material getRepairAndSalvageItem(@NotNull ItemStack inHand) {
 | 
				
			||||||
        if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
 | 
					        if (ItemUtils.isDiamondTool(inHand) || ItemUtils.isDiamondArmor(inHand)) {
 | 
				
			||||||
            return Material.DIAMOND;
 | 
					            return Material.DIAMOND;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -479,14 +479,13 @@ Taming.SubSkill.Pummel.TargetMessage=\u72fc\u306b\u30ce\u30c3\u30af\u30d0\u30c3\
 | 
				
			|||||||
Taming.Listener.Wolf=&8\u72fc\u306f\u3042\u306a\u305f\u306e\u3082\u3068\u306b\u6025\u3044\u3067\u623b\u308a\u307e\u3059...
 | 
					Taming.Listener.Wolf=&8\u72fc\u306f\u3042\u306a\u305f\u306e\u3082\u3068\u306b\u6025\u3044\u3067\u623b\u308a\u307e\u3059...
 | 
				
			||||||
Taming.Listener=\u8abf\u6559:
 | 
					Taming.Listener=\u8abf\u6559:
 | 
				
			||||||
Taming.SkillName=\u8abf\u6559
 | 
					Taming.SkillName=\u8abf\u6559
 | 
				
			||||||
Taming.Summon.COTW.Success.WithoutLifespan=&a\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 &7\u3042\u306a\u305f\u306f&6{0}&7\u3092\u53ec\u559a\u3057\u307e\u3057\u305f&7
 | 
					Taming.Summon.COTW.Success.WithoutLifespan=[[GREEN]]\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 [[GRAY]]\u3042\u306a\u305f\u306f[[GOLD]]{0}[[GRAY]]\u3092\u53ec\u559a\u3057\u307e\u3057\u305f[[GRAY]]
 | 
				
			||||||
Taming.Summon.COTW.Success.WithLifespan=&a\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 &6{0}&7\u3092\u53ec\u559a\u3057\u307e\u3057\u305f\u304c\u3001\u6301\u7d9a\u6642\u9593\u306f&6{1}&7\u79d2\u3067\u3059\u3002
 | 
					Taming.Summon.COTW.Success.WithLifespan=[[GREEN]]\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 [[GOLD]]{0}[[GRAY]]\u3092\u53ec\u559a\u3057\u307e\u3057\u305f\u304c\u3001\u6301\u7d9a\u6642\u9593\u306f[[GOLD]]{1}[[GRAY]]\u79d2\u3067\u3059\u3002
 | 
				
			||||||
Taming.Summon.COTW.Limit=&a\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 &6{0}&7\u306f\u540c\u6642\u306b&6{1}&7\u5339\u3057\u304b\u53ec\u559a\u3067\u304d\u307e\u305b\u3093\u3002
 | 
					Taming.Summon.COTW.Limit=[[GREEN]]\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 [[GOLD]]{0}[[GRAY]]\u306f\u540c\u6642\u306b[[GOLD]]{1}[[GRAY]]\u5339\u3057\u304b\u53ec\u559a\u3067\u304d\u307e\u305b\u3093\u3002
 | 
				
			||||||
Taming.Summon.COTW.TimeExpired=&a\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 &7\u6642\u9593\u5207\u308c\u3067&6{0}&7\u304c\u7acb\u3061\u53bb\u308a\u307e\u3057\u305f\u3002
 | 
					Taming.Summon.COTW.TimeExpired=[[GREEN]]\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 [[GRAY]]\u6642\u9593\u5207\u308c\u3067[[GOLD]]{0}[[GRAY]]\u304c\u7acb\u3061\u53bb\u308a\u307e\u3057\u305f\u3002
 | 
				
			||||||
Taming.Summon.COTW.BreedingDisallowed=&a\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 &c\u53ec\u559a\u3055\u308c\u305f\u52d5\u7269\u3092\u7e41\u6b96\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002
 | 
					Taming.Summon.COTW.BreedingDisallowed=[[GREEN]]\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 [[RED]]\u53ec\u559a\u3055\u308c\u305f\u52d5\u7269\u3092\u7e41\u6b96\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002
 | 
				
			||||||
Taming.Summon.COTW.NeedMoreItems=&a\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 &e{0}&7\u304c&3{1}&7\u500b\u5fc5\u8981\u3067\u3059\u3002
 | 
					Taming.Summon.COTW.NeedMoreItems=[[GREEN]]\uff08\u91ce\u751f\u306e\u547c\u3073\u304b\u3051\uff09 [[YELLOW]]{1}[[GRAY]]\u304c[[DARK_AQUA]]{0}[[GRAY]]\u500b\u5fc5\u8981\u3067\u3059\u3002
 | 
				
			||||||
Taming.Summon.Name.Format=&6(COTW) &f{0} {1}
 | 
					Taming.Summon.Name.Format=[[GOLD]](COTW) [[WHITE]]{0} {1}
 | 
				
			||||||
 | 
					 | 
				
			||||||
# UNARMED
 | 
					# UNARMED
 | 
				
			||||||
Unarmed.Ability.Bonus.0=\u9244\u8155\u30b9\u30bf\u30a4\u30eb
 | 
					Unarmed.Ability.Bonus.0=\u9244\u8155\u30b9\u30bf\u30a4\u30eb
 | 
				
			||||||
Unarmed.Ability.Bonus.1=+{0} \u30c0\u30e1\u30fc\u30b8\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9
 | 
					Unarmed.Ability.Bonus.1=+{0} \u30c0\u30e1\u30fc\u30b8\u30a2\u30c3\u30d7\u30b0\u30ec\u30fc\u30c9
 | 
				
			||||||
@@ -1127,4 +1126,4 @@ LevelCap.PowerLevel=&6(&amcMMO&6) &c{0}&e\u306e\u30d1\u30ef\u30fc\u30ec\u30d9\u3
 | 
				
			|||||||
LevelCap.Skill=&6(&amcMMO&6) &6{1}&e\u306e\u30ec\u30d9\u30eb\u30ad\u30e3\u30c3\u30d7&c{0}&e\u306b\u9054\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u4ee5\u964d\u30b9\u30ad\u30eb\u306e\u30ec\u30d9\u30eb\u30a2\u30c3\u30d7\u306f\u3057\u307e\u305b\u3093\u3002
 | 
					LevelCap.Skill=&6(&amcMMO&6) &6{1}&e\u306e\u30ec\u30d9\u30eb\u30ad\u30e3\u30c3\u30d7&c{0}&e\u306b\u9054\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u4ee5\u964d\u30b9\u30ad\u30eb\u306e\u30ec\u30d9\u30eb\u30a2\u30c3\u30d7\u306f\u3057\u307e\u305b\u3093\u3002
 | 
				
			||||||
Commands.XPBar.Usage=Proper usage is /mmoxpbar <skillname | reset> <show | hide>
 | 
					Commands.XPBar.Usage=Proper usage is /mmoxpbar <skillname | reset> <show | hide>
 | 
				
			||||||
Commands.Description.mmoxpbar=Player settings for mcMMO XP bars
 | 
					Commands.Description.mmoxpbar=Player settings for mcMMO XP bars
 | 
				
			||||||
Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional.
 | 
					Commands.Description.mmocompat=Information about mcMMO and whether or not its in compatibility mode or fully functional.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -558,10 +558,10 @@ Item.ChimaeraWing.Fail=**ASAS DE QUIMERA FALHARAM!**
 | 
				
			|||||||
Item.ChimaeraWing.Pass=**ASAS DE QUIMERA**
 | 
					Item.ChimaeraWing.Pass=**ASAS DE QUIMERA**
 | 
				
			||||||
Item.Injured.Wait=Voce foi ferido recentemente e deve esperar para usar isto. &e({0}s)
 | 
					Item.Injured.Wait=Voce foi ferido recentemente e deve esperar para usar isto. &e({0}s)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Skills.Disarmed=&4Voce foi Desarmado!
 | 
					Skills.Disarmed=[[DARK_RED]]Voce foi Desarmado!
 | 
				
			||||||
Skills.NeedMore=&4Voce precisa de mais
 | 
					Skills.NeedMore=[[DARK_RED]]Voce precisa de mais
 | 
				
			||||||
Skills.TooTired=&cVoce esta cansado pra usar essa habilidade.
 | 
					Skills.TooTired=[[RED]]Voce esta cansado pra usar essa habilidade. [[YELLOW]]({0}s)
 | 
				
			||||||
Skills.Cancelled=&c{0} cancelado!
 | 
					Skills.Cancelled=[[RED]]{0} cancelado!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Stats.Header.Combat=&6-=SKILLS DE COMBATE=-
 | 
					Stats.Header.Combat=&6-=SKILLS DE COMBATE=-
 | 
				
			||||||
Stats.Header.Gathering=&6-=SKILLS DE RECOLHA=-
 | 
					Stats.Header.Gathering=&6-=SKILLS DE RECOLHA=-
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user