# AdvancementManagerHelper

`com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper`

**Since:** 1.8.4

Provides the client's advancement tree and, when a player is available, that player's progress.  
 
 Progress queries use the local player's advancement progress; the unfiltered tree queries do not.  
 
 ```js
const player = Player.getPlayer();  
if (player !== null) {
  const manager = player.getAdvancementManager();  

  // the progress views
  Chat.log(`${manager.getCompletedAdvancements().length} done`);  
  Chat.log(`${manager.getStartedAdvancements().length} partly done`);  
  Chat.log(`${manager.getMissingAdvancements().length} not done`);  

  // one advancement, looked up by identifier
  const root = manager.getAdvancement("minecraft:story/root");  
  if (root.getRaw() !== null) {
    const progress = root.getProgress();  
    if (progress.getRaw() !== null) {
      Chat.log(`root is ${progress.isDone() ? "done" : "not done"}`);  
    } else {
      Chat.log("root has no progress entry");  
    }
  }
}
 ```

## Constructors

### new AdvancementManagerHelper {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_constructor-AdvancementTree-}

```js
new AdvancementManagerHelper(AdvancementTree advancementManager)
```

Wraps the supplied advancement tree.

**Parameters:**
- `advancementManager`: raw advancement tree to wrap

## Methods

### getAdvancement {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getAdvancement-String-}

```js
getAdvancement(String identifier): AdvancementHelper
```

Looks up an advancement by identifier; an omitted namespace defaults to `minecraft`.  
 The wrapper has no underlying node if the identifier is absent from the tree; check its raw
 value before using the wrapper.  
 ```js
const player = Player.getPlayer();  
if (player === null) { throw new Error("not in a world"); }
const manager = player.getAdvancementManager();  
// both spellings work, the namespace is optional
const a = manager.getAdvancement("minecraft:story/root");  
const b = manager.getAdvancement("story/root");  
if (a.getRaw() !== null) {
  if (b.getRaw() !== null) {
    Chat.log(`${a.getId()} is ${b.getId()}`);  
  }
}
 ```

**Parameters:**
- `identifier`: the advancement identifier; the `minecraft` namespace may be omitted

**Returns:** a wrapper for the matching advancement, with no underlying node if it is absent

**Since:** 1.8.4

### getAdvancementProgress {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getAdvancementProgress-String-}

```js
getAdvancementProgress(String identifier): AdvancementProgressHelper
```

Returns local-player progress for an advancement identifier; an omitted namespace defaults
 to `minecraft`. The advancement must exist in the tree. If it has no progress entry,  
 the returned wrapper has no underlying progress; check its raw value before using it.

**Parameters:**
- `identifier`: the advancement identifier

**Returns:** a wrapper for the advancement's progress entry, which may have no underlying progress

**Since:** 1.8.4

### getAdvancements {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getAdvancements-}

```js
getAdvancements(): List<AdvancementHelper>
```

Returns every advancement node in the tree; the list order is unspecified.

**Returns:** the advancement nodes

**Since:** 1.8.4

### getAdvancementsForIdentifiers {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getAdvancementsForIdentifiers-}

```js
getAdvancementsForIdentifiers(): Map<String, AdvancementHelper>
```

Returns the advancement tree keyed by each identifier's `namespace:path` string.

**Returns:** a map containing every advancement; identifiers use the `namespace:path` form

**Since:** 1.8.4

### getAdvancementsProgress {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getAdvancementsProgress-}

```js
getAdvancementsProgress(): Map<AdvancementHelper, AdvancementProgressHelper>
```

Returns the local player's progress entries, keyed by their advancement nodes.

**Returns:** progress entries present in the local player's progress store

**Since:** 1.8.4

### getCompletedAdvancements {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getCompletedAdvancements-}

```js
getCompletedAdvancements(): List<AdvancementHelper>
```

Returns local-player progress entries that are complete.

**Returns:** the matching advancement nodes

**Since:** 1.8.4

### getMissingAdvancements {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getMissingAdvancements-}

```js
getMissingAdvancements(): List<AdvancementHelper>
```

Returns local-player progress entries that are not complete, including entries with no criteria obtained.

**Returns:** the matching advancement nodes

**Since:** 1.8.4

### getRootAdvancements {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getRootAdvancements-}

```js
getRootAdvancements(): List<AdvancementHelper>
```

Returns root advancements, which have no parent.

**Returns:** the root advancement nodes

**Since:** 1.8.4

### getStartedAdvancements {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getStartedAdvancements-}

```js
getStartedAdvancements(): List<AdvancementHelper>
```

Returns local-player progress entries that are incomplete and have at least one criterion obtained.

**Returns:** the matching advancement nodes

**Since:** 1.8.4

### getSubAdvancements {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_getSubAdvancements-}

```js
getSubAdvancements(): List<AdvancementHelper>
```

Returns a flat list of non-root advancements.

**Returns:** the non-root advancement nodes

**Since:** 1.8.4

### toString {#com.jsmacrosce.jsmacros.client.api.helper.AdvancementManagerHelper_toString-}

```js
toString(): String
```

Returns a diagnostic representation with started, missing, and completed advancement counts.  
 Counts are obtained from the local player's progress lists; started entries are also included
 in the missing count. A local player is required.

**Returns:** diagnostic representation containing started, missing, and completed counts
