Security check on setcurrentskilltitle command, so a player must actually own the skill that they want to use the title for

This commit is contained in:
Ziggy
2022-06-28 04:06:31 +02:00
parent ef22fbd7c0
commit 2ef33f314c
@@ -9,6 +9,7 @@ import com.projectswg.holocore.resources.support.data.server_info.loader.DataLoa
import com.projectswg.holocore.resources.support.data.server_info.loader.SkillLoader;
import com.projectswg.holocore.resources.support.data.server_info.loader.SkillLoader.SkillInfo;
import com.projectswg.holocore.resources.support.objects.swg.creature.CreatureObject;
import com.projectswg.holocore.resources.support.objects.swg.player.PlayerObject;
import com.projectswg.holocore.services.gameplay.player.experience.*;
import me.joshlarson.jlcommon.control.IntentHandler;
import me.joshlarson.jlcommon.control.Service;
@@ -109,7 +110,14 @@ public class SkillService extends Service {
return;
}
sti.getRequester().setTitle(title);
PlayerObject requester = sti.getRequester();
CreatureObject creatureObject = Objects.requireNonNull(requester.getOwner()).getCreatureObject();
Set<String> skills = creatureObject.getSkills();
if (skills.contains(title)) {
requester.setTitle(title);
}
}
@IntentHandler