Arcaniax-Development / Builders-Utilities

GNU General Public License v3.0
30 stars 25 forks source link

Fix `NoSuchElementException` when using `/banner` in 1.20.5/6 #160

Closed thomasmny closed 3 months ago

thomasmny commented 3 months ago

Overview

Fixes Bug reported on Discord

Description

In 1.20.5, Spigot added the CraftPatternType class which is used to get an EnumBannerPatternType from the banner pattern registry using its Bukkit counterpart.

Since 1.20.5 contains experimental 1.21 patterns ("flow" & "guster") which are not present on a 1.20.5/6 server, a NoSuchElementException was thrown when attempting to get said patterns from the registry: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/block/banner/CraftPatternType.java#33

This commit attempts to catch not present patterns on startup and removes them from the allPatterns list

Checklist