project: upstream
project: upstream
This commit is contained in:
@@ -106,7 +106,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
private Runnable onClose = null;
|
||||
|
||||
@Getter
|
||||
private Consumer<String> onDone = null;
|
||||
private Predicate<String> onDone = null;
|
||||
|
||||
@Getter
|
||||
private Consumer<String> onChanged = null;
|
||||
@@ -235,6 +235,20 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
}
|
||||
|
||||
public ChatboxTextInput onDone(Consumer<String> onDone)
|
||||
{
|
||||
this.onDone = (s) ->
|
||||
{
|
||||
onDone.accept(s);
|
||||
return true;
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the user attempts to close the input by pressing enter
|
||||
* Return false to cancel the close
|
||||
*/
|
||||
public ChatboxTextInput onDone(Predicate<String> onDone)
|
||||
{
|
||||
this.onDone = onDone;
|
||||
return this;
|
||||
@@ -750,9 +764,9 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
break;
|
||||
case KeyEvent.VK_ENTER:
|
||||
ev.consume();
|
||||
if (onDone != null)
|
||||
if (onDone != null && !onDone.test(getValue()))
|
||||
{
|
||||
onDone.accept(getValue());
|
||||
return;
|
||||
}
|
||||
chatboxPanelManager.close();
|
||||
return;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1DC252B93DF0D948329C4EAD151FA9406A17D3CF2C5C3EC0317BF4DCD1B3811A
|
||||
@@ -1,125 +0,0 @@
|
||||
.id 388
|
||||
.int_stack_count 1
|
||||
.string_stack_count 0
|
||||
.int_var_count 3
|
||||
.string_var_count 0
|
||||
invoke 384
|
||||
istore 1
|
||||
invoke 1138
|
||||
istore 2
|
||||
iload 2
|
||||
iconst 1
|
||||
if_icmpeq LABEL8
|
||||
jump LABEL80
|
||||
LABEL8:
|
||||
get_varp 1676
|
||||
iconst 4
|
||||
if_icmpgt LABEL12
|
||||
jump LABEL31
|
||||
LABEL12:
|
||||
iload 1
|
||||
iconst 0
|
||||
if_icmpgt LABEL16
|
||||
jump LABEL27
|
||||
LABEL16:
|
||||
get_varbit 5954
|
||||
iconst 1
|
||||
if_icmpeq LABEL20
|
||||
jump LABEL27
|
||||
LABEL20:
|
||||
sconst "Level: "
|
||||
iload 1
|
||||
tostring
|
||||
join_string 2
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL30
|
||||
LABEL27:
|
||||
sconst "Deadman"
|
||||
iload 0
|
||||
if_settext
|
||||
LABEL30:
|
||||
jump LABEL79
|
||||
LABEL31:
|
||||
get_varbit 4965
|
||||
iconst 0
|
||||
if_icmpgt LABEL35
|
||||
jump LABEL45
|
||||
LABEL35:
|
||||
sconst "Protection"
|
||||
iload 0
|
||||
if_settext
|
||||
iconst 0
|
||||
iconst 13
|
||||
iconst 1
|
||||
iconst 2
|
||||
iload 0
|
||||
if_setposition
|
||||
jump LABEL79
|
||||
LABEL45:
|
||||
iload 1
|
||||
iconst 0
|
||||
if_icmpgt LABEL49
|
||||
jump LABEL60
|
||||
LABEL49:
|
||||
get_varbit 5954
|
||||
iconst 1
|
||||
if_icmpeq LABEL53
|
||||
jump LABEL60
|
||||
LABEL53:
|
||||
sconst "Level: "
|
||||
iload 1
|
||||
tostring
|
||||
join_string 2
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL79
|
||||
LABEL60:
|
||||
get_varc_int 78
|
||||
iconst 1
|
||||
if_icmpeq LABEL64
|
||||
jump LABEL68
|
||||
LABEL64:
|
||||
sconst "Guarded"
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL79
|
||||
LABEL68:
|
||||
get_varc_int 78
|
||||
iconst 2
|
||||
if_icmpeq LABEL72
|
||||
jump LABEL76
|
||||
LABEL72:
|
||||
sconst "No PvP"
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL79
|
||||
LABEL76:
|
||||
sconst "Deadman"
|
||||
iload 0
|
||||
if_settext
|
||||
LABEL79:
|
||||
jump LABEL94
|
||||
LABEL80:
|
||||
iload 1
|
||||
iconst 0
|
||||
if_icmpgt LABEL84
|
||||
jump LABEL91
|
||||
LABEL84:
|
||||
sconst "Level: "
|
||||
iload 1
|
||||
tostring
|
||||
join_string 2
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL94
|
||||
LABEL91:
|
||||
sconst ""
|
||||
iload 0
|
||||
if_settext
|
||||
LABEL94:
|
||||
iload 1
|
||||
invoke 387
|
||||
sconst "wildernessWidgetTextSet" ; set callback name
|
||||
runelite_callback ; invoke callback
|
||||
return
|
||||
Reference in New Issue
Block a user