mirror of
https://github.com/kaboomserver/extras.git
synced 2025-04-22 09:23:40 -04:00
Merge pull request #371 from OptimisticDeving/fix-spidey-npe
Fix NPE in spidey block iterator material checking
This commit is contained in:
commit
fce68a8907
1 changed files with 6 additions and 4 deletions
|
@ -3,6 +3,7 @@ package pw.kaboom.extras.commands;
|
|||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -37,10 +38,11 @@ public final class CommandSpidey implements CommandExecutor {
|
|||
distance
|
||||
);
|
||||
|
||||
while (blockIterator.hasNext()
|
||||
&& (Material.AIR.equals(blockIterator.next().getType())
|
||||
|| Material.CAVE_AIR.equals(blockIterator.next().getType()))) {
|
||||
blockIterator.next().setType(Material.COBWEB);
|
||||
while (blockIterator.hasNext()) {
|
||||
final Block block = blockIterator.next();
|
||||
|
||||
if (block.getType() != Material.COBWEB && !block.getType().isAir()) break;
|
||||
block.setType(Material.COBWEB);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue