mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-16 19:40:16 -07:00
Fixed exception thrown when invalid fairy ring codes are entered
Fixed unhandled hairdresser button that lead to OOB exception Fixed oversight in ::loc that causes exceptions to be thrown in headless environments
This commit is contained in:
parent
95414bc02b
commit
e429b15911
4 changed files with 14 additions and 6 deletions
|
|
@ -14,7 +14,6 @@ import core.game.world.update.flag.context.Animation
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
import rs09.game.content.dialogue.DialogueFile
|
import rs09.game.content.dialogue.DialogueFile
|
||||||
import rs09.game.interaction.InteractionListener
|
import rs09.game.interaction.InteractionListener
|
||||||
import rs09.tools.stringtools.RED
|
|
||||||
|
|
||||||
class SeersHouseListeners : InteractionListener {
|
class SeersHouseListeners : InteractionListener {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,10 @@ class FairyRingInterface : InterfaceListener{
|
||||||
val ring2index = player.getAttribute("fr:ring2",0)
|
val ring2index = player.getAttribute("fr:ring2",0)
|
||||||
val ring3index = player.getAttribute("fr:ring3",0)
|
val ring3index = player.getAttribute("fr:ring3",0)
|
||||||
val code = "${RING_1[ring1index]}${RING_2[ring2index]}${RING_3[ring3index]}"
|
val code = "${RING_1[ring1index]}${RING_2[ring2index]}${RING_3[ring3index]}"
|
||||||
val ring: FairyRing? = FairyRing.valueOf(code.toUpperCase())
|
val ring: FairyRing? = try {
|
||||||
|
FairyRing.valueOf(code.uppercase())
|
||||||
|
} catch (e: Exception) { null }
|
||||||
|
|
||||||
var tile = ring?.tile
|
var tile = ring?.tile
|
||||||
if(ring == FairyRing.CIP){
|
if(ring == FairyRing.CIP){
|
||||||
sendDialogue(player, "The ring seems to reject you.")
|
sendDialogue(player, "The ring seems to reject you.")
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class HairDresserInterface : ComponentPlugin(){
|
||||||
when(button){
|
when(button){
|
||||||
199 -> player.setAttribute("beard-setting",false)
|
199 -> player.setAttribute("beard-setting",false)
|
||||||
200 -> player.setAttribute("beard-setting",true)
|
200 -> player.setAttribute("beard-setting",true)
|
||||||
68,196 -> pay(player)
|
68,196,274 -> pay(player)
|
||||||
else -> when(component?.id){
|
else -> when(component?.id){
|
||||||
592 -> { //Female
|
592 -> { //Female
|
||||||
if(femaleColorButtonRange.contains(button)){
|
if(femaleColorButtonRange.contains(button)){
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import rs09.game.system.command.CommandMapping
|
||||||
import rs09.game.system.command.Privilege
|
import rs09.game.system.command.Privilege
|
||||||
import rs09.game.world.repository.Repository
|
import rs09.game.world.repository.Repository
|
||||||
import rs09.tools.stringtools.colorize
|
import rs09.tools.stringtools.colorize
|
||||||
|
import java.awt.HeadlessException
|
||||||
import java.awt.Toolkit
|
import java.awt.Toolkit
|
||||||
import java.awt.datatransfer.StringSelection
|
import java.awt.datatransfer.StringSelection
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
@ -76,9 +77,14 @@ class MiscCommandSet : CommandSet(Privilege.ADMIN){
|
||||||
SystemLogger.logInfo("Viewport: " + l.getSceneX(player.playerFlags.lastSceneGraph) + "," + l.getSceneY(player.playerFlags.lastSceneGraph))
|
SystemLogger.logInfo("Viewport: " + l.getSceneX(player.playerFlags.lastSceneGraph) + "," + l.getSceneY(player.playerFlags.lastSceneGraph))
|
||||||
val loc = "Location.create(" + l.x + ", " + l.y + ", " + l.z + ")"
|
val loc = "Location.create(" + l.x + ", " + l.y + ", " + l.z + ")"
|
||||||
SystemLogger.logInfo(loc + "; " + player.playerFlags.lastSceneGraph + ", " + l.localX + ", " + l.localY)
|
SystemLogger.logInfo(loc + "; " + player.playerFlags.lastSceneGraph + ", " + l.localX + ", " + l.localY)
|
||||||
|
try {
|
||||||
val stringSelection = StringSelection(loc)
|
val stringSelection = StringSelection(loc)
|
||||||
val clpbrd = Toolkit.getDefaultToolkit().systemClipboard
|
val clpbrd = Toolkit.getDefaultToolkit().systemClipboard
|
||||||
clpbrd.setContents(stringSelection, null)
|
clpbrd.setContents(stringSelection, null)
|
||||||
|
notify(player, "Coordinates copied to clipboard.")
|
||||||
|
} catch (e: HeadlessException) {
|
||||||
|
reject(player, "NOTE: Paste will not be available due to remote server.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue