mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-25 18:17:46 +01:00
Refactoring Salvageables/Repairables, removing Simple from the naming schemes
This commit is contained in:
parent
9514b200cd
commit
eb43dc4460
@ -147,6 +147,7 @@ Version 2.2.0
|
|||||||
Config_Update_Overwrite, Tool_Mods_Enabled, Armor_Mods_Enabled, Block_Mods_Enabled, Entity_Mods_Enabled
|
Config_Update_Overwrite, Tool_Mods_Enabled, Armor_Mods_Enabled, Block_Mods_Enabled, Entity_Mods_Enabled
|
||||||
|
|
||||||
API Changes
|
API Changes
|
||||||
|
SimpleRepairable/SimpleSalvageable renamed to just Repairable/Salvageable, and their unnecessary interface classes were removed
|
||||||
Added API method to check if player parties are size capped
|
Added API method to check if player parties are size capped
|
||||||
Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition
|
Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition
|
||||||
Added API method to check if a skill was being level capped
|
Added API method to check if a skill was being level capped
|
||||||
|
@ -8,7 +8,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
import com.gmail.nossr50.skills.repair.ArcaneForging;
|
||||||
import com.gmail.nossr50.skills.repair.RepairManager;
|
import com.gmail.nossr50.skills.repair.RepairManager;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.TextComponentFactory;
|
import com.gmail.nossr50.util.TextComponentFactory;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -50,10 +50,10 @@ public class RepairCommand extends SkillCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// We're using pickaxes here, not the best but it works
|
// We're using pickaxes here, not the best but it works
|
||||||
SimpleRepairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
|
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
|
||||||
SimpleRepairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE);
|
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE);
|
||||||
SimpleRepairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE);
|
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE);
|
||||||
SimpleRepairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
|
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
|
||||||
|
|
||||||
// TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0
|
// TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0
|
||||||
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
|
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.MainConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
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;
|
||||||
@ -26,7 +25,6 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package com.gmail.nossr50.config;
|
package com.gmail.nossr50.config;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.woodcutting.Woodcutting;
|
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
||||||
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
||||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -46,10 +46,10 @@ import com.gmail.nossr50.config.treasure.HerbalismTreasureConfig;
|
|||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
|
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
|
||||||
import com.gmail.nossr50.util.experience.ExperienceMapManager;
|
import com.gmail.nossr50.util.experience.ExperienceMapManager;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
@ -83,8 +83,8 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
/* COLLECTION MANAGERS */
|
/* COLLECTION MANAGERS */
|
||||||
|
|
||||||
private SimpleRepairableManager simpleRepairableManager;
|
private RepairableManager repairableManager;
|
||||||
private SimpleSalvageableManager simpleSalvageableManager;
|
private SalvageableManager salvageableManager;
|
||||||
|
|
||||||
/* MOD MANAGERS */
|
/* MOD MANAGERS */
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ public final class ConfigManager {
|
|||||||
private SoundConfig soundConfig;
|
private SoundConfig soundConfig;
|
||||||
private RankConfig rankConfig;
|
private RankConfig rankConfig;
|
||||||
// private RepairConfig repairConfig;
|
// private RepairConfig repairConfig;
|
||||||
private SalvageConfig salvageConfig;
|
// private SalvageConfig salvageConfig;
|
||||||
|
|
||||||
private HashMap<Material, Integer> partyItemWeights;
|
private HashMap<Material, Integer> partyItemWeights;
|
||||||
private HashMap<PartyFeature, Integer> partyFeatureUnlocks;
|
private HashMap<PartyFeature, Integer> partyFeatureUnlocks;
|
||||||
@ -215,7 +215,7 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
TypeSerializers.getDefaultSerializers().registerType(new TypeToken<Material>() {}, new CustomEnumValueSerializer());
|
TypeSerializers.getDefaultSerializers().registerType(new TypeToken<Material>() {}, new CustomEnumValueSerializer());
|
||||||
TypeSerializers.getDefaultSerializers().registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer());
|
TypeSerializers.getDefaultSerializers().registerType(new TypeToken<PartyFeature>() {}, new CustomEnumValueSerializer());
|
||||||
TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(SimpleRepairable.class), new RepairableSerializer());
|
TypeSerializers.getDefaultSerializers().registerType(TypeToken.of(Repairable.class), new RepairableSerializer());
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Deserializing configs...");
|
mcMMO.p.getLogger().info("Deserializing configs...");
|
||||||
//TODO: Not sure about the order of MainConfig
|
//TODO: Not sure about the order of MainConfig
|
||||||
@ -287,7 +287,7 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
// repairConfig = new RepairConfig();
|
// repairConfig = new RepairConfig();
|
||||||
|
|
||||||
salvageConfig = new SalvageConfig();
|
// salvageConfig = new SalvageConfig();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Managers
|
* Managers
|
||||||
@ -326,19 +326,19 @@ public final class ConfigManager {
|
|||||||
private void initCollectionManagers()
|
private void initCollectionManagers()
|
||||||
{
|
{
|
||||||
// Handles registration of repairables
|
// Handles registration of repairables
|
||||||
simpleRepairableManager = new SimpleRepairableManager(getRepairables());
|
repairableManager = new RepairableManager(getRepairables());
|
||||||
unloadables.add(simpleRepairableManager);
|
unloadables.add(repairableManager);
|
||||||
|
|
||||||
// Handles registration of salvageables
|
// Handles registration of salvageables
|
||||||
simpleSalvageableManager = new SimpleSalvageableManager(getSalvageables());
|
salvageableManager = new SalvageableManager(getSalvageables());
|
||||||
unloadables.add(simpleSalvageableManager);
|
unloadables.add(salvageableManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all loaded repairables (loaded from all repairable configs)
|
* Get all loaded repairables (loaded from all repairable configs)
|
||||||
* @return the currently loaded repairables
|
* @return the currently loaded repairables
|
||||||
*/
|
*/
|
||||||
public ArrayList<SimpleRepairable> getRepairables()
|
public ArrayList<Repairable> getRepairables()
|
||||||
{
|
{
|
||||||
return getConfigRepair().getConfigRepairablesList();
|
return getConfigRepair().getConfigRepairablesList();
|
||||||
}
|
}
|
||||||
@ -349,7 +349,7 @@ public final class ConfigManager {
|
|||||||
*/
|
*/
|
||||||
public ArrayList<Salvageable> getSalvageables()
|
public ArrayList<Salvageable> getSalvageables()
|
||||||
{
|
{
|
||||||
return (ArrayList<Salvageable>) salvageConfig.genericCollection;
|
return getConfigSalvage().getConfigSalvageablesList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -401,12 +401,12 @@ public final class ConfigManager {
|
|||||||
return userFiles;
|
return userFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleRepairableManager getSimpleRepairableManager() {
|
public RepairableManager getRepairableManager() {
|
||||||
return simpleRepairableManager;
|
return repairableManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleSalvageableManager getSimpleSalvageableManager() {
|
public SalvageableManager getSalvageableManager() {
|
||||||
return simpleSalvageableManager;
|
return salvageableManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainConfig getMainConfig() {
|
public MainConfig getMainConfig() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.config.hocon;
|
package com.gmail.nossr50.config.hocon;
|
||||||
|
|
||||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
import ninja.leaping.configurate.ConfigurationNode;
|
||||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||||
@ -10,7 +10,7 @@ import ninja.leaping.configurate.util.EnumLookup;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class RepairableSerializer implements TypeSerializer<SimpleRepairable> {
|
public class RepairableSerializer implements TypeSerializer<Repairable> {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TypeTokens are obtained in two ways
|
TypeTokens are obtained in two ways
|
||||||
@ -32,13 +32,13 @@ public class RepairableSerializer implements TypeSerializer<SimpleRepairable> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SimpleRepairable deserialize(TypeToken<?> type, ConfigurationNode value) throws ObjectMappingException {
|
public Repairable deserialize(TypeToken<?> type, ConfigurationNode value) throws ObjectMappingException {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_SWORD, OAK_PLANKS, 1, 0, .25D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(WOODEN_SWORD, OAK_PLANKS, 1, 0, .25D));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* SimpleRepairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) */
|
/* Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) */
|
||||||
|
|
||||||
String item = value.getNode("Item").getValue(TypeToken.of(String.class));
|
String item = value.getNode("Item").getValue(TypeToken.of(String.class));
|
||||||
List<String> repairItems = value.getNode("Items-Used-To-Repair").getValue(new TypeToken<List<String>>() {});
|
List<String> repairItems = value.getNode("Items-Used-To-Repair").getValue(new TypeToken<List<String>>() {});
|
||||||
@ -54,11 +54,11 @@ public class RepairableSerializer implements TypeSerializer<SimpleRepairable> {
|
|||||||
int minimumLevel = value.getNode("Override-Level-Requirement").getValue(TypeToken.of(Integer.class));
|
int minimumLevel = value.getNode("Override-Level-Requirement").getValue(TypeToken.of(Integer.class));
|
||||||
double xpMultiplier = value.getNode("XP-Multiplier").getValue(TypeToken.of(Double.class));
|
double xpMultiplier = value.getNode("XP-Multiplier").getValue(TypeToken.of(Double.class));
|
||||||
|
|
||||||
return new SimpleRepairable(item, repairItems, minimumQuantity, minimumLevel, xpMultiplier);
|
return new Repairable(item, repairItems, minimumQuantity, minimumLevel, xpMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(TypeToken<?> type, SimpleRepairable obj, ConfigurationNode value) throws ObjectMappingException {
|
public void serialize(TypeToken<?> type, Repairable obj, ConfigurationNode value) throws ObjectMappingException {
|
||||||
|
|
||||||
/*value.getNode("Item").setValue(HOCONUtil.serializeENUMName(obj.getItemMaterial().getKey().getKey()));
|
/*value.getNode("Item").setValue(HOCONUtil.serializeENUMName(obj.getItemMaterial().getKey().getKey()));
|
||||||
value.getNode("Item-Used-To-Repair").setValue(HOCONUtil.serializeENUMName(obj.getRepairMaterials().getKey().getKey()));*/
|
value.getNode("Item-Used-To-Repair").setValue(HOCONUtil.serializeENUMName(obj.getRepairMaterials().getKey().getKey()));*/
|
||||||
|
@ -3,7 +3,7 @@ package com.gmail.nossr50.config.hocon.skills.repair;
|
|||||||
import com.gmail.nossr50.config.hocon.skills.repair.general.ConfigRepairGeneral;
|
import com.gmail.nossr50.config.hocon.skills.repair.general.ConfigRepairGeneral;
|
||||||
import com.gmail.nossr50.config.hocon.skills.repair.repairmastery.ConfigRepairMastery;
|
import com.gmail.nossr50.config.hocon.skills.repair.repairmastery.ConfigRepairMastery;
|
||||||
import com.gmail.nossr50.config.hocon.skills.repair.subskills.ConfigRepairSubSkills;
|
import com.gmail.nossr50.config.hocon.skills.repair.subskills.ConfigRepairSubSkills;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import ninja.leaping.configurate.objectmapping.Setting;
|
import ninja.leaping.configurate.objectmapping.Setting;
|
||||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -16,58 +16,58 @@ import static org.bukkit.Material.*;
|
|||||||
@ConfigSerializable
|
@ConfigSerializable
|
||||||
public class ConfigRepair {
|
public class ConfigRepair {
|
||||||
|
|
||||||
public static final ArrayList<SimpleRepairable> CONFIG_REPAIRABLES_DEFAULTS;
|
public static final ArrayList<Repairable> CONFIG_REPAIRABLES_DEFAULTS;
|
||||||
public static final Material[] PLANKS = new Material[] { OAK_PLANKS, BIRCH_PLANKS, DARK_OAK_PLANKS, ACACIA_PLANKS, JUNGLE_PLANKS, SPRUCE_PLANKS};
|
public static final Material[] PLANKS = new Material[] { OAK_PLANKS, BIRCH_PLANKS, DARK_OAK_PLANKS, ACACIA_PLANKS, JUNGLE_PLANKS, SPRUCE_PLANKS};
|
||||||
|
|
||||||
static {
|
static {
|
||||||
CONFIG_REPAIRABLES_DEFAULTS = new ArrayList<>();
|
CONFIG_REPAIRABLES_DEFAULTS = new ArrayList<>();
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_SWORD, Arrays.asList(PLANKS), 1, 0, .25D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(WOODEN_SWORD, Arrays.asList(PLANKS), 1, 0, .25D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_SHOVEL, Arrays.asList(PLANKS), 1, 0, .15D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(WOODEN_SHOVEL, Arrays.asList(PLANKS), 1, 0, .15D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_PICKAXE, Arrays.asList(PLANKS), 1, 0, .5D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(WOODEN_PICKAXE, Arrays.asList(PLANKS), 1, 0, .5D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_AXE, Arrays.asList(PLANKS), 1, 0, .5D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(WOODEN_AXE, Arrays.asList(PLANKS), 1, 0, .5D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_HOE, Arrays.asList(PLANKS), 1, 0, .25D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(WOODEN_HOE, Arrays.asList(PLANKS), 1, 0, .25D));
|
||||||
|
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_SWORD, COBBLESTONE, 1, 0, .25D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(STONE_SWORD, COBBLESTONE, 1, 0, .25D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_SHOVEL, COBBLESTONE, 1, 0, .15D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(STONE_SHOVEL, COBBLESTONE, 1, 0, .15D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_PICKAXE, COBBLESTONE, 1, 0, .5D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(STONE_PICKAXE, COBBLESTONE, 1, 0, .5D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_AXE, COBBLESTONE, 1, 0, .5D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(STONE_AXE, COBBLESTONE, 1, 0, .5D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_HOE, COBBLESTONE, 1, 0, .25D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(STONE_HOE, COBBLESTONE, 1, 0, .25D));
|
||||||
|
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_SWORD, IRON_INGOT, 1, 0, .5D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(IRON_SWORD, IRON_INGOT, 1, 0, .5D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_SHOVEL, IRON_INGOT, 1, 0, .3D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(IRON_SHOVEL, IRON_INGOT, 1, 0, .3D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_PICKAXE, IRON_INGOT, 1, 0, 1D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(IRON_PICKAXE, IRON_INGOT, 1, 0, 1D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_AXE, IRON_INGOT, 1, 0, 1D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(IRON_AXE, IRON_INGOT, 1, 0, 1D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_HOE, IRON_INGOT, 1, 0, .5D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(IRON_HOE, IRON_INGOT, 1, 0, .5D));
|
||||||
|
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_HELMET, IRON_INGOT, 1, 0, 2D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(IRON_HELMET, IRON_INGOT, 1, 0, 2D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_CHESTPLATE, IRON_INGOT, 1, 0, 2D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(IRON_CHESTPLATE, IRON_INGOT, 1, 0, 2D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_LEGGINGS, IRON_INGOT, 1, 0, 2D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(IRON_LEGGINGS, IRON_INGOT, 1, 0, 2D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_BOOTS, IRON_INGOT, 1, 0, 2D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(IRON_BOOTS, IRON_INGOT, 1, 0, 2D));
|
||||||
|
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(SHEARS, IRON_INGOT, 1, 0, .5D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(SHEARS, IRON_INGOT, 1, 0, .5D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(FLINT_AND_STEEL, IRON_INGOT, 1, 0, .3D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(FLINT_AND_STEEL, IRON_INGOT, 1, 0, .3D));
|
||||||
|
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_SWORD, GOLD_INGOT, 1, 0, 4D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(GOLDEN_SWORD, GOLD_INGOT, 1, 0, 4D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_SHOVEL, GOLD_INGOT, 1, 0, 2.6D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(GOLDEN_SHOVEL, GOLD_INGOT, 1, 0, 2.6D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_PICKAXE, GOLD_INGOT, 1, 0, 8D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(GOLDEN_PICKAXE, GOLD_INGOT, 1, 0, 8D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_AXE, GOLD_INGOT, 1, 0, 8D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(GOLDEN_AXE, GOLD_INGOT, 1, 0, 8D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_HOE, GOLD_INGOT, 1, 0, 4D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(GOLDEN_HOE, GOLD_INGOT, 1, 0, 4D));
|
||||||
|
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_HELMET, GOLD_INGOT, 1, 0, 4D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(GOLDEN_HELMET, GOLD_INGOT, 1, 0, 4D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_CHESTPLATE, GOLD_INGOT, 1, 0, 4D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(GOLDEN_CHESTPLATE, GOLD_INGOT, 1, 0, 4D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_LEGGINGS, GOLD_INGOT, 1, 0, 4D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(GOLDEN_LEGGINGS, GOLD_INGOT, 1, 0, 4D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_BOOTS, GOLD_INGOT, 1, 0, 4D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(GOLDEN_BOOTS, GOLD_INGOT, 1, 0, 4D));
|
||||||
|
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_SWORD, DIAMOND, 1, 0, .5D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(DIAMOND_SWORD, DIAMOND, 1, 0, .5D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_SHOVEL, DIAMOND, 1, 0, .3D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(DIAMOND_SHOVEL, DIAMOND, 1, 0, .3D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_PICKAXE, DIAMOND, 1, 0, 1D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(DIAMOND_PICKAXE, DIAMOND, 1, 0, 1D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_AXE, DIAMOND, 1, 0, 1D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(DIAMOND_AXE, DIAMOND, 1, 0, 1D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_HOE, DIAMOND, 1, 0, .5D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(DIAMOND_HOE, DIAMOND, 1, 0, .5D));
|
||||||
|
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_HELMET, DIAMOND, 1, 0, 2D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(DIAMOND_HELMET, DIAMOND, 1, 0, 2D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_CHESTPLATE, DIAMOND, 1, 0, 2D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(DIAMOND_CHESTPLATE, DIAMOND, 1, 0, 2D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_LEGGINGS, DIAMOND, 1, 0, 2D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(DIAMOND_LEGGINGS, DIAMOND, 1, 0, 2D));
|
||||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_BOOTS, DIAMOND, 1, 0, 2D));
|
CONFIG_REPAIRABLES_DEFAULTS.add(new Repairable(DIAMOND_BOOTS, DIAMOND, 1, 0, 2D));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ public class ConfigRepair {
|
|||||||
"\nXP-Multiplier: When calculating how much XP to give the player for the repair, the end result will be multiplied by this value." +
|
"\nXP-Multiplier: When calculating how much XP to give the player for the repair, the end result will be multiplied by this value." +
|
||||||
"\n\nName ID List: https://minecraft.gamepedia.com/Java_Edition_data_values" +
|
"\n\nName ID List: https://minecraft.gamepedia.com/Java_Edition_data_values" +
|
||||||
"\nTIP: You can omit \"minecraft:\" from the Name ID if you want to, for example you can write \"red_wool\" instead of \"minecraft:red_wool\"")
|
"\nTIP: You can omit \"minecraft:\" from the Name ID if you want to, for example you can write \"red_wool\" instead of \"minecraft:red_wool\"")
|
||||||
private ArrayList<SimpleRepairable> configRepairablesList = CONFIG_REPAIRABLES_DEFAULTS;
|
private ArrayList<Repairable> configRepairablesList = CONFIG_REPAIRABLES_DEFAULTS;
|
||||||
|
|
||||||
public ConfigRepairGeneral getRepairGeneral() {
|
public ConfigRepairGeneral getRepairGeneral() {
|
||||||
return repairGeneral;
|
return repairGeneral;
|
||||||
@ -109,7 +109,7 @@ public class ConfigRepair {
|
|||||||
return repairSubSkills.getArcaneForging();
|
return repairSubSkills.getArcaneForging();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<SimpleRepairable> getConfigRepairablesList() {
|
public ArrayList<Repairable> getConfigRepairablesList() {
|
||||||
return configRepairablesList;
|
return configRepairablesList;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +1,242 @@
|
|||||||
package com.gmail.nossr50.config.hocon.skills.salvage;
|
package com.gmail.nossr50.config.hocon.skills.salvage;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.hocon.skills.salvage.general.ConfigSalvageGeneral;
|
import com.gmail.nossr50.config.hocon.skills.salvage.general.ConfigSalvageGeneral;
|
||||||
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||||
import ninja.leaping.configurate.objectmapping.Setting;
|
import ninja.leaping.configurate.objectmapping.Setting;
|
||||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@ConfigSerializable
|
@ConfigSerializable
|
||||||
public class ConfigSalvage {
|
public class ConfigSalvage {
|
||||||
|
|
||||||
|
private final static List<Salvageable> DEFAULT_SALVAGEABLES_LIST;
|
||||||
|
|
||||||
|
static {
|
||||||
|
DEFAULT_SALVAGEABLES_LIST = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Salvageables:
|
||||||
|
#
|
||||||
|
# Wooden salvageables
|
||||||
|
###
|
||||||
|
# Tools
|
||||||
|
WOODEN_SWORD:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .25
|
||||||
|
MaximumQuantity: 2
|
||||||
|
WOODEN_SHOVEL:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .16
|
||||||
|
MaximumQuantity: 1
|
||||||
|
WOODEN_PICKAXE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
MaximumQuantity: 3
|
||||||
|
WOODEN_AXE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
MaximumQuantity: 2
|
||||||
|
WOODEN_HOE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .25
|
||||||
|
MaximumQuantity: 2
|
||||||
|
#
|
||||||
|
# Stone salvageables
|
||||||
|
###
|
||||||
|
# Tools
|
||||||
|
STONE_SWORD:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .25
|
||||||
|
MaximumQuantity: 2
|
||||||
|
STONE_SHOVEL:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .16
|
||||||
|
MaximumQuantity: 1
|
||||||
|
STONE_PICKAXE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
MaximumQuantity: 3
|
||||||
|
STONE_AXE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
MaximumQuantity: 2
|
||||||
|
STONE_HOE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .25
|
||||||
|
MaximumQuantity: 2
|
||||||
|
#
|
||||||
|
# Iron salvageables
|
||||||
|
###
|
||||||
|
# Tools
|
||||||
|
IRON_SWORD:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
MaximumQuantity: 2
|
||||||
|
IRON_SHOVEL:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .3
|
||||||
|
MaximumQuantity: 1
|
||||||
|
IRON_PICKAXE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 1
|
||||||
|
MaximumQuantity: 3
|
||||||
|
IRON_AXE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 1
|
||||||
|
MaximumQuantity: 2
|
||||||
|
IRON_HOE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
MaximumQuantity: 2
|
||||||
|
SHEARS:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
FLINT_AND_STEEL:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .3
|
||||||
|
# Armor
|
||||||
|
IRON_HELMET:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 2
|
||||||
|
MaximumQuantity: 5
|
||||||
|
IRON_CHESTPLATE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 2
|
||||||
|
MaximumQuantity: 8
|
||||||
|
IRON_LEGGINGS:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 2
|
||||||
|
MaximumQuantity: 7
|
||||||
|
IRON_BOOTS:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 2
|
||||||
|
MaximumQuantity: 4
|
||||||
|
#
|
||||||
|
# Gold salvageables
|
||||||
|
###
|
||||||
|
# Tools
|
||||||
|
GOLDEN_SWORD:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 4
|
||||||
|
MaximumQuantity: 2
|
||||||
|
GOLDEN_SHOVEL:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 2.6
|
||||||
|
MaximumQuantity: 1
|
||||||
|
GOLDEN_PICKAXE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 8
|
||||||
|
MaximumQuantity: 3
|
||||||
|
GOLDEN_AXE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 8
|
||||||
|
MaximumQuantity: 2
|
||||||
|
GOLDEN_HOE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 4
|
||||||
|
MaximumQuantity: 2
|
||||||
|
# Armor
|
||||||
|
GOLDEN_HELMET:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 4
|
||||||
|
MaximumQuantity: 5
|
||||||
|
GOLDEN_CHESTPLATE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 4
|
||||||
|
MaximumQuantity: 8
|
||||||
|
GOLDEN_LEGGINGS:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 4
|
||||||
|
MaximumQuantity: 7
|
||||||
|
GOLDEN_BOOTS:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 4
|
||||||
|
MaximumQuantity: 4
|
||||||
|
#
|
||||||
|
# Diamond salvageables
|
||||||
|
###
|
||||||
|
# Tools
|
||||||
|
DIAMOND_SWORD:
|
||||||
|
MinimumLevel: 50
|
||||||
|
XpMultiplier: .5
|
||||||
|
MaximumQuantity: 2
|
||||||
|
DIAMOND_SHOVEL:
|
||||||
|
MinimumLevel: 50
|
||||||
|
XpMultiplier: .3
|
||||||
|
MaximumQuantity: 1
|
||||||
|
DIAMOND_PICKAXE:
|
||||||
|
MinimumLevel: 50
|
||||||
|
XpMultiplier: 1
|
||||||
|
MaximumQuantity: 3
|
||||||
|
DIAMOND_AXE:
|
||||||
|
MinimumLevel: 50
|
||||||
|
XpMultiplier: 1
|
||||||
|
MaximumQuantity: 2
|
||||||
|
DIAMOND_HOE:
|
||||||
|
MinimumLevel: 50
|
||||||
|
XpMultiplier: .5
|
||||||
|
MaximumQuantity: 2
|
||||||
|
# Armor
|
||||||
|
DIAMOND_HELMET:
|
||||||
|
MinimumLevel: 50
|
||||||
|
XpMultiplier: 6
|
||||||
|
MaximumQuantity: 5
|
||||||
|
DIAMOND_CHESTPLATE:
|
||||||
|
MinimumLevel: 50
|
||||||
|
XpMultiplier: 6
|
||||||
|
MaximumQuantity: 8
|
||||||
|
DIAMOND_LEGGINGS:
|
||||||
|
MinimumLevel: 50
|
||||||
|
XpMultiplier: 6
|
||||||
|
MaximumQuantity: 7
|
||||||
|
DIAMOND_BOOTS:
|
||||||
|
MinimumLevel: 50
|
||||||
|
XpMultiplier: 6
|
||||||
|
MaximumQuantity: 4
|
||||||
|
#
|
||||||
|
# Leather salvageables
|
||||||
|
###
|
||||||
|
# Armor
|
||||||
|
LEATHER_HELMET:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 1
|
||||||
|
MaximumQuantity: 5
|
||||||
|
LEATHER_CHESTPLATE:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 1
|
||||||
|
MaximumQuantity: 8
|
||||||
|
LEATHER_LEGGINGS:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 1
|
||||||
|
MaximumQuantity: 7
|
||||||
|
LEATHER_BOOTS:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: 1
|
||||||
|
MaximumQuantity: 4
|
||||||
|
#
|
||||||
|
# String salvageables
|
||||||
|
###
|
||||||
|
# Tools
|
||||||
|
FISHING_ROD:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
BOW:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
CARROT_ON_A_STICK:
|
||||||
|
MinimumLevel: 0
|
||||||
|
XpMultiplier: .5
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Setting()
|
||||||
|
List<Salvageable> configSalvageablesList;
|
||||||
|
|
||||||
|
|
||||||
@Setting(value = "Arcane-Salvage", comment = "Settings related to the Arcane Salvage Sub-Skill")
|
@Setting(value = "Arcane-Salvage", comment = "Settings related to the Arcane Salvage Sub-Skill")
|
||||||
ConfigArcaneSalvage configArcaneSalvage = new ConfigArcaneSalvage();
|
ConfigArcaneSalvage configArcaneSalvage = new ConfigArcaneSalvage();
|
||||||
|
|
||||||
@ -20,4 +250,8 @@ public class ConfigSalvage {
|
|||||||
public ConfigSalvageGeneral getGeneral() {
|
public ConfigSalvageGeneral getGeneral() {
|
||||||
return general;
|
return general;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<Salvageable> getConfigSalvageablesList() {
|
||||||
|
return configSalvageablesList;
|
||||||
|
}
|
||||||
}
|
}
|
@ -18,7 +18,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
|
||||||
|
|
||||||
public class SelfListener implements Listener {
|
public class SelfListener implements Listener {
|
||||||
//Used in task scheduling and other things
|
//Used in task scheduling and other things
|
||||||
|
@ -26,7 +26,7 @@ import com.gmail.nossr50.runnables.player.PlayerProfileLoadingTask;
|
|||||||
import com.gmail.nossr50.runnables.player.PowerLevelUpdatingTask;
|
import com.gmail.nossr50.runnables.player.PowerLevelUpdatingTask;
|
||||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
|
import com.gmail.nossr50.skills.repair.repairables.RepairableManager;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
|
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableManager;
|
||||||
import com.gmail.nossr50.util.*;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
|
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
|
||||||
@ -356,12 +356,12 @@ public class mcMMO extends JavaPlugin {
|
|||||||
return placeStore;
|
return placeStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SimpleRepairableManager getRepairableManager() {
|
public static RepairableManager getRepairableManager() {
|
||||||
return configManager.getSimpleRepairableManager();
|
return configManager.getRepairableManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SalvageableManager getSalvageableManager() {
|
public static SalvageableManager getSalvageableManager() {
|
||||||
return configManager.getSimpleSalvageableManager();
|
return configManager.getSalvageableManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DatabaseManager getDatabaseManager() {
|
public static DatabaseManager getDatabaseManager() {
|
||||||
|
@ -10,7 +10,7 @@ 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.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -65,7 +65,7 @@ public class RepairManager extends SkillManager {
|
|||||||
|
|
||||||
public void handleRepair(ItemStack item) {
|
public void handleRepair(ItemStack item) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
SimpleRepairable repairable = mcMMO.getRepairableManager().getRepairable(item.getType());
|
Repairable repairable = mcMMO.getRepairableManager().getRepairable(item.getType());
|
||||||
|
|
||||||
if (item.getItemMeta().isUnbreakable()) {
|
if (item.getItemMeta().isUnbreakable()) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Anvil.Unbreakable");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Anvil.Unbreakable");
|
||||||
|
@ -1,95 +1,129 @@
|
|||||||
/*
|
|
||||||
package com.gmail.nossr50.skills.repair.repairables;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public interface Repairable {
|
public class Repairable {
|
||||||
*/
|
private final Material itemMaterial;
|
||||||
/**
|
private final List<Material> repairMaterials;
|
||||||
* Gets the type of this repairable item
|
private final int minimumQuantity, minimumLevel;
|
||||||
*
|
private final short maximumDurability, baseRepairDurability;
|
||||||
* @return the type of this repairable
|
private final ItemType repairItemType;
|
||||||
*//*
|
private final ItemMaterialCategory repairItemMaterialCategory;
|
||||||
|
private final double xpMultiplier;
|
||||||
|
|
||||||
public Material getItemMaterial();
|
public Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
||||||
|
this(itemMaterial.getKey().getKey(), ItemUtils.getRepairItemMaterials(Arrays.asList(repairMaterial)), minimumQuantity, minimumLevel, xpMultiplier);
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public Repairable(Material itemMaterial, List<Material> repairMaterials, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
||||||
/**
|
this(itemMaterial.getKey().getKey(), ItemUtils.getRepairItemMaterials(repairMaterials), minimumQuantity, minimumLevel, xpMultiplier);
|
||||||
* Gets the id of the material used to repair this item
|
}
|
||||||
*
|
|
||||||
* @return the id of the repair material
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public Material getRepairMaterials();
|
public Repairable(String itemMaterial, List<String> repairMaterials, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
||||||
|
this.itemMaterial = Material.matchMaterial(itemMaterial);
|
||||||
|
this.repairMaterials = ItemUtils.matchMaterials(repairMaterials);
|
||||||
|
this.minimumQuantity = minimumQuantity;
|
||||||
|
this.minimumLevel = minimumLevel;
|
||||||
|
this.xpMultiplier = xpMultiplier;
|
||||||
|
|
||||||
*/
|
this.maximumDurability = this.itemMaterial.getMaxDurability();
|
||||||
/**
|
this.baseRepairDurability = (short) (maximumDurability / minimumQuantity);
|
||||||
* Gets the RepairItemType value for this repairable item
|
|
||||||
*
|
|
||||||
* @return the RepairItemType for this repairable
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public ItemType getRepairItemType();
|
this.repairItemType = determineItemType(this.itemMaterial);
|
||||||
|
this.repairItemMaterialCategory = determineMaterialType(this.repairMaterials.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public ItemMaterialCategory determineMaterialType(Material material) {
|
||||||
/**
|
switch (material) {
|
||||||
* Gets the RepairMaterialType value for this repairable item
|
case STRING:
|
||||||
*
|
return ItemMaterialCategory.STRING;
|
||||||
* @return the RepairMaterialType for this repairable
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public ItemMaterialCategory getRepairItemMaterialCategory();
|
case LEATHER:
|
||||||
|
return ItemMaterialCategory.LEATHER;
|
||||||
|
|
||||||
*/
|
case ACACIA_PLANKS:
|
||||||
/**
|
case BIRCH_PLANKS:
|
||||||
* Gets the minimum quantity of repair materials ignoring all other repair bonuses
|
case DARK_OAK_PLANKS:
|
||||||
*
|
case JUNGLE_PLANKS:
|
||||||
* This is typically set to the number of items needed to create that item, for example 5 for helmets or 2 for swords
|
case OAK_PLANKS:
|
||||||
*
|
case SPRUCE_PLANKS:
|
||||||
* @return the minimum number of items
|
return ItemMaterialCategory.WOOD;
|
||||||
*//*
|
|
||||||
|
|
||||||
public int getMinimumQuantity();
|
case STONE:
|
||||||
|
return ItemMaterialCategory.STONE;
|
||||||
|
|
||||||
*/
|
case IRON_INGOT:
|
||||||
/**
|
return ItemMaterialCategory.IRON;
|
||||||
* Gets the maximum durability of this item before it breaks
|
|
||||||
*
|
|
||||||
* @return the maximum durability
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public short getMaximumDurability();
|
case GOLD_INGOT:
|
||||||
|
return ItemMaterialCategory.GOLD;
|
||||||
|
|
||||||
*/
|
case DIAMOND:
|
||||||
/**
|
return ItemMaterialCategory.DIAMOND;
|
||||||
* Gets the base repair durability on which to calculate bonuses.
|
|
||||||
*
|
|
||||||
* This is actually the maximum durability divided by the minimum quantity
|
|
||||||
*
|
|
||||||
* @return the base repair durability
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public short getBaseRepairDurability();
|
default:
|
||||||
|
return ItemMaterialCategory.OTHER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
private ItemType determineItemType(Material material)
|
||||||
/**
|
{
|
||||||
* Gets the minimum repair level needed to repair this item
|
if (ItemUtils.isMinecraftTool(new ItemStack(material))) {
|
||||||
*
|
return ItemType.TOOL;
|
||||||
* @return the minimum level to repair this item, or 0 for no minimum
|
}
|
||||||
*//*
|
else if (ItemUtils.isArmor(new ItemStack((material)))) {
|
||||||
|
return ItemType.ARMOR;
|
||||||
|
} else {
|
||||||
|
return ItemType.OTHER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getMinimumLevel();
|
public Material getItemMaterial() {
|
||||||
|
return itemMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public List<Material> getRepairMaterials() {
|
||||||
/**
|
return repairMaterials;
|
||||||
* Gets the xpMultiplier for this repairable
|
}
|
||||||
*
|
|
||||||
* @return the xpMultiplier of this repairable
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public double getXpMultiplier();
|
public List<String> getRepairMaterialsRegistryKeys() {
|
||||||
|
return ItemUtils.getRepairItemMaterials(repairMaterials);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ItemType getRepairItemType() {
|
||||||
|
return repairItemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemMaterialCategory getRepairItemMaterialCategory() {
|
||||||
|
return repairItemMaterialCategory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinimumQuantity() {
|
||||||
|
return minimumQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getMaximumDurability() {
|
||||||
|
return maximumDurability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getBaseRepairDurability() {
|
||||||
|
return baseRepairDurability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinimumLevel() {
|
||||||
|
return minimumLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getXpMultiplier() {
|
||||||
|
return xpMultiplier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
@ -1,31 +1,32 @@
|
|||||||
package com.gmail.nossr50.skills.repair.repairables;
|
package com.gmail.nossr50.skills.repair.repairables;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.Unload;
|
||||||
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.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SimpleRepairableManager implements Unload {
|
public class RepairableManager implements Unload {
|
||||||
private HashMap<Material, SimpleRepairable> repairables;
|
private HashMap<Material, Repairable> repairables;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unload() {
|
public void unload() {
|
||||||
repairables.clear();
|
repairables.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleRepairableManager(List<SimpleRepairable> repairablesCollection) {
|
public RepairableManager(List<Repairable> repairablesCollection) {
|
||||||
this.repairables = new HashMap<Material, SimpleRepairable>(repairablesCollection.size());
|
this.repairables = new HashMap<Material, Repairable>(repairablesCollection.size());
|
||||||
registerRepairables(repairablesCollection);
|
registerRepairables(repairablesCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerRepairable(SimpleRepairable repairable) {
|
public void registerRepairable(Repairable repairable) {
|
||||||
Material item = repairable.getItemMaterial();
|
Material item = repairable.getItemMaterial();
|
||||||
repairables.put(item, repairable);
|
repairables.put(item, repairable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerRepairables(List<SimpleRepairable> repairables) {
|
public void registerRepairables(List<Repairable> repairables) {
|
||||||
for (SimpleRepairable repairable : repairables) {
|
for (Repairable repairable : repairables) {
|
||||||
registerRepairable(repairable);
|
registerRepairable(repairable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +39,7 @@ public class SimpleRepairableManager implements Unload {
|
|||||||
return isRepairable(itemStack.getType());
|
return isRepairable(itemStack.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleRepairable getRepairable(Material type) {
|
public Repairable getRepairable(Material type) {
|
||||||
return repairables.get(type);
|
return repairables.get(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,129 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.repair.repairables;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class SimpleRepairable {
|
|
||||||
private final Material itemMaterial;
|
|
||||||
private final List<Material> repairMaterials;
|
|
||||||
private final int minimumQuantity, minimumLevel;
|
|
||||||
private final short maximumDurability, baseRepairDurability;
|
|
||||||
private final ItemType repairItemType;
|
|
||||||
private final ItemMaterialCategory repairItemMaterialCategory;
|
|
||||||
private final double xpMultiplier;
|
|
||||||
|
|
||||||
public SimpleRepairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
|
||||||
this(itemMaterial.getKey().getKey(), ItemUtils.getRepairItemMaterials(Arrays.asList(repairMaterial)), minimumQuantity, minimumLevel, xpMultiplier);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SimpleRepairable(Material itemMaterial, List<Material> repairMaterials, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
|
||||||
this(itemMaterial.getKey().getKey(), ItemUtils.getRepairItemMaterials(repairMaterials), minimumQuantity, minimumLevel, xpMultiplier);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SimpleRepairable(String itemMaterial, List<String> repairMaterials, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
|
||||||
this.itemMaterial = Material.matchMaterial(itemMaterial);
|
|
||||||
this.repairMaterials = ItemUtils.matchMaterials(repairMaterials);
|
|
||||||
this.minimumQuantity = minimumQuantity;
|
|
||||||
this.minimumLevel = minimumLevel;
|
|
||||||
this.xpMultiplier = xpMultiplier;
|
|
||||||
|
|
||||||
this.maximumDurability = this.itemMaterial.getMaxDurability();
|
|
||||||
this.baseRepairDurability = (short) (maximumDurability / minimumQuantity);
|
|
||||||
|
|
||||||
this.repairItemType = determineItemType(this.itemMaterial);
|
|
||||||
this.repairItemMaterialCategory = determineMaterialType(this.repairMaterials.get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemMaterialCategory determineMaterialType(Material material) {
|
|
||||||
switch (material) {
|
|
||||||
case STRING:
|
|
||||||
return ItemMaterialCategory.STRING;
|
|
||||||
|
|
||||||
case LEATHER:
|
|
||||||
return ItemMaterialCategory.LEATHER;
|
|
||||||
|
|
||||||
case ACACIA_PLANKS:
|
|
||||||
case BIRCH_PLANKS:
|
|
||||||
case DARK_OAK_PLANKS:
|
|
||||||
case JUNGLE_PLANKS:
|
|
||||||
case OAK_PLANKS:
|
|
||||||
case SPRUCE_PLANKS:
|
|
||||||
return ItemMaterialCategory.WOOD;
|
|
||||||
|
|
||||||
case STONE:
|
|
||||||
return ItemMaterialCategory.STONE;
|
|
||||||
|
|
||||||
case IRON_INGOT:
|
|
||||||
return ItemMaterialCategory.IRON;
|
|
||||||
|
|
||||||
case GOLD_INGOT:
|
|
||||||
return ItemMaterialCategory.GOLD;
|
|
||||||
|
|
||||||
case DIAMOND:
|
|
||||||
return ItemMaterialCategory.DIAMOND;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return ItemMaterialCategory.OTHER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ItemType determineItemType(Material material)
|
|
||||||
{
|
|
||||||
if (ItemUtils.isMinecraftTool(new ItemStack(material))) {
|
|
||||||
return ItemType.TOOL;
|
|
||||||
}
|
|
||||||
else if (ItemUtils.isArmor(new ItemStack((material)))) {
|
|
||||||
return ItemType.ARMOR;
|
|
||||||
} else {
|
|
||||||
return ItemType.OTHER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Material getItemMaterial() {
|
|
||||||
return itemMaterial;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Material> getRepairMaterials() {
|
|
||||||
return repairMaterials;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getRepairMaterialsRegistryKeys() {
|
|
||||||
return ItemUtils.getRepairItemMaterials(repairMaterials);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ItemType getRepairItemType() {
|
|
||||||
return repairItemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemMaterialCategory getRepairItemMaterialCategory() {
|
|
||||||
return repairItemMaterialCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMinimumQuantity() {
|
|
||||||
return minimumQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getMaximumDurability() {
|
|
||||||
return maximumDurability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public short getBaseRepairDurability() {
|
|
||||||
return baseRepairDurability;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMinimumLevel() {
|
|
||||||
return minimumLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getXpMultiplier() {
|
|
||||||
return xpMultiplier;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,103 +1,89 @@
|
|||||||
/*
|
|
||||||
package com.gmail.nossr50.skills.salvage.salvageables;
|
package com.gmail.nossr50.skills.salvage.salvageables;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public interface Salvageable {
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Gets the type of this salvageable item
|
|
||||||
*
|
|
||||||
* @return the type of this salvageable
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public Material getItemMaterial();
|
public class Salvageable {
|
||||||
|
private final Material itemMaterial, salvagedItemMaterial;
|
||||||
|
private final int maximumQuantity, minimumLevel;
|
||||||
|
private final short maximumDurability, baseSalvageDurability;
|
||||||
|
private final byte salvageMetadata;
|
||||||
|
private final ItemType salvageItemType;
|
||||||
|
private final ItemMaterialCategory salvageItemMaterialCategory;
|
||||||
|
private final double xpMultiplier;
|
||||||
|
|
||||||
*/
|
/*protected Salvageable(Material type, Material salvagedItemMaterial, byte salvageMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType salvageItemType, ItemMaterialCategory salvageItemMaterialCategory, double xpMultiplier) {
|
||||||
/**
|
this.itemMaterial = type;
|
||||||
* Gets the material of the items dropped when salvaging this item
|
this.salvagedItemMaterial = salvagedItemMaterial;
|
||||||
*
|
this.salvageMetadata = salvageMetadata;
|
||||||
* @return the material of the salvage drop
|
this.salvageItemType = salvageItemType;
|
||||||
*//*
|
this.salvageItemMaterialCategory = salvageItemMaterialCategory;
|
||||||
|
this.minimumLevel = minimumLevel;
|
||||||
|
this.maximumQuantity = maximumQuantity;
|
||||||
|
this.maximumDurability = maximumDurability;
|
||||||
|
this.baseSalvageDurability = (short) (maximumDurability / maximumQuantity);
|
||||||
|
this.xpMultiplier = xpMultiplier;
|
||||||
|
}*/
|
||||||
|
|
||||||
public Material getSalvageMaterial();
|
public Salvageable(String itemRegisterKey, String salvagedMaterialRegisterKey, int minimumLevel, int maximumQuantity)
|
||||||
|
{
|
||||||
|
this(Material.matchMaterial(itemRegisterKey), Material.matchMaterial(salvagedMaterialRegisterKey), minimumLevel, maximumQuantity);
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public Salvageable(Material itemMaterial, Material salvagedItemMaterial, int minimumLevel, int maximumQuantity)
|
||||||
/**
|
{
|
||||||
* Gets the metadata byte value of the items dropped when salvaging this item
|
|
||||||
*
|
|
||||||
* @return the byte metadata of the salvage drop
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public byte getSalvageMaterialMetadata();
|
this.itemMaterial = itemMaterial;
|
||||||
|
this.salvagedItemMaterial = salvagedItemMaterial;
|
||||||
|
// this.salvageMetadata = salvageMetadata;
|
||||||
|
this.salvageItemType = salvageItemType;
|
||||||
|
this.salvageItemMaterialCategory = salvageItemMaterialCategory;
|
||||||
|
this.minimumLevel = minimumLevel;
|
||||||
|
this.maximumQuantity = maximumQuantity;
|
||||||
|
this.maximumDurability = maximumDurability;
|
||||||
|
this.baseSalvageDurability = (short) (maximumDurability / maximumQuantity);
|
||||||
|
this.xpMultiplier = xpMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public Material getItemMaterial() {
|
||||||
/**
|
return itemMaterial;
|
||||||
* Gets the ItemType value for this salvageable item
|
}
|
||||||
*
|
|
||||||
* @return the ItemType for this salvageable
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public ItemType getSalvageItemType();
|
public Material getSalvagedItemMaterial() {
|
||||||
|
return salvagedItemMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
/*public byte getSalvageMaterialMetadata() {
|
||||||
/**
|
return salvageMetadata;
|
||||||
* Gets the ItemMaterialCategory value for this salvageable item
|
}*/
|
||||||
*
|
|
||||||
* @return the ItemMaterialCategory for this salvageable
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public ItemMaterialCategory getSalvageItemMaterialCategory();
|
public ItemType getSalvageItemType() {
|
||||||
|
return salvageItemType;
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public ItemMaterialCategory getSalvageItemMaterialCategory() {
|
||||||
/**
|
return salvageItemMaterialCategory;
|
||||||
* Gets the maximum quantity of salvage materials ignoring all other salvage bonuses
|
}
|
||||||
*
|
|
||||||
* This is typically set to the number of items needed to create that item, for example 5 for helmets or 2 for swords
|
|
||||||
*
|
|
||||||
* @return the maximum number of items
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public int getMaximumQuantity();
|
public int getMaximumQuantity() {
|
||||||
|
return maximumQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public short getMaximumDurability() {
|
||||||
/**
|
return maximumDurability;
|
||||||
* Gets the maximum durability of this item before it breaks
|
}
|
||||||
*
|
|
||||||
* @return the maximum durability
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public short getMaximumDurability();
|
public short getBaseSalvageDurability() {
|
||||||
|
return baseSalvageDurability;
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public int getMinimumLevel() {
|
||||||
/**
|
return minimumLevel;
|
||||||
* Gets the base salvage durability on which to calculate bonuses.
|
}
|
||||||
*
|
|
||||||
* This is actually the maximum durability divided by the minimum quantity
|
|
||||||
*
|
|
||||||
* @return the base salvage durability
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public short getBaseSalvageDurability();
|
public double getXpMultiplier() {
|
||||||
|
return xpMultiplier;
|
||||||
*/
|
}
|
||||||
/**
|
|
||||||
* Gets the minimum salvage level needed to salvage this item
|
|
||||||
*
|
|
||||||
* @return the minimum level to salvage this item, or 0 for no minimum
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public int getMinimumLevel();
|
|
||||||
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Gets the xpMultiplier for this salvageable
|
|
||||||
*
|
|
||||||
* @return the xpMultiplier of this salvageable
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public double getXpMultiplier();
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
@ -11,6 +11,6 @@ public class SalvageableFactory {
|
|||||||
|
|
||||||
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType repairItemType, ItemMaterialCategory repairItemMaterialCategory, double xpMultiplier) {
|
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType repairItemType, ItemMaterialCategory repairItemMaterialCategory, double xpMultiplier) {
|
||||||
// TODO: Add in loading from config what type of repairable we want.
|
// TODO: Add in loading from config what type of repairable we want.
|
||||||
return new SimpleSalvageable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, maximumQuantity, maximumDurability, repairItemType, repairItemMaterialCategory, xpMultiplier);
|
return new Salvageable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, maximumQuantity, maximumDurability, repairItemType, repairItemMaterialCategory, xpMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,62 +1,50 @@
|
|||||||
/*
|
|
||||||
package com.gmail.nossr50.skills.salvage.salvageables;
|
package com.gmail.nossr50.skills.salvage.salvageables;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Unload;
|
import com.gmail.nossr50.config.Unload;
|
||||||
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;
|
import java.util.List;
|
||||||
|
|
||||||
public interface SalvageableManager extends Unload {
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Register a salvageable with the SalvageManager
|
|
||||||
*
|
|
||||||
* @param salvageable Salvageable to register
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public void registerSalvageable(Salvageable salvageable);
|
public class SalvageableManager implements Unload {
|
||||||
|
private HashMap<Material, Salvageable> salvageables;
|
||||||
|
|
||||||
*/
|
/*public SalvageableManager() {
|
||||||
/**
|
this(55);
|
||||||
* Register a list of salvageables with the SalvageManager
|
}*/
|
||||||
*
|
|
||||||
* @param salvageables List<Salvageable> to register
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public void registerSalvageables(List<Salvageable> salvageables);
|
@Override
|
||||||
|
public void unload() {
|
||||||
|
salvageables.clear();
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public SalvageableManager(List<Salvageable> salvageablesCollection) {
|
||||||
/**
|
this.salvageables = new HashMap<Material, Salvageable>(salvageablesCollection.size());
|
||||||
* Checks if an item is salvageable
|
registerSalvageables(salvageablesCollection);
|
||||||
*
|
}
|
||||||
* @param type Material to check if salvageable
|
|
||||||
*
|
|
||||||
* @return true if salvageable, false if not
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public boolean isSalvageable(Material type);
|
public void registerSalvageable(Salvageable salvageable) {
|
||||||
|
Material item = salvageable.getItemMaterial();
|
||||||
|
salvageables.put(item, salvageable);
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public void registerSalvageables(List<Salvageable> salvageables) {
|
||||||
/**
|
for (Salvageable salvageable : salvageables) {
|
||||||
* Checks if an item is salvageable
|
registerSalvageable(salvageable);
|
||||||
*
|
}
|
||||||
* @param itemStack Item to check if salvageable
|
}
|
||||||
*
|
|
||||||
* @return true if salvageable, false if not
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public boolean isSalvageable(ItemStack itemStack);
|
public boolean isSalvageable(Material type) {
|
||||||
|
return salvageables.containsKey(type);
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
public boolean isSalvageable(ItemStack itemStack) {
|
||||||
/**
|
return isSalvageable(itemStack.getType());
|
||||||
* Gets the salvageable with this type
|
}
|
||||||
*
|
|
||||||
* @param type Material of the salvageable to look for
|
|
||||||
*
|
|
||||||
* @return the salvageable, can be null
|
|
||||||
*//*
|
|
||||||
|
|
||||||
public Salvageable getSalvageable(Material type);
|
public Salvageable getSalvageable(Material type) {
|
||||||
|
return salvageables.get(type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.salvage.salvageables;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
|
|
||||||
public class SimpleSalvageable implements Salvageable {
|
|
||||||
private final Material itemMaterial, salvageMaterial;
|
|
||||||
private final int maximumQuantity, minimumLevel;
|
|
||||||
private final short maximumDurability, baseSalvageDurability;
|
|
||||||
private final byte salvageMetadata;
|
|
||||||
private final ItemType salvageItemType;
|
|
||||||
private final ItemMaterialCategory salvageItemMaterialCategory;
|
|
||||||
private final double xpMultiplier;
|
|
||||||
|
|
||||||
protected SimpleSalvageable(Material type, Material salvageMaterial, byte salvageMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType salvageItemType, ItemMaterialCategory salvageItemMaterialCategory, double xpMultiplier) {
|
|
||||||
this.itemMaterial = type;
|
|
||||||
this.salvageMaterial = salvageMaterial;
|
|
||||||
this.salvageMetadata = salvageMetadata;
|
|
||||||
this.salvageItemType = salvageItemType;
|
|
||||||
this.salvageItemMaterialCategory = salvageItemMaterialCategory;
|
|
||||||
this.minimumLevel = minimumLevel;
|
|
||||||
this.maximumQuantity = maximumQuantity;
|
|
||||||
this.maximumDurability = maximumDurability;
|
|
||||||
this.baseSalvageDurability = (short) (maximumDurability / maximumQuantity);
|
|
||||||
this.xpMultiplier = xpMultiplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Material getItemMaterial() {
|
|
||||||
return itemMaterial;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Material getSalvageMaterial() {
|
|
||||||
return salvageMaterial;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte getSalvageMaterialMetadata() {
|
|
||||||
return salvageMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemType getSalvageItemType() {
|
|
||||||
return salvageItemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemMaterialCategory getSalvageItemMaterialCategory() {
|
|
||||||
return salvageItemMaterialCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaximumQuantity() {
|
|
||||||
return maximumQuantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public short getMaximumDurability() {
|
|
||||||
return maximumDurability;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public short getBaseSalvageDurability() {
|
|
||||||
return baseSalvageDurability;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMinimumLevel() {
|
|
||||||
return minimumLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getXpMultiplier() {
|
|
||||||
return xpMultiplier;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
package com.gmail.nossr50.skills.salvage.salvageables;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class SimpleSalvageableManager implements SalvageableManager {
|
|
||||||
private HashMap<Material, Salvageable> salvageables;
|
|
||||||
|
|
||||||
/*public SimpleSalvageableManager() {
|
|
||||||
this(55);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unload() {
|
|
||||||
salvageables.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public SimpleSalvageableManager(List<Salvageable> salvageablesCollection) {
|
|
||||||
this.salvageables = new HashMap<Material, Salvageable>(salvageablesCollection.size());
|
|
||||||
registerSalvageables(salvageablesCollection);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerSalvageable(Salvageable salvageable) {
|
|
||||||
Material item = salvageable.getItemMaterial();
|
|
||||||
salvageables.put(item, salvageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerSalvageables(List<Salvageable> salvageables) {
|
|
||||||
for (Salvageable salvageable : salvageables) {
|
|
||||||
registerSalvageable(salvageable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSalvageable(Material type) {
|
|
||||||
return salvageables.containsKey(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSalvageable(ItemStack itemStack) {
|
|
||||||
return isSalvageable(itemStack.getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Salvageable getSalvageable(Material type) {
|
|
||||||
return salvageables.get(type);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user