Try to reinforce non-nullability in xp interface callback
This commit is contained in:
+5
-5
@@ -68,19 +68,19 @@ class LarryHandler(player: Player? = null) : DialoguePlugin(player){
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleSelectionCallback(skill: Int, player: Player?) {
|
override fun handleSelectionCallback(skill: Int, player: Player) {
|
||||||
val points = player?.getAttribute("phns:points",0)
|
val points = player.getAttribute("phns:points",0)
|
||||||
if(points == 0){
|
if(points == 0){
|
||||||
player.sendMessage("Sorry, but you have no points to redeem.")
|
player.sendMessage("Sorry, but you have no points to redeem.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val level = player?.skills?.getLevel(skill) ?: 0
|
val level = player.skills.getLevel(skill) ?: 0
|
||||||
System.out.println("Level: $level")
|
System.out.println("Level: $level")
|
||||||
val expGained = points?.toDouble()?.times((level * 25))
|
val expGained = points?.toDouble()?.times((level * 25))
|
||||||
System.out.print("exp: $expGained")
|
System.out.print("exp: $expGained")
|
||||||
player?.skills?.addExperience(skill,expGained!!)
|
player.skills.addExperience(skill,expGained!!)
|
||||||
player?.setAttribute("/save:phns:points",0)
|
player.setAttribute("/save:phns:points",0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getIds(): IntArray {
|
override fun getIds(): IntArray {
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ class ExperienceInterface() : ComponentPlugin() {
|
|||||||
46 -> Skills.WOODCUTTING
|
46 -> Skills.WOODCUTTING
|
||||||
40 -> Skills.FLETCHING
|
40 -> Skills.FLETCHING
|
||||||
51 -> Skills.CONSTRUCTION
|
51 -> Skills.CONSTRUCTION
|
||||||
52 -> Skills.SUMMONING
|
|
||||||
else -> Skills.SLAYER.also { SystemLogger.logWarn("EXP_INTERFACE: Invalid SKILL CHOICE BUTTON: $button") }
|
else -> Skills.SLAYER.also { SystemLogger.logWarn("EXP_INTERFACE: Invalid SKILL CHOICE BUTTON: $button") }
|
||||||
}
|
}
|
||||||
player.setAttribute("exp_interface:skill",skill)
|
player.setAttribute("exp_interface:skill",skill)
|
||||||
|
|||||||
Reference in New Issue
Block a user