mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
SPIGOT-6952: Tag#isTagged throws NullPointerException in 1.18.2
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
9ee989ea81
commit
59e5f5af8f
2 changed files with 16 additions and 2 deletions
|
@ -17,7 +17,14 @@ public class CraftBlockTag extends CraftTag<Block, Material> {
|
|||
|
||||
@Override
|
||||
public boolean isTagged(Material item) {
|
||||
return CraftMagicNumbers.getBlock(item).builtInRegistryHolder().is(tag);
|
||||
Block block = CraftMagicNumbers.getBlock(item);
|
||||
|
||||
// SPIGOT-6952: A Material is not necessary a block, in this case return false
|
||||
if (block == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return block.builtInRegistryHolder().is(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,14 @@ public class CraftItemTag extends CraftTag<Item, Material> {
|
|||
|
||||
@Override
|
||||
public boolean isTagged(Material item) {
|
||||
return CraftMagicNumbers.getItem(item).builtInRegistryHolder().is(tag);
|
||||
Item minecraft = CraftMagicNumbers.getItem(item);
|
||||
|
||||
// SPIGOT-6952: A Material is not necessary an item, in this case return false
|
||||
if (minecraft == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return minecraft.builtInRegistryHolder().is(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue