@@ -18,12 +18,68 @@ on_command("pos", PrivilegeLevel.MODERATOR)
18
18
player.sendMessage(" You are at: ($x , $y , $z ) in region (${region.x} , ${region.y} )." )
19
19
}
20
20
21
+ val TELEPORT_DESTINATIONS = listOf (
22
+ " alkharid" to Position (3292 , 3171 , 0 ),
23
+ " ardougne" to Position (2662 , 3304 , 0 ),
24
+ " barrows" to Position (3565 , 3314 , 0 ),
25
+ " brimhaven" to Position (2802 , 3179 , 0 ),
26
+ " burthorpe" to Position (2898 , 3545 , 0 ),
27
+ " camelot" to Position (2757 , 3478 , 0 ),
28
+ " canifis" to Position (3493 , 3489 , 0 ),
29
+ " cw" to Position (2442 , 3090 , 0 ),
30
+ " draynor" to Position (3082 , 3249 , 0 ),
31
+ " duelarena" to Position (3370 , 3267 , 0 ),
32
+ " edgeville" to Position (3087 , 3504 , 0 ),
33
+ " entrana" to Position (2827 , 3343 , 0 ),
34
+ " falador" to Position (2965 , 3379 , 0 ),
35
+ " ge" to Position (3164 , 3476 , 0 ),
36
+ " kbd" to Position (2273 , 4680 , 0 ),
37
+ " keldagrim" to Position (2845 , 10210 , 0 ),
38
+ " kq" to Position (3507 , 9494 , 0 ),
39
+ " lumbridge" to Position (3222 , 3219 , 0 ),
40
+ " lunar" to Position (2113 , 3915 , 0 ),
41
+ " misc" to Position (2515 , 3866 , 0 ),
42
+ " neit" to Position (2332 , 3804 , 0 ),
43
+ " pc" to Position (2658 , 2660 , 0 ),
44
+ " rellekka" to Position (2660 , 3657 , 0 ),
45
+ " shilo" to Position (2852 , 2955 , 0 ),
46
+ " taverley" to Position (2895 , 3443 , 0 ),
47
+ " tutorial" to Position (3094 , 3107 , 0 ),
48
+ " tzhaar" to Position (2480 , 5175 , 0 ),
49
+ " varrock" to Position (3212 , 3423 , 0 ),
50
+ " yanille" to Position (2605 , 3096 , 0 ),
51
+ " zanaris" to Position (2452 , 4473 , 0 )
52
+ )
53
+
21
54
/* *
22
55
* Teleports the player to the specified position.
23
56
*/
24
57
on_command(" tele" , PrivilegeLevel .ADMINISTRATOR )
25
58
.then { player ->
26
- val invalidSyntax = " Invalid syntax - ::tele [x] [y] [optional-z]"
59
+ val invalidSyntax = " Invalid syntax - ::tele [x] [y] [optional-z] or ::tele [place name]"
60
+
61
+ if (arguments.size == 1 ) {
62
+ val query = arguments[0 ]
63
+ val results = TELEPORT_DESTINATIONS .filter {
64
+ (name, _) -> name.startsWith(query)
65
+ }
66
+
67
+ if (results.size == 0 ) {
68
+ player.sendMessage(" No destinations matching '$query '." )
69
+ return @then
70
+ } else if (results.size > 1 ) {
71
+ player.sendMessage(" Ambiguous query '$query ' (could " +
72
+ " be $results ). Please disambiguate." )
73
+ return @then
74
+ }
75
+
76
+ val (name, dest) = results[0 ]
77
+ player.sendMessage(" Teleporting to $name ." )
78
+ player.teleport(dest)
79
+
80
+ return @then
81
+ }
82
+
27
83
if (! valid_arg_length(arguments, 2 .. 3 , player, invalidSyntax)) {
28
84
return @then
29
85
}
@@ -53,4 +109,4 @@ on_command("tele", PrivilegeLevel.ADMINISTRATOR)
53
109
if (z in 0 .. 4 ) {
54
110
player.teleport(Position (x, y, z))
55
111
}
56
- }
112
+ }
0 commit comments