This commit is contained in:
boy0001 2015-02-20 17:34:19 +11:00
parent dea6e84407
commit 0d382ac9c3
215 changed files with 4930 additions and 6474 deletions

View file

@ -18,7 +18,6 @@
// /
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.flag;
import org.apache.commons.lang.StringUtils;
@ -26,7 +25,7 @@ import org.apache.commons.lang.StringUtils;
public class Flag {
private AbstractFlag key;
private 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
* player, you need to register it with PlotSquared.
@ -37,7 +36,7 @@ public class Flag {
* @throws IllegalArgumentException if you provide inadequate inputs
*/
public Flag(final AbstractFlag key, final String value) {
final char[] allowedCharacters = new char[]{'[', ']', '(', ')', ',', '_', '-', '.', ',', '?', '!', '&', ':', '\u00A7'};
final char[] allowedCharacters = new char[] { '[', ']', '(', ')', ',', '_', '-', '.', ',', '?', '!', '&', ':', '\u00A7' };
String tempValue = value;
for (final char c : allowedCharacters) {
tempValue = tempValue.replace(c, 'c');
@ -55,21 +54,21 @@ public class Flag {
}
}
public void setKey(AbstractFlag key) {
public void setKey(final AbstractFlag key) {
this.key = key;
if (this.value instanceof String) {
this.value = key.parseValueRaw((String) this.value);
}
}
/**
* Warning: Unchecked
*/
public Flag(final AbstractFlag key, final Object value) {
this.key = key;
this.value = value;
this.key = key;
this.value = value;
}
/**
* Get the AbstractFlag used in creating the flag
*
@ -78,7 +77,7 @@ public class Flag {
public AbstractFlag getAbstractFlag() {
return this.key;
}
/**
* Get the key for the AbstractFlag
*
@ -87,7 +86,7 @@ public class Flag {
public String getKey() {
return this.key.getKey();
}
/**
* Get the value
*
@ -98,9 +97,9 @@ public class Flag {
}
public String getValueString() {
return this.key.toString(this.value);
return this.key.toString(this.value);
}
@Override
public String toString() {
if (this.value.equals("")) {
@ -108,7 +107,7 @@ public class Flag {
}
return this.key + ":" + getValueString();
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
@ -123,7 +122,7 @@ public class Flag {
final Flag other = (Flag) obj;
return (this.key.getKey().equals(other.key.getKey()) && this.value.equals(other.value));
}
@Override
public int hashCode() {
return this.key.getKey().hashCode();