Commits
md_5 authored 277baff1a14
1 + | package org.bukkit.block.banner; |
2 + | |
3 + | import org.bukkit.DyeColor; |
4 + | import org.bukkit.configuration.serialization.SerializableAs; |
5 + | |
6 + | "Pattern") | (
7 + | public class Pattern { |
8 + | |
9 + | private final DyeColor color; |
10 + | private final PatternType pattern; |
11 + | |
12 + | /** |
13 + | * Creates a new pattern from the specified color and |
14 + | * pattern type |
15 + | * |
16 + | * @param color the pattern color |
17 + | * @param pattern the pattern type |
18 + | */ |
19 + | public Pattern(DyeColor color, PatternType pattern) { |
20 + | this.color = color; |
21 + | this.pattern = pattern; |
22 + | } |
23 + | |
24 + | /** |
25 + | * Returns the color of the pattern |
26 + | * |
27 + | * @return the color of the pattern |
28 + | */ |
29 + | public DyeColor getColor() { |
30 + | return color; |
31 + | } |
32 + | |
33 + | /** |
34 + | * Returns the type of pattern |
35 + | * |
36 + | * @return the pattern type |
37 + | */ |
38 + | public PatternType getPattern() { |
39 + | return pattern; |
40 + | } |
41 + | |
42 + | |
43 + | public int hashCode() { |
44 + | int hash = 3; |
45 + | hash = 97 * hash + (this.color != null ? this.color.hashCode() : 0); |
46 + | hash = 97 * hash + (this.pattern != null ? this.pattern.hashCode() : 0); |
47 + | return hash; |
48 + | } |
49 + | |
50 + | |
51 + | public boolean equals(Object obj) { |
52 + | if (obj == null) { |
53 + | return false; |
54 + | } |
55 + | if (getClass() != obj.getClass()) { |
56 + | return false; |
57 + | } |
58 + | final Pattern other = (Pattern) obj; |
59 + | return this.color == other.color && this.pattern == other.pattern; |
60 + | } |
61 + | } |