Added a config option to make default classes save their current data when switching to another class

This commit is contained in:
ASangarin 2021-08-06 17:06:26 +02:00
parent 7496b2d2b9
commit c9d9926f32
3 changed files with 8 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import net.Indyuce.mmocore.MMOCore;
import org.bukkit.configuration.ConfigurationSection;
import com.google.gson.JsonElement;
@ -143,7 +144,7 @@ public class SavedClassInformation {
* saves current class info inside a SavedClassInformation, only if the
* class is a real class and not the default one.
*/
if (!player.getProfess().hasOption(ClassOption.DEFAULT))
if (!player.getProfess().hasOption(ClassOption.DEFAULT) || MMOCore.plugin.configManager.saveDefaultClassInfo)
player.applyClassInfo(player.getProfess(), new SavedClassInformation(player));
/*

View File

@ -24,7 +24,7 @@ import java.util.logging.Level;
public class ConfigManager {
public final CommandVerbose commandVerbose = new CommandVerbose();
public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP;
public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo;
public double expPartyBuff, regenPartyBuff;
public String partyChatPrefix, noSkillBoundPlaceholder;
public ChatColor staminaFull, staminaHalf, staminaEmpty;
@ -107,6 +107,7 @@ public class ConfigManager {
sneakingSwapAction = EnumUtils.getIfPresent(SwapAction.class, MMOCore.plugin.getConfig().getString("swap-keybind.sneaking").toUpperCase()).orElse(SwapAction.VANILLA);
canCreativeCast = MMOCore.plugin.getConfig().getBoolean("can-creative-cast");
cobbleGeneratorXP = MMOCore.plugin.getConfig().getBoolean("should-cobblestone-generators-give-exp");
saveDefaultClassInfo = MMOCore.plugin.getConfig().getBoolean("save-default-class-info");
}
private ChatColor getColorOrDefault(String key, ChatColor defaultColor) {

View File

@ -162,6 +162,10 @@ prevent-spawner-xp: true
combat-log:
timer: 10
# Whether or not the default class should save information (level,
# skills, etc.) when selecting a new class
save-default-class-info: false
# Change this to the name of the color you want for
# the different resource bar placeholders
resource-bar-colors: