fix tab completion for /jsp command

This commit is contained in:
walterhiggins 2014-05-29 22:10:16 +01:00
parent a2b0cda399
commit 20519d88db
2 changed files with 7 additions and 5 deletions

View file

@ -1,3 +1,9 @@
# 2014 05 29
Fix tab completion for /jsp command so that it conforms with tab completion norms in minecraft.
/jsp ice<TAB> completes to /jsp icecream
Hitting TAB again has no effect. Player must type space then hit TAB to get list of flavors.
This is consistent with how MC treats other commands for tab completion.
# 2014 05 19 # 2014 05 19
Improved Tab Completion to work with Java Enums too. Improved Tab Completion to work with Java Enums too.

View file

@ -13,11 +13,7 @@ var __onTabCompleteJSP = function( result, cmdSender, pluginCmd, cmdAlias, cmdAr
if ( cmd ) { if ( cmd ) {
opts = cmd.options; opts = cmd.options;
len = opts.length; len = opts.length;
if ( cmdArgs.length == 1 ) { if ( cmdArgs.length > 1 ) {
for ( i = 0; i < len; i++ ) {
result.add( opts[i] );
}
} else {
// partial e.g. /jsp chat_color dar // partial e.g. /jsp chat_color dar
for ( i = 0; i < len; i++ ) { for ( i = 0; i < len; i++ ) {
if ( opts[i].indexOf( cmdArgs[1] ) == 0 ) { if ( opts[i].indexOf( cmdArgs[1] ) == 0 ) {