Delision Posted March 11, 2021 Posted March 11, 2021 Looking at the API it looks like they're identical with the exception of completeDialogueU not throwing java.lang.InterruptedException. Is it recommended to use one over the other? completeDialogueU public boolean completeDialogueU(java.lang.String... options) Completes the current dialogue using the specified options when available. WARNING - This method loops until either the player is not in a dialogue, the "Select an Option" menu does not contain any of the specified options, or an option selection event failed. Parameters: options - The options to choose while completing the dialogue. Returns: True if the player completed the dialogue successfully. completeDialogue public boolean completeDialogue(java.lang.String... options) throws java.lang.InterruptedException Completes the current dialogue using the specified options when available. WARNING - This method loops until either the player is not in a dialogue, the "Select an Option" menu does not contain any of the specified options, or an option selection event failed. Parameters: options - The options to choose while completing the dialogue. Returns: True if the player completed the dialogue successfully. Throws: java.lang.InterruptedException
BravoTaco Posted March 11, 2021 Posted March 11, 2021 (edited) I believe the difference is that completeDialogueU is surrounded in a try-catch, while the other is not. So you can use completeDialogueU without having to catch the exception yourself. Edited March 11, 2021 by BravoTaco
Camaro Posted March 11, 2021 Posted March 11, 2021 completeDialogU() does surround completeDialog() in a try/catch, but in doing so, consumes the current threads interrupted status, which is pretty bad programming practice. https://stackoverflow.com/questions/3976344/handling-interruptedexception-in-java onLoop() throws InterruptedException for a reason. Use completeDialog().
Delision Posted March 11, 2021 Author Posted March 11, 2021 7 hours ago, BravoTaco said: I believe the difference is that completeDialogueU is surrounded in a try-catch, while the other is not. So you can use completeDialogueU without having to catch the exception yourself. 54 minutes ago, Camaro said: completeDialogU() does surround completeDialog() in a try/catch, but in doing so, consumes the current threads interrupted status, which is pretty bad programming practice. https://stackoverflow.com/questions/3976344/handling-interruptedexception-in-java onLoop() throws InterruptedException for a reason. Use completeDialog(). Thanks for the responses! I appreciate the insight.