mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
parent
20c2f36f6c
commit
541255fe7e
@ -43,8 +43,18 @@ public abstract class ListFlag<V, F extends PlotFlag<List<V>, F>> extends PlotFl
|
|||||||
@Override
|
@Override
|
||||||
public F merge(@NonNull List<V> newValue) {
|
public F merge(@NonNull List<V> newValue) {
|
||||||
final List<V> mergedList = new ArrayList<>();
|
final List<V> mergedList = new ArrayList<>();
|
||||||
mergedList.addAll(getValue());
|
// If a server already used PS before this fix, we remove all present duplicates on an eventual merge
|
||||||
mergedList.addAll(newValue);
|
for (final V v : getValue()) {
|
||||||
|
if (!mergedList.contains(v)) {
|
||||||
|
mergedList.add(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Only add new values if not already present from #getValue()
|
||||||
|
for (final V v : newValue) {
|
||||||
|
if (!mergedList.contains(v)) {
|
||||||
|
mergedList.add(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
return this.flagOf(mergedList);
|
return this.flagOf(mergedList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user