[UNSTABLE] Working on plot protection system

This commit is contained in:
Jesse Boyd 2015-01-24 21:40:50 -07:00
parent 90856e4424
commit 030f2df21c
13 changed files with 377 additions and 226 deletions

View file

@ -25,7 +25,7 @@ import org.apache.commons.lang.StringUtils;
public class Flag {
private final AbstractFlag key;
private final String value;
private final Object value;
/**
* Flag object used to store basic information for a Plot. Flags are a key/value pair. For a flag to be usable by a
@ -49,12 +49,20 @@ public class Flag {
throw new IllegalArgumentException("Value must be <= 48 characters");
}
this.key = key;
this.value = key.parseValue(value);
this.value = key.parseValueRaw(value);
if (this.value == null) {
throw new IllegalArgumentException(key.getValueDesc());
}
}
/**
* Warning: Unchecked
*/
public Flag(final AbstractFlag key, final Object value) {
this.key = key;
this.value = value;
}
/**
* Get the AbstractFlag used in creating the flag
*
@ -78,16 +86,20 @@ public class Flag {
*
* @return String
*/
public String getValue() {
public Object getValue() {
return this.value;
}
public String getValueString() {
return this.key.toString(this.value);
}
@Override
public String toString() {
if (this.value.equals("")) {
return this.key.getKey();
}
return this.key + ":" + this.value;
return this.key + ":" + getValueString();
}
@Override