Further cleanup

This commit is contained in:
nossr50 2019-05-13 03:49:33 -07:00
parent 3f6a33dea6
commit d1298c0cd2
6 changed files with 20 additions and 35 deletions

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.config.hocon.experience;
import com.gmail.nossr50.datatypes.experience.CustomXPPerk;
import com.gmail.nossr50.datatypes.experience.SpecialXPKey;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -162,7 +163,7 @@ public class ConfigExperience {
return getConfigExperienceSkills().getCombatExperienceMap();
}
public HashMap<String, Float> getSpecialCombatExperienceMap() {
public HashMap<SpecialXPKey, Float> getSpecialCombatExperienceMap() {
return configExperienceSkills.getSpecialCombatExperienceMap();
}
@ -190,22 +191,6 @@ public class ConfigExperience {
return getConfigExperienceSkills().getShakeXP();
}
public Float getSpawnedMobXPMult() {
return getConfigExperienceSkills().getSpawnedMobXPMult();
}
public Float getPlayerBredMobsXPMult() {
return getExperienceCombat().getPlayerBredMobsXPMult();
}
public Float getPVPXPMult() {
return getConfigExperienceSkills().getPVPXPMult();
}
public Float getAnimalsXPMult() {
return getConfigExperienceSkills().getAnimalsXPMult();
}
public ConfigExperienceSkills getConfigExperienceSkills() {
return configExperienceSkills;
}

View File

@ -115,8 +115,8 @@ public class DynamicSettingsManager {
*/
public void registerBonusDrops() {
bonusDropManager.addToWhitelistByNameID(mcMMO.getConfigManager().getConfigMining().getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configWoodcutting.getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(mcMMO.getConfigManager().getConfigHerbalism().getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(mcMMO.getConfigManager().getConfigWoodcutting().getBonusDrops());
}
public RepairableManager getRepairableManager() {

View File

@ -27,7 +27,7 @@ public class MetadataConstants {
public final static String PLAYER_DATA_METAKEY = "mcMMO: Player Data";
public final static String GREEN_THUMB_METAKEY = "mcMMO: Green Thumb";
public final static String DATABASE_PROCESSING_COMMAND_METAKEY = "mcMMO: Processing Database Command";
public final static String BRED_ANIMAL_TRACKING_METAKEY = "mcMMO: Bred Animal";
public final static String PETS_ANIMAL_TRACKING_METAKEY = "mcMMO: Pet Animal";
public static FixedMetadataValue metadataValue; //Gains value in onEnable

View File

@ -629,7 +629,7 @@ public class EntityListener implements Listener {
return;
case BREEDING:
entity.setMetadata(MetadataConstants.BRED_ANIMAL_TRACKING_METAKEY, MetadataConstants.metadataValue);
entity.setMetadata(MetadataConstants.PETS_ANIMAL_TRACKING_METAKEY, MetadataConstants.metadataValue);
return;
default:

View File

@ -144,7 +144,7 @@ public class mcMMO extends JavaPlugin {
formulaManager = new FormulaManager();
for (Player player : getServer().getOnlinePlayers()) {
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(this, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
}
debug("Version " + getDescription().getVersion() + " is enabled!");
@ -154,7 +154,7 @@ public class mcMMO extends JavaPlugin {
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
if (mcMMO.getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
if (getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
Permissions.generateWorldTeleportPermissions();
}
@ -205,7 +205,7 @@ public class mcMMO extends JavaPlugin {
PartyManager.saveParties(); // Save our parties
//TODO: Needed?
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled())
if (getScoreboardSettings().getScoreboardsEnabled())
ScoreboardManager.teardownAll();
formulaManager.saveFormula();
@ -221,7 +221,7 @@ public class mcMMO extends JavaPlugin {
debug("Unregister all events...");
HandlerList.unregisterAll(this); // Cancel event registrations
if (mcMMO.getConfigManager().getConfigAutomatedBackups().isZipBackupsEnabled()) {
if (getConfigManager().getConfigAutomatedBackups().isZipBackupsEnabled()) {
// Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
try {
ZipLibrary.mcMMOBackup();
@ -318,8 +318,8 @@ public class mcMMO extends JavaPlugin {
}
@Deprecated
public static void setDatabaseManager(DatabaseManager databaseManager) {
mcMMO.databaseManager = databaseManager;
public static void setDatabaseManager(DatabaseManager newDatabaseManager) {
databaseManager = newDatabaseManager;
}
/**
@ -533,7 +533,7 @@ public class mcMMO extends JavaPlugin {
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
// Cleanup the backups folder
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
new CleanBackupsTask().runTaskAsynchronously(this);
// Bleed timer (Runs every 0.5 seconds)
new BleedTimerTask().runTaskTimer(this, Misc.TICK_CONVERSION_FACTOR, (Misc.TICK_CONVERSION_FACTOR / 2));
@ -541,14 +541,14 @@ public class mcMMO extends JavaPlugin {
// Old & Powerless User remover
long purgeIntervalTicks = getConfigManager().getConfigDatabase().getConfigSectionCleaning().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
if (mcMMO.getDatabaseCleaningSettings().isOnlyPurgeAtStartup()) {
if (getDatabaseCleaningSettings().isOnlyPurgeAtStartup()) {
new UserPurgeTask().runTaskLaterAsynchronously(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
} else if (purgeIntervalTicks > 0) {
new UserPurgeTask().runTaskTimerAsynchronously(this, purgeIntervalTicks, purgeIntervalTicks);
}
//Party System Stuff
if (mcMMO.configManager.getConfigParty().isPartySystemEnabled()) {
if (configManager.getConfigParty().isPartySystemEnabled()) {
// Automatically remove old members from parties
long kickIntervalTicks = getConfigManager().getConfigParty().getPartyCleanup().getPartyAutoKickHoursInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
@ -563,7 +563,7 @@ public class mcMMO extends JavaPlugin {
new PowerLevelUpdatingTask().runTaskTimer(this, 2 * Misc.TICK_CONVERSION_FACTOR, 2 * Misc.TICK_CONVERSION_FACTOR);
// Clear the registered XP data so players can earn XP again
if (mcMMO.getConfigManager().getConfigExperience().get) {
if (getConfigManager().getConfigLeveling().getConfigLevelingDiminishedReturns().isDiminishedReturnsEnabled()) {
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
}

View File

@ -544,7 +544,7 @@ public final class CombatUtils {
Player defender = (Player) target;
if (defender.isOnline() && SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
baseXPMultiplier = 20 * mcMMO.getConfigManager().getConfigExperience().getPVPXPMult();
baseXPMultiplier = 20 * mcMMO.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.PVP);
}
} else {
/*if (mcMMO.getModManager().isCustomEntity(target)) {
@ -574,11 +574,11 @@ public final class CombatUtils {
}
if (target.hasMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY)) {
baseXPMultiplier *= mcMMO.getConfigManager().getConfigExperience().getSpawnedMobXPMult();
baseXPMultiplier *= mcMMO.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.SPAWNED);
}
if (target.hasMetadata(MetadataConstants.BRED_ANIMAL_TRACKING_METAKEY)) {
baseXPMultiplier *= mcMMO.getConfigManager().getConfigExperience().getPlayerBredMobsXPMult();
if (target.hasMetadata(MetadataConstants.PETS_ANIMAL_TRACKING_METAKEY)) {
baseXPMultiplier *= mcMMO.getDynamicSettingsManager().getExperienceManager().getSpecialCombatXP(SpecialXPKey.PETS);
}
xpGainReason = XPGainReason.PVE;