mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-01 16:19:53 +01:00
Most Experience related maps are now tracked via a new ExperienceMapManager to simplify loading/unloading of registered values
This commit is contained in:
parent
f0e8eb35c4
commit
76472a2b9f
@ -125,6 +125,10 @@ Version 2.1.16
|
|||||||
Giga Drill Breaker will now break "diggable" blocks even if they have no configured treasures
|
Giga Drill Breaker will now break "diggable" blocks even if they have no configured treasures
|
||||||
mcMMO's mod config system has been temporarily disabled as no modded bukkit servers even exist
|
mcMMO's mod config system has been temporarily disabled as no modded bukkit servers even exist
|
||||||
Mycellium removed from woodcutting XP (whoops)
|
Mycellium removed from woodcutting XP (whoops)
|
||||||
|
Optimized XP lookups for block breaking
|
||||||
|
Super Breaker will now break "Mining" blocks even if they have no XP entries
|
||||||
|
Tree Feller will now break "Woodcutting" blocks even if they have no XP entries
|
||||||
|
Giga Drill Breaker will now break "diggable" blocks even if they have no configured treasures
|
||||||
removed child.yml, child skills now have hard coded parents
|
removed child.yml, child skills now have hard coded parents
|
||||||
removed the hardcore and vampirism commands, these are dangerous settings and should not be toggle-able (turn them on in your configs if you want to use them)
|
removed the hardcore and vampirism commands, these are dangerous settings and should not be toggle-able (turn them on in your configs if you want to use them)
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
|||||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
|
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
|
||||||
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.SimpleSalvageableManager;
|
||||||
|
import com.gmail.nossr50.util.experience.ExperienceMapManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -50,6 +51,10 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
//TODO: Add these back when modded servers become a thing again
|
//TODO: Add these back when modded servers become a thing again
|
||||||
|
|
||||||
|
/* MISC MANAGERS */
|
||||||
|
|
||||||
|
private ExperienceMapManager experienceMapManager;
|
||||||
|
|
||||||
//private ModManager modManager;
|
//private ModManager modManager;
|
||||||
|
|
||||||
/*private ToolConfigManager toolConfigManager;
|
/*private ToolConfigManager toolConfigManager;
|
||||||
@ -127,10 +132,23 @@ public final class ConfigManager {
|
|||||||
// Multi Config Containers
|
// Multi Config Containers
|
||||||
initMultiConfigContainers();
|
initMultiConfigContainers();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Managers
|
||||||
|
*/
|
||||||
|
|
||||||
// Register Managers
|
// Register Managers
|
||||||
|
initMiscManagers();
|
||||||
initCollectionManagers();
|
initCollectionManagers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Misc managers
|
||||||
|
*/
|
||||||
|
private void initMiscManagers()
|
||||||
|
{
|
||||||
|
experienceMapManager = new ExperienceMapManager();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes all of our Multi Config Containers
|
* Initializes all of our Multi Config Containers
|
||||||
*/
|
*/
|
||||||
@ -277,4 +295,8 @@ public final class ConfigManager {
|
|||||||
public ItemWeightConfig getItemWeightConfig() {
|
public ItemWeightConfig getItemWeightConfig() {
|
||||||
return itemWeightConfig;
|
return itemWeightConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ExperienceMapManager getExperienceMapManager() {
|
||||||
|
return experienceMapManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,21 +349,6 @@ public class ExperienceConfig extends ConfigValidated {
|
|||||||
return getIntValue(path);
|
return getIntValue(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a block gives XP
|
|
||||||
* This is used to determine whether or not mcMMO should track a block that is placed by a user, among other things.
|
|
||||||
* Note: If the block has an entry in the config that will return true even if the XP is 0, this does not check the value of the XP
|
|
||||||
* @param skill The skill to check for
|
|
||||||
* @param blockType the type of block
|
|
||||||
* @return true if the block does give XP
|
|
||||||
*/
|
|
||||||
public boolean doesBlockGiveSkillXP(PrimarySkillType skill, Material blockType) {
|
|
||||||
//TODO: This used to support wildcard characters, seems a bit unnecessary to do so.
|
|
||||||
//TODO: This is going to need to be changed, this code here is only placeholder
|
|
||||||
String[] path = new String[] {EXPERIENCE, StringUtils.getCapitalized(skill.toString()), blockType.toString()};
|
|
||||||
return hasNode(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Experience Bar Stuff
|
* Experience Bar Stuff
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,116 @@
|
|||||||
|
package com.gmail.nossr50.util.experience;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.Unload;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class handles the XP for block break related XP
|
||||||
|
*/
|
||||||
|
public class ExperienceMapManager implements Unload {
|
||||||
|
public HashMap<Material, Integer> miningXpMap;
|
||||||
|
public HashMap<Material, Integer> herbalismXpMap;
|
||||||
|
public HashMap<Material, Integer> woodcuttingXpMap;
|
||||||
|
public HashMap<Material, Integer> excavationXpMap;
|
||||||
|
|
||||||
|
public ExperienceMapManager()
|
||||||
|
{
|
||||||
|
miningXpMap = new HashMap<>();
|
||||||
|
herbalismXpMap = new HashMap<>();
|
||||||
|
woodcuttingXpMap = new HashMap<>();
|
||||||
|
excavationXpMap = new HashMap<>();
|
||||||
|
|
||||||
|
//Register with unloader
|
||||||
|
mcMMO.getConfigManager().registerUnloadable(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether or not a block has Mining XP
|
||||||
|
* @param material target block material type
|
||||||
|
* @return true if the block has valid xp registers
|
||||||
|
*/
|
||||||
|
public boolean hasMiningXp(Material material)
|
||||||
|
{
|
||||||
|
return miningXpMap.get(material) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether or not a block has Herbalism XP
|
||||||
|
* @param material target block material type
|
||||||
|
* @return true if the block has valid xp registers
|
||||||
|
*/
|
||||||
|
public boolean hasHerbalismXp(Material material)
|
||||||
|
{
|
||||||
|
return herbalismXpMap.get(material) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether or not a block has Woodcutting XP
|
||||||
|
* @param material target block material type
|
||||||
|
* @return true if the block has valid xp registers
|
||||||
|
*/
|
||||||
|
public boolean hasWoodcuttingXp(Material material)
|
||||||
|
{
|
||||||
|
return woodcuttingXpMap.get(material) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether or not a block has Excavation XP
|
||||||
|
* @param material target block material type
|
||||||
|
* @return true if the block has valid xp registers
|
||||||
|
*/
|
||||||
|
public boolean hasExcavationXp(Material material)
|
||||||
|
{
|
||||||
|
return excavationXpMap.get(material) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the XP value for breaking this block from the xp map
|
||||||
|
* @param material the target block material
|
||||||
|
* @return the raw XP value before any modifiers are applied
|
||||||
|
*/
|
||||||
|
public int getMiningXp(Material material)
|
||||||
|
{
|
||||||
|
return miningXpMap.get(material);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the XP value for breaking this block from the xp map
|
||||||
|
* @param material the target block material
|
||||||
|
* @return the raw XP value before any modifiers are applied
|
||||||
|
*/
|
||||||
|
public int getHerbalismXp(Material material)
|
||||||
|
{
|
||||||
|
return herbalismXpMap.get(material);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the XP value for breaking this block from the xp map
|
||||||
|
* @param material the target block material
|
||||||
|
* @return the raw XP value before any modifiers are applied
|
||||||
|
*/
|
||||||
|
public int getWoodcuttingXp(Material material)
|
||||||
|
{
|
||||||
|
return woodcuttingXpMap.get(material);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the XP value for breaking this block from the xp map
|
||||||
|
* @param material the target block material
|
||||||
|
* @return the raw XP value before any modifiers are applied
|
||||||
|
*/
|
||||||
|
public int getExcavationXp(Material material)
|
||||||
|
{
|
||||||
|
return excavationXpMap.get(material);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unload() {
|
||||||
|
miningXpMap.clear();
|
||||||
|
woodcuttingXpMap.clear();
|
||||||
|
herbalismXpMap.clear();
|
||||||
|
excavationXpMap.clear();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user