mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Correctly return null for invalid IDs when doing legacy conversion
This commit is contained in:
parent
8bcef6022b
commit
2c33fb6834
1 changed files with 3 additions and 1 deletions
|
@ -130,11 +130,13 @@ public interface IItemDb {
|
||||||
* item IDs to modern names.
|
* item IDs to modern names.
|
||||||
*
|
*
|
||||||
* @param item Legacy ID in colon syntax.
|
* @param item Legacy ID in colon syntax.
|
||||||
* @return
|
* @return Material if an appropriate material exists, else null.
|
||||||
*/
|
*/
|
||||||
default Material getFromLegacy(String item) {
|
default Material getFromLegacy(String item) {
|
||||||
final String[] split = item.split(":");
|
final String[] split = item.split(":");
|
||||||
|
|
||||||
|
if (!NumberUtil.isInt(split[0])) return null;
|
||||||
|
|
||||||
final int id = Integer.parseInt(split[0]);
|
final int id = Integer.parseInt(split[0]);
|
||||||
byte damage = 0;
|
byte damage = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue