File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
scripts/library/structures/classes Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -3,24 +3,25 @@ import Server from "./server.js";
33class EntityBuilder {
44 findTag ( searchTag , target ) {
55 const allTags = this . getTags ( target ) ;
6- if ( ! allTags [ 0 ] ) return false ;
6+ if ( ! allTags ) return false ;
77 for ( const tag of allTags ) if ( tag . replace ( / § ./ g, '' ) . match ( new RegExp ( `^${ searchTag . replace ( / § ./ g, '' ) } $` ) ) ) return true ;
88 return false ;
99 } ;
1010 getTags ( target ) {
1111 const data = Server . runCommand ( `tag @e${ target ? `[${ target . replace ( / \] | \[ / g, '' ) } ]` : '' } list` ) ;
12- if ( data . error ) return [ ] ;
13- return data . result . statusMessage . match ( / (?< = : ) .* $ / ) [ 0 ] . split ( '§r, §a' ) ;
12+ if ( data . error ) return ;
13+ let tags = data . statusMessage . match ( / (?< = : ) .* $ / ) ;
14+ if ( tags ) return tags [ 0 ] . split ( '§r, §a' ) ;
1415 } ;
1516 getScore ( objective , target , { minimum, maximum } = { } ) {
1617 const data = Server . runCommand ( `scoreboard players test @e${ target ? `[${ target . replace ( / \] | \[ / g, '' ) } ]` : '' } ${ objective } ${ minimum ? minimum : '*' } ${ maximum ? maximum : '*' } ` ) ;
1718 if ( data . error ) return ;
18- return parseInt ( data . result . statusMessage . match ( / - ? \d + / ) [ 0 ] ) ;
19+ return parseInt ( data . statusMessage . match ( / - ? \d + / ) [ 0 ] ) ;
1920 } ;
2021} ;
2122
2223/**
2324 * @type {import('../typings/classes/Enitity').EntityBuilder }
2425 */
2526const Entity = new EntityBuilder ( ) ;
26- export default Entity ;
27+ export default Entity ;
You can’t perform that action at this time.
0 commit comments