Sweenus / SimplySkills

Other
11 stars 15 forks source link

enabling default puffish skills doesn't enable puffish skill trees #46

Closed hermyt closed 4 months ago

hermyt commented 6 months ago

It looks as though the menu option in config for enabling puffish skills alongside the simply skills tree doesn't work.

I think its related to this area of code:

ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> { if (generalConfig.disableDefaultPuffishTrees) { processPlayer(handler.player); } ModPacketHandler.sendSignatureAbility(handler.player);

private void processPlayer(ServerPlayerEntity player) {
    List<Category> unlockedCategories = SkillsAPI.getUnlockedCategories(player);
    if (!unlockedCategories.isEmpty()) {
        unlockedCategories.forEach(category -> processCategory(player, category));
    }
}

private void processCategory(ServerPlayerEntity player, Category category) {
    String categoryId = category.getId().toString();
    if (categoryId.equals("minecraft:combat") || categoryId.equals("minecraft:mining")) {
        SkillsAPI.getCategory(new Identifier(categoryId)).ifPresent(categoryObj -> {
            categoryObj.erase(player);
            categoryObj.lock(player);
        });
    }

` It looks as though when the default of disabled happens the first player joining on a fresh game or server gets the puffish categories deleted which seems to save in the puffish_skills.dat file. When the option is changed to 'false' the puffish skills trees remain deleted for that player.

I worked around the issue by deleting the puffish_skills.dat for the game which reset the skill trees and player information which works fine for a fresh game.

Sweenus commented 4 months ago

Hi there, It is intended that the user unlock the trees again with the following chat commands after they have re-enabled the trees via the config: /puffish_skills category unlock playername puffish_skills:mining /puffish_skills category unlock playername puffish_skills:combat

It sounds like you've found an alternate way to achieve this though 🙂