mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-10-07 11:07:33 +02:00
Fixes blueprint saving with same name.
Blueprints saved with the same name were not overwriting the internal blueprint list causing duplicates.
This commit is contained in:
parent
cca381e51a
commit
7843d2b23a
@ -235,12 +235,14 @@ public class BlueprintsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a blueprint to addon's list of blueprints
|
* Adds a blueprint to addon's list of blueprints. If the list already contains a blueprint with the same name
|
||||||
|
* it is replaced.
|
||||||
* @param addon - the {@link GameModeAddon}
|
* @param addon - the {@link GameModeAddon}
|
||||||
* @param bp - blueprint
|
* @param bp - blueprint
|
||||||
*/
|
*/
|
||||||
public void addBlueprint(@NonNull GameModeAddon addon, @NonNull Blueprint bp) {
|
public void addBlueprint(@NonNull GameModeAddon addon, @NonNull Blueprint bp) {
|
||||||
blueprints.putIfAbsent(addon, new ArrayList<>());
|
blueprints.putIfAbsent(addon, new ArrayList<>());
|
||||||
|
blueprints.get(addon).removeIf(b -> b.getName().equals(bp.getName()));
|
||||||
blueprints.get(addon).add(bp);
|
blueprints.get(addon).add(bp);
|
||||||
plugin.log("Added blueprint '" + bp.getName() + "' for " + addon.getDescription().getName());
|
plugin.log("Added blueprint '" + bp.getName() + "' for " + addon.getDescription().getName());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user