Enable checking the whitelist of breaking and placing.

This commit is contained in:
graywolf336
2014-01-19 15:53:42 -06:00
parent da26bc172e
commit f41ee77092
5 changed files with 72 additions and 41 deletions

View File

@ -4,6 +4,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -73,6 +74,24 @@ public class Util {
return (point1 <= loc) && (loc <= point2);
}
/**
* Checks if the given string is inside the list, ignoring the casing.
*
* <p />
*
* @param list of strings to check
* @param value to check
* @return true if the list contains the provided value, false if it doesn't
*/
public static boolean isStringInsideList(List<String> list, String value) {
boolean r = false;
for(String s : list)
if(s.equalsIgnoreCase(value))
return true;
return r;
}
/** Returns a colorful message from the color codes. */
public static String getColorfulMessage(String message) {
return message.replaceAll("(?i)&([0-9abcdefklmnor])", "\u00A7$1");