@@ -23,18 +23,18 @@ var ScoreboardAction;
23
23
;
24
24
/**
25
25
* fetch scoreboard objective display
26
- * @internal
26
+ * @deprecated Scoreboards Setter APIs Client Sync issue is fixed in 1.20.10
27
27
*/
28
28
const updateDisplay = ( objective ) => {
29
29
/**
30
30
* @type {(keyof typeof DisplaySlotId)[] }
31
31
*/
32
- const displaySlots = [ DisplaySlotId . belowname , DisplaySlotId . list , DisplaySlotId . sidebar ] ;
32
+ const displaySlots = [ DisplaySlotId . BelowName , DisplaySlotId . List , DisplaySlotId . Sidebar ] ;
33
33
for ( const displaySlotId of displaySlots ) {
34
34
const displaySlot = world . scoreboard . getObjectiveAtDisplaySlot ( DisplaySlotId [ displaySlotId ] ) ;
35
35
if ( displaySlot ?. objective === objective ) {
36
- world . scoreboard . clearObjectiveAtDisplaySlot ( DisplaySlotId . sidebar ) ;
37
- world . scoreboard . setObjectiveAtDisplaySlot ( DisplaySlotId . sidebar , displaySlot ) ;
36
+ world . scoreboard . clearObjectiveAtDisplaySlot ( DisplaySlotId . Sidebar ) ;
37
+ world . scoreboard . setObjectiveAtDisplaySlot ( DisplaySlotId . Sidebar , displaySlot ) ;
38
38
}
39
39
}
40
40
;
@@ -47,12 +47,12 @@ const updateDisplay = (objective) => {
47
47
* @param {ScoreboardAction } action Decides whether to add, remove, or set score to entity (default = set)
48
48
* @param {boolean } fetch Fetch scoreboard objective display (default = true)
49
49
*/
50
- function setScore ( entity , objectiveId , score , action , fetch = true ) {
50
+ function setScore ( entity , objectiveId , score , action ) {
51
51
// Check if scoreboard object exist first
52
52
const objective = world . scoreboard . getObjective ( objectiveId ) ;
53
53
if ( ! objective )
54
54
throw new ReferenceError ( 'Scoreboard objective does not exist in world.' ) ;
55
- const previousScore = ! ! entity . scoreboardIdentity ? entity . scoreboardIdentity . getScore ( objective ) : 0 ;
55
+ const previousScore = ! ! entity . scoreboardIdentity ? objective . getScore ( entity . scoreboardIdentity ) : 0 ;
56
56
switch ( action ) {
57
57
case ScoreboardAction . add :
58
58
score += previousScore ;
@@ -67,9 +67,7 @@ function setScore(entity, objectiveId, score, action, fetch = true) {
67
67
if ( ! entity . scoreboardIdentity )
68
68
entity . runCommand ( 'scoreboard players set @s ' + objective + ' ' + score ) ;
69
69
else
70
- entity . scoreboardIdentity . setScore ( objective , score ) ;
71
- if ( fetch )
72
- updateDisplay ( objective ) ;
70
+ objective . setScore ( entity . scoreboardIdentity , score ) ;
73
71
}
74
72
;
75
73
export { setScore } ;
0 commit comments