package team.unstudio.udpl.area;

import java.util.HashMap;
import java.util.Map;

import org.bukkit.configuration.serialization.ConfigurationSerializable;

public class AreaDataContainer extends HashMap<String, Object> implements ConfigurationSerializable{
	
	public AreaDataContainer() {}
	
	public AreaDataContainer(Map<String, Object> data) {
		super(data);
	}
	
	@SuppressWarnings("unchecked")
	public <T> T get(String key){
		try{
			return (T) super.get(key);
		}catch(ClassCastException e){
			return null;
		}
	}
	
	@SuppressWarnings("unchecked")
	public <T> T get(String key,T def){
		if(!containsKey(key))
			return def;
		try{
			return (T) super.get(key);
		}catch(ClassCastException e){
			return def;
		}
	}

	@Override
	public Map<String, Object> serialize() {
		put("==", getClass().getName());
		return this;
	}
}

@@ -78,16 +78,49 @@
 il.Map;%0D
+%0Aimport java.util.regex.Pattern;%0D
 %0A%0D%0Aimpor
@@ -782,16 +782,375 @@
 %09%09%7D%0D%0A%09%7D%0D
+%0A%09%0D%0A%09@Override%0D%0A%09public Object put(String key, Object value)%7B%0D%0A%09%09if(!checkKey(key))%0D%0A%09%09%09throw new IllegalArgumentException(%22The key is wrong.%22);%0D%0A%09%09return super.put(key, value);%0D%0A%09%7D%0D%0A%09%0D%0A%09private static final Pattern KEY_PATTERN = Pattern.compile(%22%5BA-Z%7Ca-z%7C0-9%7C_%7C$%5D+%22);%0D%0A%09private boolean checkKey(String key)%7B%0D%0A%09%09return KEY_PATTERN.matcher(key).matches();%0D%0A%09%7D%0D
 %0A%0D%0A%09@Ove

Update Area