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

View File

@ -115,8 +115,8 @@ public class DynamicSettingsManager {
*/ */
public void registerBonusDrops() { public void registerBonusDrops() {
bonusDropManager.addToWhitelistByNameID(mcMMO.getConfigManager().getConfigMining().getBonusDrops()); bonusDropManager.addToWhitelistByNameID(mcMMO.getConfigManager().getConfigMining().getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configHerbalism.getBonusDrops()); // bonusDropManager.addToWhitelistByNameID(mcMMO.getConfigManager().getConfigHerbalism().getBonusDrops());
// bonusDropManager.addToWhitelistByNameID(configWoodcutting.getBonusDrops()); // bonusDropManager.addToWhitelistByNameID(mcMMO.getConfigManager().getConfigWoodcutting().getBonusDrops());
} }
public RepairableManager getRepairableManager() { 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 PLAYER_DATA_METAKEY = "mcMMO: Player Data";
public final static String GREEN_THUMB_METAKEY = "mcMMO: Green Thumb"; 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 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 public static FixedMetadataValue metadataValue; //Gains value in onEnable

View File

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

View File

@ -144,7 +144,7 @@ public class mcMMO extends JavaPlugin {
formulaManager = new FormulaManager(); formulaManager = new FormulaManager();
for (Player player : getServer().getOnlinePlayers()) { 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!"); debug("Version " + getDescription().getVersion() + " is enabled!");
@ -154,7 +154,7 @@ public class mcMMO extends JavaPlugin {
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
if (mcMMO.getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) { if (getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
Permissions.generateWorldTeleportPermissions(); Permissions.generateWorldTeleportPermissions();
} }
@ -205,7 +205,7 @@ public class mcMMO extends JavaPlugin {
PartyManager.saveParties(); // Save our parties PartyManager.saveParties(); // Save our parties
//TODO: Needed? //TODO: Needed?
if (mcMMO.getScoreboardSettings().getScoreboardsEnabled()) if (getScoreboardSettings().getScoreboardsEnabled())
ScoreboardManager.teardownAll(); ScoreboardManager.teardownAll();
formulaManager.saveFormula(); formulaManager.saveFormula();
@ -221,7 +221,7 @@ public class mcMMO extends JavaPlugin {
debug("Unregister all events..."); debug("Unregister all events...");
HandlerList.unregisterAll(this); // Cancel event registrations 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. // Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
try { try {
ZipLibrary.mcMMOBackup(); ZipLibrary.mcMMOBackup();
@ -318,8 +318,8 @@ public class mcMMO extends JavaPlugin {
} }
@Deprecated @Deprecated
public static void setDatabaseManager(DatabaseManager databaseManager) { public static void setDatabaseManager(DatabaseManager newDatabaseManager) {
mcMMO.databaseManager = databaseManager; databaseManager = newDatabaseManager;
} }
/** /**
@ -533,7 +533,7 @@ public class mcMMO extends JavaPlugin {
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks); new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
// Cleanup the backups folder // Cleanup the backups folder
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p); new CleanBackupsTask().runTaskAsynchronously(this);
// Bleed timer (Runs every 0.5 seconds) // Bleed timer (Runs every 0.5 seconds)
new BleedTimerTask().runTaskTimer(this, Misc.TICK_CONVERSION_FACTOR, (Misc.TICK_CONVERSION_FACTOR / 2)); 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 // Old & Powerless User remover
long purgeIntervalTicks = getConfigManager().getConfigDatabase().getConfigSectionCleaning().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR; 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. new UserPurgeTask().runTaskLaterAsynchronously(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
} else if (purgeIntervalTicks > 0) { } else if (purgeIntervalTicks > 0) {
new UserPurgeTask().runTaskTimerAsynchronously(this, purgeIntervalTicks, purgeIntervalTicks); new UserPurgeTask().runTaskTimerAsynchronously(this, purgeIntervalTicks, purgeIntervalTicks);
} }
//Party System Stuff //Party System Stuff
if (mcMMO.configManager.getConfigParty().isPartySystemEnabled()) { if (configManager.getConfigParty().isPartySystemEnabled()) {
// Automatically remove old members from parties // Automatically remove old members from parties
long kickIntervalTicks = getConfigManager().getConfigParty().getPartyCleanup().getPartyAutoKickHoursInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR; 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); 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 // 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); new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
} }

View File

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