mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2025-01-28 19:11:54 +01:00
Require non-nulls.
getInventory never returns null.
This commit is contained in:
parent
37d2039a67
commit
6c0915544e
@ -561,8 +561,8 @@ public class TryToComplete
|
|||||||
// cannot punish null or player who already was punished.
|
// cannot punish null or player who already was punished.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (requirements.getStatistic().getType())
|
switch (Objects.requireNonNull(requirements.getStatistic()).getType())
|
||||||
{
|
{
|
||||||
case UNTYPED -> {
|
case UNTYPED -> {
|
||||||
int statistic = player.getStatistic(requirements.getStatistic());
|
int statistic = player.getStatistic(requirements.getStatistic());
|
||||||
@ -877,12 +877,7 @@ public class TryToComplete
|
|||||||
{
|
{
|
||||||
int numInInventory;
|
int numInInventory;
|
||||||
|
|
||||||
if (this.user.getInventory() == null)
|
if (this.getInventoryRequirements().getIgnoreMetaData().contains(required.getType()))
|
||||||
{
|
|
||||||
// Sanity check. User always has inventory at this point of code.
|
|
||||||
numInInventory = 0;
|
|
||||||
}
|
|
||||||
else if (this.getInventoryRequirements().getIgnoreMetaData().contains(required.getType()))
|
|
||||||
{
|
{
|
||||||
numInInventory = Arrays.stream(this.user.getInventory().getContents()).
|
numInInventory = Arrays.stream(this.user.getInventory().getContents()).
|
||||||
filter(Objects::nonNull).
|
filter(Objects::nonNull).
|
||||||
@ -1420,7 +1415,7 @@ public class TryToComplete
|
|||||||
return EMPTY_RESULT;
|
return EMPTY_RESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (requirements.getStatistic().getType())
|
switch (Objects.requireNonNull(requirements.getStatistic()).getType())
|
||||||
{
|
{
|
||||||
case UNTYPED -> currentValue =
|
case UNTYPED -> currentValue =
|
||||||
this.manager.getStatisticData(this.user, this.world, requirements.getStatistic());
|
this.manager.getStatisticData(this.user, this.world, requirements.getStatistic());
|
||||||
|
Loading…
Reference in New Issue
Block a user