Skip to content

Commit

Permalink
Fix a bug in simplemetadatastore
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jul 17, 2016
1 parent 21d8ca8 commit 9fce987
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/net/citizensnpcs/api/npc/SimpleMetadataStore.java
@@ -1,13 +1,14 @@
package net.citizensnpcs.api.npc;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import net.citizensnpcs.api.util.DataKey;

import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;

import net.citizensnpcs.api.util.DataKey;

public class SimpleMetadataStore implements MetadataStore {
private final Map<String, MetadataObject> metadata = Maps.newHashMap();

Expand Down Expand Up @@ -45,9 +46,10 @@ public boolean has(String key) {

@Override
public void loadFrom(DataKey key) {
for (Entry<String, MetadataObject> entry : metadata.entrySet()) {
if (entry.getValue().persistent) {
remove(entry.getKey());
Iterator<Entry<String, MetadataObject>> itr = metadata.entrySet().iterator();
while (itr.hasNext()) {
if (itr.next().getValue().persistent) {
itr.remove();
}
}
for (DataKey subKey : key.getSubKeys()) {
Expand Down

0 comments on commit 9fce987

Please sign in to comment.