Commits

DerFrZocker authored bef033b58d2
Some more cleanup
No tags
experimental

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

Modified
81 81 * @param identifier the identifier
82 82 * @return the matched pattern type or null
83 83 */
84 84 @Contract("null -> null")
85 85 @Nullable
86 86 public static PatternType getByIdentifier(@Nullable String identifier) {
87 87 if (identifier == null) {
88 88 return null;
89 89 }
90 90
91 - return byString.computeIfAbsent(identifier, id -> {
92 - for (PatternType patternType : Registry.BANNER_PATTERN) {
93 - if (identifier.equals(patternType.getIdentifier())) {
94 - return patternType;
95 - }
91 + PatternType patternType = byString.get(identifier);
92 + if (patternType != null) {
93 + return patternType;
94 + }
95 +
96 + for (PatternType type : Registry.BANNER_PATTERN) {
97 + if (identifier.equals(type.getIdentifier())) {
98 + byString.put(identifier, type);
99 + return type;
96 100 }
101 + }
97 102
98 - return null;
99 - });
103 + return null;
100 104 }
101 105
102 106 /**
103 107 * @return an array of all known pattern types.
104 108 * @deprecated use {@link Registry#iterator()}.
105 109 */
106 110 @NotNull
107 111 @Deprecated
108 112 public static PatternType[] values() {
109 113 return Lists.newArrayList(Registry.BANNER_PATTERN).toArray(new PatternType[0]);

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

Add shortcut