Skip to content

Commit 7c51996

Browse files
committed
getScore fix
Fixed it where it returned array instead of string
1 parent cfe1fa7 commit 7c51996

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

scripts/modules/minecraft/lib/utils/misc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function writeLeaderboard([x, y, z], objective, { displayLength, leaderboardHead
6161

6262
getPlayers().forEach(player => {
6363
const data = getScore({ objective }, { entityRequirements: `[type=player,name="${player}"]`});
64-
if(data) onlineLeaderboard.push({ gamertag: player, score: data[0] });
64+
if(data) onlineLeaderboard.push({ gamertag: player, score: data });
6565
});
6666

6767
for(let i = 0; i < onlineLeaderboard.length; i++) {

scripts/modules/minecraft/lib/utils/others.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function findTag({ entityRequirements } = {}, { searchTag }) {
5858
function getScore({ objective }, { entityRequirements, minimum, maximum } = {}) {
5959
const data = runCommand(`scoreboard players test @e${entityRequirements ? `[${entityRequirements.replace(/\]|\[/g, '')}]` : ''} ${objective} ${minimum ? minimum : '*'} ${maximum ? maximum : '*'}`);
6060
if(data.error) return;
61-
return data.result.statusMessage.match(/\d+/);
61+
return data.result.statusMessage.match(/\d+/)[0];
6262
};
6363
/**
6464
* @function getPlayers() - Get an array of online players in the world

0 commit comments

Comments
 (0)