mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2024-12-29 04:28:03 +01:00
Fixes a crash that prevented STATISTICS entity and material/item challenges to be completed.
This commit is contained in:
parent
5ba7c681de
commit
ee8eaf8e84
@ -495,45 +495,54 @@ public class TryToComplete
|
||||
}
|
||||
}
|
||||
case ITEM, BLOCK -> {
|
||||
int statistic = this.user.getPlayer().getStatistic(requirements.getStatistic());
|
||||
|
||||
if (requirements.getMaterial() == null)
|
||||
{
|
||||
// Just a sanity check. Material cannot be null at this point of code.
|
||||
removeAmount = 0;
|
||||
}
|
||||
else if (removeAmount >= statistic)
|
||||
{
|
||||
this.user.getPlayer().setStatistic(requirements.getStatistic(), requirements.getMaterial(), 0);
|
||||
removeAmount -= statistic;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.user.getPlayer().setStatistic(requirements.getStatistic(),
|
||||
requirements.getMaterial(),
|
||||
statistic - removeAmount);
|
||||
removeAmount = 0;
|
||||
int statistic = this.user.getPlayer().getStatistic(requirements.getStatistic(),
|
||||
requirements.getMaterial());
|
||||
|
||||
if (removeAmount >= statistic)
|
||||
{
|
||||
this.user.getPlayer()
|
||||
.setStatistic(requirements.getStatistic(), requirements.getMaterial(), 0);
|
||||
removeAmount -= statistic;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.user.getPlayer().setStatistic(requirements.getStatistic(),
|
||||
requirements.getMaterial(),
|
||||
statistic - removeAmount);
|
||||
removeAmount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
case ENTITY -> {
|
||||
int statistic = this.user.getPlayer().getStatistic(requirements.getStatistic());
|
||||
|
||||
if (requirements.getEntity() == null)
|
||||
{
|
||||
// Just a sanity check. Entity cannot be null at this point of code.
|
||||
removeAmount = 0;
|
||||
}
|
||||
else if (removeAmount >= statistic)
|
||||
{
|
||||
this.user.getPlayer().setStatistic(requirements.getStatistic(), requirements.getEntity(), 0);
|
||||
removeAmount -= statistic;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.user.getPlayer().setStatistic(requirements.getStatistic(),
|
||||
requirements.getEntity(),
|
||||
statistic - removeAmount);
|
||||
removeAmount = 0;
|
||||
int statistic = this.user.getPlayer().getStatistic(requirements.getStatistic(),
|
||||
requirements.getEntity());
|
||||
|
||||
if (removeAmount >= statistic)
|
||||
{
|
||||
this.user.getPlayer().setStatistic(requirements.getStatistic(), requirements.getEntity(), 0);
|
||||
removeAmount -= statistic;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.user.getPlayer().setStatistic(requirements.getStatistic(),
|
||||
requirements.getEntity(),
|
||||
statistic - removeAmount);
|
||||
removeAmount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -577,45 +586,57 @@ public class TryToComplete
|
||||
}
|
||||
}
|
||||
case ITEM, BLOCK -> {
|
||||
int statistic = player.getStatistic(requirements.getStatistic());
|
||||
|
||||
if (requirements.getMaterial() == null)
|
||||
{
|
||||
// Just a sanity check. Entity cannot be null at this point of code.
|
||||
removeAmount = 0;
|
||||
}
|
||||
else if (removeAmount >= statistic)
|
||||
{
|
||||
removeAmount -= statistic;
|
||||
player.setStatistic(requirements.getStatistic(), requirements.getMaterial(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setStatistic(requirements.getStatistic(),
|
||||
requirements.getMaterial(),
|
||||
statistic - removeAmount);
|
||||
removeAmount = 0;
|
||||
int statistic = player.getStatistic(requirements.getStatistic(),
|
||||
requirements.getMaterial());
|
||||
|
||||
if (removeAmount >= statistic)
|
||||
{
|
||||
removeAmount -= statistic;
|
||||
player.setStatistic(requirements.getStatistic(),
|
||||
requirements.getMaterial(),
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setStatistic(requirements.getStatistic(),
|
||||
requirements.getMaterial(),
|
||||
statistic - removeAmount);
|
||||
removeAmount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
case ENTITY -> {
|
||||
int statistic = player.getStatistic(requirements.getStatistic());
|
||||
|
||||
if (requirements.getEntity() == null)
|
||||
{
|
||||
// Just a sanity check. Entity cannot be null at this point of code.
|
||||
removeAmount = 0;
|
||||
}
|
||||
else if (removeAmount >= statistic)
|
||||
{
|
||||
removeAmount -= statistic;
|
||||
player.setStatistic(requirements.getStatistic(), requirements.getEntity(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setStatistic(requirements.getStatistic(),
|
||||
requirements.getEntity(),
|
||||
statistic - removeAmount);
|
||||
removeAmount = 0;
|
||||
int statistic = player.getStatistic(requirements.getStatistic(),
|
||||
requirements.getEntity());
|
||||
|
||||
if (removeAmount >= statistic)
|
||||
{
|
||||
removeAmount -= statistic;
|
||||
player.setStatistic(requirements.getStatistic(),
|
||||
requirements.getEntity(),
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setStatistic(requirements.getStatistic(),
|
||||
requirements.getEntity(),
|
||||
statistic - removeAmount);
|
||||
removeAmount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user