Commits

md_5 authored b44d1d7b094
Assorted whitespace fixes
No tags

src/main/java/org/bukkit/block/banner/Pattern.java

Modified
5 5 import java.util.NoSuchElementException;
6 6 import org.bukkit.DyeColor;
7 7 import org.bukkit.configuration.serialization.ConfigurationSerializable;
8 8 import org.bukkit.configuration.serialization.SerializableAs;
9 9
10 10 @SerializableAs("Pattern")
11 11 public class Pattern implements ConfigurationSerializable {
12 12
13 13 private static final String COLOR = "color";
14 14 private static final String PATTERN = "pattern";
15 -
15 +
16 16 private final DyeColor color;
17 17 private final PatternType pattern;
18 18
19 19 /**
20 20 * Creates a new pattern from the specified color and
21 21 * pattern type
22 22 *
23 23 * @param color the pattern color
24 24 * @param pattern the pattern type
25 25 */
26 26 public Pattern(DyeColor color, PatternType pattern) {
27 27 this.color = color;
28 28 this.pattern = pattern;
29 29 }
30 -
30 +
31 31 /**
32 32 * Constructor for deserialization.
33 33 *
34 34 * @param map the map to deserialize from
35 35 */
36 36 public Pattern(Map<String, Object> map) {
37 37 color = DyeColor.valueOf(getString(map, COLOR));
38 38 pattern = PatternType.getByIdentifier(getString(map, PATTERN));
39 - }
39 + }
40 40
41 - private static String getString(Map<?,?> map, Object key) {
41 + private static String getString(Map<?, ?> map, Object key) {
42 42 Object str = map.get(key);
43 43 if (str instanceof String) {
44 44 return (String) str;
45 45 }
46 46 throw new NoSuchElementException(map + " does not contain " + key);
47 47 }
48 -
48 +
49 49 @Override
50 50 public Map<String, Object> serialize() {
51 51 return ImmutableMap.<String, Object>of(
52 52 COLOR, color.toString(),
53 53 PATTERN, pattern.getIdentifier()
54 54 );
55 55 }
56 56
57 57 /**
58 58 * Returns the color of the pattern

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut