mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-01 05:58:00 +01:00
You cannot create two advancement tab with the same identifier
This commit is contained in:
parent
cf1ad3293c
commit
87fcb83837
@ -1,5 +1,7 @@
|
||||
package net.minestom.server.advancements;
|
||||
|
||||
import net.minestom.server.utils.validate.Check;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -8,6 +10,8 @@ public class AdvancementManager {
|
||||
private Map<String, AdvancementTab> advancementTabMap = new HashMap<>();
|
||||
|
||||
public AdvancementTab createTab(String rootIdentifier, AdvancementRoot root) {
|
||||
Check.stateCondition(advancementTabMap.containsKey(rootIdentifier),
|
||||
"A tab with the identifier '" + rootIdentifier + "' already exists");
|
||||
final AdvancementTab advancementTab = new AdvancementTab(rootIdentifier, root);
|
||||
this.advancementTabMap.put(rootIdentifier, advancementTab);
|
||||
return advancementTab;
|
||||
|
Loading…
Reference in New Issue
Block a user